Title: [159072] trunk/Source/WebCore
Revision
159072
Author
beid...@apple.com
Date
2013-11-11 14:41:39 -0800 (Mon, 11 Nov 2013)

Log Message

Make IDBBackingStoreTransaction be RefCounted
https://bugs.webkit.org/show_bug.cgi?id=124168

Reviewed by Tim Horton.

This is necessarily to safely add a fully asynchronous interface into the IDB mechanism.

* Modules/indexeddb/IDBBackingStoreInterface.h:
* Modules/indexeddb/IDBBackingStoreTransactionInterface.h:
* Modules/indexeddb/IDBTransactionBackend.h:

* Modules/indexeddb/leveldb/IDBBackingStoreLevelDB.cpp:
(WebCore::IDBBackingStoreLevelDB::createBackingStoreTransaction):
* Modules/indexeddb/leveldb/IDBBackingStoreLevelDB.h:
* Modules/indexeddb/leveldb/IDBBackingStoreTransactionLevelDB.h:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (159071 => 159072)


--- trunk/Source/WebCore/ChangeLog	2013-11-11 22:39:40 UTC (rev 159071)
+++ trunk/Source/WebCore/ChangeLog	2013-11-11 22:41:39 UTC (rev 159072)
@@ -1,3 +1,21 @@
+2013-11-11  Brady Eidson  <beid...@apple.com>
+
+        Make IDBBackingStoreTransaction be RefCounted
+        https://bugs.webkit.org/show_bug.cgi?id=124168
+
+        Reviewed by Tim Horton.
+
+        This is necessarily to safely add a fully asynchronous interface into the IDB mechanism.
+
+        * Modules/indexeddb/IDBBackingStoreInterface.h:
+        * Modules/indexeddb/IDBBackingStoreTransactionInterface.h:
+        * Modules/indexeddb/IDBTransactionBackend.h:
+
+        * Modules/indexeddb/leveldb/IDBBackingStoreLevelDB.cpp:
+        (WebCore::IDBBackingStoreLevelDB::createBackingStoreTransaction):
+        * Modules/indexeddb/leveldb/IDBBackingStoreLevelDB.h:
+        * Modules/indexeddb/leveldb/IDBBackingStoreTransactionLevelDB.h:
+
 2013-11-11  Antti Koivisto  <an...@apple.com>
 
         End of line whitespace should collapse with white-space:pre-wrap; overflow-wrap:break-word in all cases

Modified: trunk/Source/WebCore/Modules/indexeddb/IDBBackingStoreInterface.h (159071 => 159072)


--- trunk/Source/WebCore/Modules/indexeddb/IDBBackingStoreInterface.h	2013-11-11 22:39:40 UTC (rev 159071)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBBackingStoreInterface.h	2013-11-11 22:41:39 UTC (rev 159072)
@@ -53,7 +53,7 @@
 public:
     virtual ~IDBBackingStoreInterface() { }
 
-    virtual std::unique_ptr<IDBBackingStoreTransactionInterface> createBackingStoreTransaction() = 0;
+    virtual PassRefPtr<IDBBackingStoreTransactionInterface> createBackingStoreTransaction() = 0;
 
     // New-style asynchronous callbacks
     typedef std::function<void (const IDBDatabaseMetadata&, bool success)> GetIDBDatabaseMetadataFunction;

Modified: trunk/Source/WebCore/Modules/indexeddb/IDBBackingStoreTransactionInterface.h (159071 => 159072)


--- trunk/Source/WebCore/Modules/indexeddb/IDBBackingStoreTransactionInterface.h	2013-11-11 22:39:40 UTC (rev 159071)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBBackingStoreTransactionInterface.h	2013-11-11 22:41:39 UTC (rev 159072)
@@ -26,11 +26,13 @@
 #ifndef IDBBackingStoreTransactionInterface_h
 #define IDBBackingStoreTransactionInterface_h
 
+#include <wtf/RefCounted.h>
+
 #if ENABLE(INDEXED_DATABASE)
 
 namespace WebCore {
 
-class IDBBackingStoreTransactionInterface {
+class IDBBackingStoreTransactionInterface : public RefCounted<IDBBackingStoreTransactionInterface> {
 public:
     virtual ~IDBBackingStoreTransactionInterface() { }
 

Modified: trunk/Source/WebCore/Modules/indexeddb/IDBTransactionBackend.h (159071 => 159072)


--- trunk/Source/WebCore/Modules/indexeddb/IDBTransactionBackend.h	2013-11-11 22:39:40 UTC (rev 159071)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBTransactionBackend.h	2013-11-11 22:41:39 UTC (rev 159072)
@@ -116,7 +116,7 @@
     TaskQueue m_preemptiveTaskQueue;
     TaskQueue m_abortTaskQueue;
 
-    std::unique_ptr<IDBBackingStoreTransactionInterface> m_backingStoreTransaction;
+    RefPtr<IDBBackingStoreTransactionInterface> m_backingStoreTransaction;
 
     // FIXME: delete the timer once we have threads instead.
     Timer<IDBTransactionBackend> m_taskTimer;

Modified: trunk/Source/WebCore/Modules/indexeddb/leveldb/IDBBackingStoreLevelDB.cpp (159071 => 159072)


--- trunk/Source/WebCore/Modules/indexeddb/leveldb/IDBBackingStoreLevelDB.cpp	2013-11-11 22:39:40 UTC (rev 159071)
+++ trunk/Source/WebCore/Modules/indexeddb/leveldb/IDBBackingStoreLevelDB.cpp	2013-11-11 22:41:39 UTC (rev 159072)
@@ -1912,9 +1912,9 @@
     return cursor.release();
 }
 
-std::unique_ptr<IDBBackingStoreTransactionInterface> IDBBackingStoreLevelDB::createBackingStoreTransaction()
+PassRefPtr<IDBBackingStoreTransactionInterface> IDBBackingStoreLevelDB::createBackingStoreTransaction()
 {
-    return std::unique_ptr<IDBBackingStoreTransactionInterface>(new IDBBackingStoreTransactionLevelDB(this));
+    return IDBBackingStoreTransactionLevelDB::create(this);
 }
 
 } // namespace WebCore

Modified: trunk/Source/WebCore/Modules/indexeddb/leveldb/IDBBackingStoreLevelDB.h (159071 => 159072)


--- trunk/Source/WebCore/Modules/indexeddb/leveldb/IDBBackingStoreLevelDB.h	2013-11-11 22:39:40 UTC (rev 159071)
+++ trunk/Source/WebCore/Modules/indexeddb/leveldb/IDBBackingStoreLevelDB.h	2013-11-11 22:41:39 UTC (rev 159072)
@@ -67,7 +67,7 @@
     static PassRefPtr<IDBBackingStoreLevelDB> openInMemory(const String& identifier, LevelDBFactory*);
     WeakPtr<IDBBackingStoreLevelDB> createWeakPtr() { return m_weakFactory.createWeakPtr(); }
 
-    virtual std::unique_ptr<IDBBackingStoreTransactionInterface> createBackingStoreTransaction();
+    virtual PassRefPtr<IDBBackingStoreTransactionInterface> createBackingStoreTransaction();
 
     virtual Vector<String> getDatabaseNames();
 

Modified: trunk/Source/WebCore/Modules/indexeddb/leveldb/IDBBackingStoreTransactionLevelDB.h (159071 => 159072)


--- trunk/Source/WebCore/Modules/indexeddb/leveldb/IDBBackingStoreTransactionLevelDB.h	2013-11-11 22:39:40 UTC (rev 159071)
+++ trunk/Source/WebCore/Modules/indexeddb/leveldb/IDBBackingStoreTransactionLevelDB.h	2013-11-11 22:41:39 UTC (rev 159072)
@@ -38,7 +38,10 @@
 
 class IDBBackingStoreTransactionLevelDB FINAL : public IDBBackingStoreTransactionInterface {
 public:
-    explicit IDBBackingStoreTransactionLevelDB(IDBBackingStoreInterface*);
+    static PassRefPtr<IDBBackingStoreTransactionInterface> create(IDBBackingStoreInterface* backingStore)
+    {
+        return adoptRef(new IDBBackingStoreTransactionLevelDB(backingStore));
+    }
 
     virtual void begin() OVERRIDE;
     virtual bool commit() OVERRIDE;
@@ -55,6 +58,8 @@
     }
 
 private:
+    IDBBackingStoreTransactionLevelDB(IDBBackingStoreInterface*);
+
     IDBBackingStoreInterface* m_backingStore;
     RefPtr<LevelDBTransaction> m_transaction;
 };
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to