Title: [135856] trunk/Source
Revision
135856
Author
[email protected]
Date
2012-11-27 06:10:27 -0800 (Tue, 27 Nov 2012)

Log Message

IndexedDB: stub out IDBDatabaseBackendInterface::createTransaction
https://bugs.webkit.org/show_bug.cgi?id=102730

Reviewed by Darin Fisher.

Source/WebCore:

Stub out and support passing a 64-bit transaction id
so the frontend can refer to transactions by id rather than
a proxy object or a direct pointer reference. This will ultimately
loosen ownership and lifetime of transactions from the frontend
and backend.

No new tests, this is just part of a refactor.

* Modules/indexeddb/IDBDatabase.cpp:
* Modules/indexeddb/IDBDatabaseBackendImpl.cpp:
(WebCore):
(WebCore::IDBDatabaseBackendImpl::transaction):
(WebCore::IDBDatabaseBackendImpl::createTransaction):
* Modules/indexeddb/IDBDatabaseBackendImpl.h:
(IDBDatabaseBackendImpl):
* Modules/indexeddb/IDBDatabaseBackendInterface.h:
(IDBDatabaseBackendInterface):
* Modules/indexeddb/IDBTransactionBackendImpl.cpp:
(WebCore::IDBTransactionBackendImpl::create):
(WebCore::IDBTransactionBackendImpl::IDBTransactionBackendImpl):
* Modules/indexeddb/IDBTransactionBackendImpl.h:
(IDBTransactionBackendImpl):
(WebCore::IDBTransactionBackendImpl::id):

Source/WebKit/chromium:

Add support for new createTransaction() method in both sides
of the WebKit API.

* public/WebIDBDatabase.h:
(WebIDBDatabase):
(WebKit::WebIDBDatabase::createTransaction):
* src/IDBDatabaseBackendProxy.cpp:
(WebKit):
(WebKit::IDBDatabaseBackendProxy::createTransaction):
* src/IDBDatabaseBackendProxy.h:
(IDBDatabaseBackendProxy):
* src/WebIDBDatabaseImpl.cpp:
(WebKit::WebIDBDatabaseImpl::createTransaction):
(WebKit):
* src/WebIDBDatabaseImpl.h:
(WebIDBDatabaseImpl):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (135855 => 135856)


--- trunk/Source/WebCore/ChangeLog	2012-11-27 13:56:42 UTC (rev 135855)
+++ trunk/Source/WebCore/ChangeLog	2012-11-27 14:10:27 UTC (rev 135856)
@@ -1,3 +1,34 @@
+2012-11-27  Alec Flett  <[email protected]>
+
+        IndexedDB: stub out IDBDatabaseBackendInterface::createTransaction
+        https://bugs.webkit.org/show_bug.cgi?id=102730
+
+        Reviewed by Darin Fisher.
+
+        Stub out and support passing a 64-bit transaction id
+        so the frontend can refer to transactions by id rather than
+        a proxy object or a direct pointer reference. This will ultimately
+        loosen ownership and lifetime of transactions from the frontend
+        and backend.
+
+        No new tests, this is just part of a refactor.
+
+        * Modules/indexeddb/IDBDatabase.cpp:
+        * Modules/indexeddb/IDBDatabaseBackendImpl.cpp:
+        (WebCore):
+        (WebCore::IDBDatabaseBackendImpl::transaction):
+        (WebCore::IDBDatabaseBackendImpl::createTransaction):
+        * Modules/indexeddb/IDBDatabaseBackendImpl.h:
+        (IDBDatabaseBackendImpl):
+        * Modules/indexeddb/IDBDatabaseBackendInterface.h:
+        (IDBDatabaseBackendInterface):
+        * Modules/indexeddb/IDBTransactionBackendImpl.cpp:
+        (WebCore::IDBTransactionBackendImpl::create):
+        (WebCore::IDBTransactionBackendImpl::IDBTransactionBackendImpl):
+        * Modules/indexeddb/IDBTransactionBackendImpl.h:
+        (IDBTransactionBackendImpl):
+        (WebCore::IDBTransactionBackendImpl::id):
+
 2012-11-27  Andrei Bucur  <[email protected]>
 
         [CSS Regions] Crash when dispatching regionlayoutupdate

Modified: trunk/Source/WebCore/Modules/indexeddb/IDBDatabase.cpp (135855 => 135856)


--- trunk/Source/WebCore/Modules/indexeddb/IDBDatabase.cpp	2012-11-27 13:56:42 UTC (rev 135855)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBDatabase.cpp	2012-11-27 14:10:27 UTC (rev 135856)
@@ -36,7 +36,6 @@
 #include "IDBDatabaseError.h"
 #include "IDBDatabaseException.h"
 #include "IDBEventDispatcher.h"
-#include "IDBFactoryBackendInterface.h"
 #include "IDBIndex.h"
 #include "IDBKeyPath.h"
 #include "IDBObjectStore.h"

Modified: trunk/Source/WebCore/Modules/indexeddb/IDBDatabaseBackendImpl.cpp (135855 => 135856)


--- trunk/Source/WebCore/Modules/indexeddb/IDBDatabaseBackendImpl.cpp	2012-11-27 13:56:42 UTC (rev 135855)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBDatabaseBackendImpl.cpp	2012-11-27 14:10:27 UTC (rev 135856)
@@ -422,9 +422,15 @@
     }
 }
 
+// FIXME: Remove this as part of https://bugs.webkit.org/show_bug.cgi?id=102733.
 PassRefPtr<IDBTransactionBackendInterface> IDBDatabaseBackendImpl::transaction(const Vector<int64_t>& objectStoreIds, unsigned short mode)
 {
-    RefPtr<IDBTransactionBackendImpl> transaction = IDBTransactionBackendImpl::create(objectStoreIds, mode, this);
+    return createTransaction(0, objectStoreIds, mode);
+}
+
+PassRefPtr<IDBTransactionBackendInterface> IDBDatabaseBackendImpl::createTransaction(int64_t transactionId, const Vector<int64_t>& objectStoreIds, unsigned short mode)
+{
+    RefPtr<IDBTransactionBackendImpl> transaction = IDBTransactionBackendImpl::create(transactionId, objectStoreIds, mode, this);
     m_transactions.add(transaction.get());
     return transaction.release();
 }

Modified: trunk/Source/WebCore/Modules/indexeddb/IDBDatabaseBackendImpl.h (135855 => 135856)


--- trunk/Source/WebCore/Modules/indexeddb/IDBDatabaseBackendImpl.h	2012-11-27 13:56:42 UTC (rev 135855)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBDatabaseBackendImpl.h	2012-11-27 14:10:27 UTC (rev 135856)
@@ -64,7 +64,9 @@
     virtual PassRefPtr<IDBObjectStoreBackendInterface> createObjectStore(int64_t id, const String& name, const IDBKeyPath&, bool autoIncrement, IDBTransactionBackendInterface*, ExceptionCode&);
     virtual void deleteObjectStore(int64_t, IDBTransactionBackendInterface*, ExceptionCode&);
     virtual void setVersion(const String& version, PassRefPtr<IDBCallbacks>, PassRefPtr<IDBDatabaseCallbacks>, ExceptionCode&);
+    // FIXME: Remove this as part of https://bugs.webkit.org/show_bug.cgi?id=102733.
     virtual PassRefPtr<IDBTransactionBackendInterface> transaction(const Vector<int64_t>&, unsigned short);
+    virtual PassRefPtr<IDBTransactionBackendInterface> createTransaction(int64_t transactionId, const Vector<int64_t>& objectStoreIds, unsigned short mode);
     virtual void close(PassRefPtr<IDBDatabaseCallbacks>);
 
     PassRefPtr<IDBObjectStoreBackendImpl> objectStore(int64_t id);

Modified: trunk/Source/WebCore/Modules/indexeddb/IDBDatabaseBackendInterface.h (135855 => 135856)


--- trunk/Source/WebCore/Modules/indexeddb/IDBDatabaseBackendInterface.h	2012-11-27 13:56:42 UTC (rev 135855)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBDatabaseBackendInterface.h	2012-11-27 14:10:27 UTC (rev 135856)
@@ -56,7 +56,9 @@
     virtual PassRefPtr<IDBObjectStoreBackendInterface> createObjectStore(int64_t, const String& name, const IDBKeyPath&, bool autoIncrement, IDBTransactionBackendInterface*, ExceptionCode&) = 0;
     virtual void deleteObjectStore(int64_t, IDBTransactionBackendInterface*, ExceptionCode&) = 0;
     virtual void setVersion(const String& version, PassRefPtr<IDBCallbacks>, PassRefPtr<IDBDatabaseCallbacks>, ExceptionCode&) = 0;
+    // FIXME: Remove this as part of https://bugs.webkit.org/show_bug.cgi?id=102733.
     virtual PassRefPtr<IDBTransactionBackendInterface> transaction(const Vector<int64_t>& objectStoreIds, unsigned short mode) = 0;
+    virtual PassRefPtr<IDBTransactionBackendInterface> createTransaction(int64_t transactionId, const Vector<int64_t>& objectStoreIds, unsigned short mode) = 0;
     virtual void close(PassRefPtr<IDBDatabaseCallbacks>) = 0;
 };
 

Modified: trunk/Source/WebCore/Modules/indexeddb/IDBTransactionBackendImpl.cpp (135855 => 135856)


--- trunk/Source/WebCore/Modules/indexeddb/IDBTransactionBackendImpl.cpp	2012-11-27 13:56:42 UTC (rev 135855)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBTransactionBackendImpl.cpp	2012-11-27 14:10:27 UTC (rev 135856)
@@ -39,13 +39,14 @@
 
 namespace WebCore {
 
-PassRefPtr<IDBTransactionBackendImpl> IDBTransactionBackendImpl::create(const Vector<int64_t>& objectStoreIds, unsigned short mode, IDBDatabaseBackendImpl* database)
+PassRefPtr<IDBTransactionBackendImpl> IDBTransactionBackendImpl::create(int64_t id, const Vector<int64_t>& objectStoreIds, unsigned short mode, IDBDatabaseBackendImpl* database)
 {
-    return adoptRef(new IDBTransactionBackendImpl(objectStoreIds, mode, database));
+    return adoptRef(new IDBTransactionBackendImpl(id, objectStoreIds, mode, database));
 }
 
-IDBTransactionBackendImpl::IDBTransactionBackendImpl(const Vector<int64_t>& objectStoreIds, unsigned short mode, IDBDatabaseBackendImpl* database)
-    : m_objectStoreIds(objectStoreIds)
+IDBTransactionBackendImpl::IDBTransactionBackendImpl(int64_t id, const Vector<int64_t>& objectStoreIds, unsigned short mode, IDBDatabaseBackendImpl* database)
+    : m_id(id)
+    , m_objectStoreIds(objectStoreIds)
     , m_mode(mode)
     , m_state(Unused)
     , m_database(database)

Modified: trunk/Source/WebCore/Modules/indexeddb/IDBTransactionBackendImpl.h (135855 => 135856)


--- trunk/Source/WebCore/Modules/indexeddb/IDBTransactionBackendImpl.h	2012-11-27 13:56:42 UTC (rev 135855)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBTransactionBackendImpl.h	2012-11-27 14:10:27 UTC (rev 135856)
@@ -44,7 +44,7 @@
 
 class IDBTransactionBackendImpl : public IDBTransactionBackendInterface {
 public:
-    static PassRefPtr<IDBTransactionBackendImpl> create(const Vector<int64_t>&, unsigned short mode, IDBDatabaseBackendImpl*);
+    static PassRefPtr<IDBTransactionBackendImpl> create(int64_t transactionId, const Vector<int64_t>&, unsigned short mode, IDBDatabaseBackendImpl*);
     static IDBTransactionBackendImpl* from(IDBTransactionBackendInterface* interface)
     {
         return static_cast<IDBTransactionBackendImpl*>(interface);
@@ -68,9 +68,10 @@
     void addPreemptiveEvent() { m_pendingPreemptiveEvents++; }
     void didCompletePreemptiveEvent() { m_pendingPreemptiveEvents--; ASSERT(m_pendingPreemptiveEvents >= 0); }
     IDBBackingStore::Transaction* backingStoreTransaction() { return &m_transaction; }
+    int64_t id() const { return m_id; }
 
 private:
-    IDBTransactionBackendImpl(const Vector<int64_t>& objectStoreIds, unsigned short mode, IDBDatabaseBackendImpl*);
+    IDBTransactionBackendImpl(int64_t id, const Vector<int64_t>& objectStoreIds, unsigned short mode, IDBDatabaseBackendImpl*);
 
     enum State {
         Unused, // Created, but no tasks yet.
@@ -89,6 +90,7 @@
     void taskEventTimerFired(Timer<IDBTransactionBackendImpl>*);
     void closeOpenCursors();
 
+    const int64_t m_id;
     const Vector<int64_t> m_objectStoreIds;
     const unsigned short m_mode;
 

Modified: trunk/Source/WebKit/chromium/ChangeLog (135855 => 135856)


--- trunk/Source/WebKit/chromium/ChangeLog	2012-11-27 13:56:42 UTC (rev 135855)
+++ trunk/Source/WebKit/chromium/ChangeLog	2012-11-27 14:10:27 UTC (rev 135856)
@@ -1,3 +1,27 @@
+2012-11-27  Alec Flett  <[email protected]>
+
+        IndexedDB: stub out IDBDatabaseBackendInterface::createTransaction
+        https://bugs.webkit.org/show_bug.cgi?id=102730
+
+        Reviewed by Darin Fisher.
+
+        Add support for new createTransaction() method in both sides
+        of the WebKit API.
+
+        * public/WebIDBDatabase.h:
+        (WebIDBDatabase):
+        (WebKit::WebIDBDatabase::createTransaction):
+        * src/IDBDatabaseBackendProxy.cpp:
+        (WebKit):
+        (WebKit::IDBDatabaseBackendProxy::createTransaction):
+        * src/IDBDatabaseBackendProxy.h:
+        (IDBDatabaseBackendProxy):
+        * src/WebIDBDatabaseImpl.cpp:
+        (WebKit::WebIDBDatabaseImpl::createTransaction):
+        (WebKit):
+        * src/WebIDBDatabaseImpl.h:
+        (WebIDBDatabaseImpl):
+
 2012-11-27  Sheriff Bot  <[email protected]>
 
         Unreviewed, rolling out r135786.

Modified: trunk/Source/WebKit/chromium/public/WebIDBDatabase.h (135855 => 135856)


--- trunk/Source/WebKit/chromium/public/WebIDBDatabase.h	2012-11-27 13:56:42 UTC (rev 135855)
+++ trunk/Source/WebKit/chromium/public/WebIDBDatabase.h	2012-11-27 14:10:27 UTC (rev 135856)
@@ -57,12 +57,15 @@
     }
     virtual void deleteObjectStore(long long objectStoreId, const WebIDBTransaction& transaction, WebExceptionCode& ec) { WEBKIT_ASSERT_NOT_REACHED(); }
     virtual void setVersion(const WebString& version, WebIDBCallbacks* callbacks, WebExceptionCode&) { WEBKIT_ASSERT_NOT_REACHED(); }
+    // FIXME: Remove this as part of https://bugs.webkit.org/show_bug.cgi?id=102733.
     // Transfers ownership of the WebIDBTransaction to the caller.
     virtual WebIDBTransaction* transaction(const WebVector<long long>&, unsigned short mode)
     {
         WEBKIT_ASSERT_NOT_REACHED();
         return 0;
     }
+    // Transfers ownership of the WebIDBTransaction to the caller.
+    virtual WebIDBTransaction* createTransaction(long long id, const WebVector<long long>&, unsigned short mode) { WEBKIT_ASSERT_NOT_REACHED(); return 0; }
     virtual void close() { WEBKIT_ASSERT_NOT_REACHED(); }
     virtual void forceClose() { WEBKIT_ASSERT_NOT_REACHED(); }
 

Modified: trunk/Source/WebKit/chromium/src/IDBDatabaseBackendProxy.cpp (135855 => 135856)


--- trunk/Source/WebKit/chromium/src/IDBDatabaseBackendProxy.cpp	2012-11-27 13:56:42 UTC (rev 135855)
+++ trunk/Source/WebKit/chromium/src/IDBDatabaseBackendProxy.cpp	2012-11-27 14:10:27 UTC (rev 135856)
@@ -91,6 +91,7 @@
     m_webIDBDatabase->setVersion(version, new WebIDBCallbacksImpl(callbacks), ec);
 }
 
+// FIXME: Remove this as part of https://bugs.webkit.org/show_bug.cgi?id=102733.
 PassRefPtr<IDBTransactionBackendInterface> IDBDatabaseBackendProxy::transaction(const Vector<int64_t>& objectStoreIds, unsigned short mode)
 {
     OwnPtr<WebIDBTransaction> transaction = adoptPtr(m_webIDBDatabase->transaction(objectStoreIds, mode));
@@ -100,6 +101,15 @@
     return IDBTransactionBackendProxy::create(transaction.release());
 }
 
+PassRefPtr<IDBTransactionBackendInterface> IDBDatabaseBackendProxy::createTransaction(int64_t id, const Vector<int64_t>& objectStoreIds, unsigned short mode)
+{
+    OwnPtr<WebIDBTransaction> transaction = adoptPtr(m_webIDBDatabase->createTransaction(id, objectStoreIds, mode));
+    if (!transaction)
+        return 0;
+
+    return IDBTransactionBackendProxy::create(transaction.release());
+}
+
 void IDBDatabaseBackendProxy::close(PassRefPtr<IDBDatabaseCallbacks>)
 {
     m_webIDBDatabase->close();

Modified: trunk/Source/WebKit/chromium/src/IDBDatabaseBackendProxy.h (135855 => 135856)


--- trunk/Source/WebKit/chromium/src/IDBDatabaseBackendProxy.h	2012-11-27 13:56:42 UTC (rev 135855)
+++ trunk/Source/WebKit/chromium/src/IDBDatabaseBackendProxy.h	2012-11-27 14:10:27 UTC (rev 135856)
@@ -47,7 +47,9 @@
     virtual PassRefPtr<WebCore::IDBObjectStoreBackendInterface> createObjectStore(int64_t, const String& name, const WebCore::IDBKeyPath&, bool autoIncrement, WebCore::IDBTransactionBackendInterface*, WebCore::ExceptionCode&);
     virtual void deleteObjectStore(int64_t, WebCore::IDBTransactionBackendInterface*, WebCore::ExceptionCode&);
     virtual void setVersion(const String& version, PassRefPtr<WebCore::IDBCallbacks>, PassRefPtr<WebCore::IDBDatabaseCallbacks>, WebCore::ExceptionCode&);
+    // FIXME: Remove this as part of https://bugs.webkit.org/show_bug.cgi?id=102733.
     virtual PassRefPtr<WebCore::IDBTransactionBackendInterface> transaction(const Vector<int64_t>&, unsigned short mode);
+    virtual PassRefPtr<WebCore::IDBTransactionBackendInterface> createTransaction(int64_t, const Vector<int64_t>&, unsigned short mode);
     virtual void close(PassRefPtr<WebCore::IDBDatabaseCallbacks>);
 
 private:

Modified: trunk/Source/WebKit/chromium/src/WebIDBDatabaseImpl.cpp (135855 => 135856)


--- trunk/Source/WebKit/chromium/src/WebIDBDatabaseImpl.cpp	2012-11-27 13:56:42 UTC (rev 135855)
+++ trunk/Source/WebKit/chromium/src/WebIDBDatabaseImpl.cpp	2012-11-27 14:10:27 UTC (rev 135856)
@@ -80,6 +80,18 @@
     m_databaseBackend->setVersion(version, IDBCallbacksProxy::create(adoptPtr(callbacks)), m_databaseCallbacks, ec);
 }
 
+WebIDBTransaction* WebIDBDatabaseImpl::createTransaction(long long id, const WebVector<long long>& objectStoreIds, unsigned short mode)
+{
+    Vector<int64_t> objectStoreIdList(objectStoreIds.size());
+    for (size_t i = 0; i < objectStoreIds.size(); ++i)
+        objectStoreIdList[i] = objectStoreIds[i];
+    RefPtr<IDBTransactionBackendInterface> transaction = m_databaseBackend->createTransaction(id, objectStoreIdList, mode);
+    if (!transaction)
+        return 0;
+    return new WebIDBTransactionImpl(transaction);
+}
+
+// FIXME: Remove this as part of https://bugs.webkit.org/show_bug.cgi?id=102733.
 WebIDBTransaction* WebIDBDatabaseImpl::transaction(const WebVector<long long>& objectStoreIds, unsigned short mode)
 {
     Vector<int64_t> objectStoreIdList(objectStoreIds.size());

Modified: trunk/Source/WebKit/chromium/src/WebIDBDatabaseImpl.h (135855 => 135856)


--- trunk/Source/WebKit/chromium/src/WebIDBDatabaseImpl.h	2012-11-27 13:56:42 UTC (rev 135855)
+++ trunk/Source/WebKit/chromium/src/WebIDBDatabaseImpl.h	2012-11-27 14:10:27 UTC (rev 135856)
@@ -55,7 +55,9 @@
     virtual WebIDBObjectStore* createObjectStore(long long, const WebString& name, const WebIDBKeyPath&, bool autoIncrement, const WebIDBTransaction&, WebExceptionCode&);
     virtual void deleteObjectStore(long long objectStoreId, const WebIDBTransaction&, WebExceptionCode&);
     virtual void setVersion(const WebString& version, WebIDBCallbacks*, WebExceptionCode&);
+    // FIXME: Remove this as part of https://bugs.webkit.org/show_bug.cgi?id=102733.
     virtual WebIDBTransaction* transaction(const WebVector<long long>& names, unsigned short mode);
+    virtual WebIDBTransaction* createTransaction(long long id, const WebVector<long long>&, unsigned short mode);
     virtual void forceClose();
     virtual void close();
 

Modified: trunk/Source/WebKit/chromium/tests/IDBDatabaseBackendTest.cpp (135855 => 135856)


--- trunk/Source/WebKit/chromium/tests/IDBDatabaseBackendTest.cpp	2012-11-27 13:56:42 UTC (rev 135855)
+++ trunk/Source/WebKit/chromium/tests/IDBDatabaseBackendTest.cpp	2012-11-27 14:10:27 UTC (rev 135856)
@@ -154,8 +154,9 @@
     virtual void deleteObjectStore(const String& name, IDBTransactionBackendInterface*, ExceptionCode&) { }
     virtual void deleteObjectStore(int64_t, IDBTransactionBackendInterface*, ExceptionCode&) { }
     virtual void setVersion(const String& version, PassRefPtr<IDBCallbacks>, PassRefPtr<IDBDatabaseCallbacks>, ExceptionCode&) { }
-    virtual PassRefPtr<IDBTransactionBackendInterface> transaction(DOMStringList* storeNames, unsigned short mode, ExceptionCode&) { return 0; }
+    // FIXME: Remove this as part of https://bugs.webkit.org/show_bug.cgi?id=102733.
     virtual PassRefPtr<IDBTransactionBackendInterface> transaction(const Vector<int64_t>&, unsigned short mode) { return 0; }
+    virtual PassRefPtr<IDBTransactionBackendInterface> createTransaction(int64_t, const Vector<int64_t>&, unsigned short mode) { return 0; }
 
     virtual void close(PassRefPtr<IDBDatabaseCallbacks>)
     {
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to