WebKit Bugzilla
Attachment 348052 Details for
Bug 188937
: IDBCursor does not need to be an ActiveDOMObject
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-188937-20180824160709.patch (text/plain), 15.98 KB, created by
youenn fablet
on 2018-08-24 16:07:10 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
youenn fablet
Created:
2018-08-24 16:07:10 PDT
Size:
15.98 KB
patch
obsolete
>Subversion Revision: 235230 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index 0de3a382ebd95646aa5f3b738796e8394ee14371..5e546dcf995df7ba437c9ea46f714d4555619f8e 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,43 @@ >+2018-08-24 Youenn Fablet <youenn@apple.com> >+ >+ IDBCursor does not need to be an ActiveDOMObject >+ https://bugs.webkit.org/show_bug.cgi?id=188937 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Remove ActiveDOMObject from IDBCursor IDL. >+ Update constructors and call sites accordingly. >+ This allows removing m_outstandingRequestCount and related code in IDBRequest. >+ >+ Covered by existing tests. >+ >+ * Modules/indexeddb/IDBCursor.cpp: >+ (WebCore::IDBCursor::create): >+ (WebCore::IDBCursor::IDBCursor): >+ (WebCore::IDBCursor::update): >+ (WebCore::IDBCursor::uncheckedIterateCursor): >+ (WebCore::IDBCursor::deleteFunction): >+ (WebCore::IDBCursor::activeDOMObjectName const): Deleted. >+ (WebCore::IDBCursor::canSuspendForDocumentSuspension const): Deleted. >+ (WebCore::IDBCursor::hasPendingActivity const): Deleted. >+ (WebCore::IDBCursor::decrementOutstandingRequestCount): Deleted. >+ * Modules/indexeddb/IDBCursor.h: >+ * Modules/indexeddb/IDBCursor.idl: >+ * Modules/indexeddb/IDBCursorWithValue.cpp: >+ (WebCore::IDBCursorWithValue::create): >+ (WebCore::IDBCursorWithValue::IDBCursorWithValue): >+ * Modules/indexeddb/IDBCursorWithValue.h: >+ * Modules/indexeddb/IDBCursorWithValue.idl: >+ * Modules/indexeddb/IDBRequest.cpp: >+ (WebCore::IDBRequest::setSource): >+ (WebCore::IDBRequest::dispatchEvent): >+ (WebCore::IDBRequest::willIterateCursor): >+ (WebCore::IDBRequest::didOpenOrIterateCursor): >+ * Modules/indexeddb/IDBRequest.h: >+ * Modules/indexeddb/IDBTransaction.cpp: >+ (WebCore::IDBTransaction::requestOpenCursor): >+ * WebCore.xcodeproj/project.pbxproj: >+ > 2018-08-23 Youenn Fablet <youenn@apple.com> > > Update libwebrtc up to 984f1a80c0 >diff --git a/Source/WebCore/Modules/indexeddb/IDBCursor.cpp b/Source/WebCore/Modules/indexeddb/IDBCursor.cpp >index 05db83417e5c01c9567a52c02b29dc2760a370c0..dccf9c87d7a6b13b463285f74f4e09ab0c3856db 100644 >--- a/Source/WebCore/Modules/indexeddb/IDBCursor.cpp >+++ b/Source/WebCore/Modules/indexeddb/IDBCursor.cpp >@@ -45,34 +45,28 @@ > namespace WebCore { > using namespace JSC; > >-Ref<IDBCursor> IDBCursor::create(IDBTransaction& transaction, IDBObjectStore& objectStore, const IDBCursorInfo& info) >+Ref<IDBCursor> IDBCursor::create(IDBObjectStore& objectStore, const IDBCursorInfo& info) > { >- return adoptRef(*new IDBCursor(transaction, objectStore, info)); >+ return adoptRef(*new IDBCursor(objectStore, info)); > } > >-Ref<IDBCursor> IDBCursor::create(IDBTransaction& transaction, IDBIndex& index, const IDBCursorInfo& info) >+Ref<IDBCursor> IDBCursor::create(IDBIndex& index, const IDBCursorInfo& info) > { >- return adoptRef(*new IDBCursor(transaction, index, info)); >+ return adoptRef(*new IDBCursor(index, info)); > } > >-IDBCursor::IDBCursor(IDBTransaction& transaction, IDBObjectStore& objectStore, const IDBCursorInfo& info) >- : ActiveDOMObject(transaction.scriptExecutionContext()) >- , m_info(info) >+IDBCursor::IDBCursor(IDBObjectStore& objectStore, const IDBCursorInfo& info) >+ : m_info(info) > , m_source(&objectStore) > { > ASSERT(&effectiveObjectStore().transaction().database().originThread() == &Thread::current()); >- >- suspendIfNeeded(); > } > >-IDBCursor::IDBCursor(IDBTransaction& transaction, IDBIndex& index, const IDBCursorInfo& info) >- : ActiveDOMObject(transaction.scriptExecutionContext()) >- , m_info(info) >+IDBCursor::IDBCursor(IDBIndex& index, const IDBCursorInfo& info) >+ : m_info(info) > , m_source(&index) > { > ASSERT(&effectiveObjectStore().transaction().database().originThread() == &Thread::current()); >- >- suspendIfNeeded(); > } > > IDBCursor::~IDBCursor() >@@ -140,7 +134,6 @@ ExceptionOr<Ref<IDBRequest>> IDBCursor::update(ExecState& state, JSValue value) > > auto request = putResult.releaseReturnValue(); > request->setSource(*this); >- ++m_outstandingRequestCount; > > return WTFMove(request); > } >@@ -269,8 +262,6 @@ void IDBCursor::uncheckedIterateCursor(const IDBKeyData& key, unsigned count) > { > ASSERT(&effectiveObjectStore().transaction().database().originThread() == &Thread::current()); > >- ++m_outstandingRequestCount; >- > m_request->willIterateCursor(*this); > transaction().iterateCursor(*this, { key, { }, count }); > } >@@ -279,8 +270,6 @@ void IDBCursor::uncheckedIterateCursor(const IDBKeyData& key, const IDBKeyData& > { > ASSERT(&effectiveObjectStore().transaction().database().originThread() == &Thread::current()); > >- ++m_outstandingRequestCount; >- > m_request->willIterateCursor(*this); > transaction().iterateCursor(*this, { key, primaryKey, 0 }); > } >@@ -311,7 +300,6 @@ ExceptionOr<Ref<WebCore::IDBRequest>> IDBCursor::deleteFunction(ExecState& state > > auto request = result.releaseReturnValue(); > request->setSource(*this); >- ++m_outstandingRequestCount; > > return WTFMove(request); > } >@@ -357,27 +345,6 @@ void IDBCursor::setGetResult(IDBRequest& request, const IDBGetResult& getResult) > m_gotValue = true; > } > >-const char* IDBCursor::activeDOMObjectName() const >-{ >- return "IDBCursor"; >-} >- >-bool IDBCursor::canSuspendForDocumentSuspension() const >-{ >- return false; >-} >- >-bool IDBCursor::hasPendingActivity() const >-{ >- return m_outstandingRequestCount; >-} >- >-void IDBCursor::decrementOutstandingRequestCount() >-{ >- ASSERT(m_outstandingRequestCount); >- --m_outstandingRequestCount; >-} >- > } // namespace WebCore > > #endif // ENABLE(INDEXED_DATABASE) >diff --git a/Source/WebCore/Modules/indexeddb/IDBCursor.h b/Source/WebCore/Modules/indexeddb/IDBCursor.h >index 49030569911a77979eaddd934ae0480c42841886..b2e043deda1855746854aae9944daa3cd013b099 100644 >--- a/Source/WebCore/Modules/indexeddb/IDBCursor.h >+++ b/Source/WebCore/Modules/indexeddb/IDBCursor.h >@@ -27,7 +27,6 @@ > > #if ENABLE(INDEXED_DATABASE) > >-#include "ActiveDOMObject.h" > #include "ExceptionOr.h" > #include "IDBCursorDirection.h" > #include "IDBCursorInfo.h" >@@ -41,10 +40,10 @@ class IDBIndex; > class IDBObjectStore; > class IDBTransaction; > >-class IDBCursor : public ScriptWrappable, public RefCounted<IDBCursor>, public ActiveDOMObject { >+class IDBCursor : public ScriptWrappable, public RefCounted<IDBCursor> { > public: >- static Ref<IDBCursor> create(IDBTransaction&, IDBObjectStore&, const IDBCursorInfo&); >- static Ref<IDBCursor> create(IDBTransaction&, IDBIndex&, const IDBCursorInfo&); >+ static Ref<IDBCursor> create(IDBObjectStore&, const IDBCursorInfo&); >+ static Ref<IDBCursor> create(IDBIndex&, const IDBCursorInfo&); > > virtual ~IDBCursor(); > >@@ -74,18 +73,11 @@ public: > > virtual bool isKeyCursorWithValue() const { return false; } > >- void decrementOutstandingRequestCount(); >- >- bool hasPendingActivity() const final; >- > protected: >- IDBCursor(IDBTransaction&, IDBObjectStore&, const IDBCursorInfo&); >- IDBCursor(IDBTransaction&, IDBIndex&, const IDBCursorInfo&); >+ IDBCursor(IDBObjectStore&, const IDBCursorInfo&); >+ IDBCursor(IDBIndex&, const IDBCursorInfo&); > > private: >- const char* activeDOMObjectName() const final; >- bool canSuspendForDocumentSuspension() const final; >- > bool sourcesDeleted() const; > IDBObjectStore& effectiveObjectStore() const; > IDBTransaction& transaction() const; >@@ -93,9 +85,6 @@ private: > void uncheckedIterateCursor(const IDBKeyData&, unsigned count); > void uncheckedIterateCursor(const IDBKeyData&, const IDBKeyData&); > >- // Cursors are created with an outstanding iteration request. >- unsigned m_outstandingRequestCount { 1 }; >- > IDBCursorInfo m_info; > Source m_source; > IDBRequest* m_request { nullptr }; >diff --git a/Source/WebCore/Modules/indexeddb/IDBCursor.idl b/Source/WebCore/Modules/indexeddb/IDBCursor.idl >index 867fa46c48e72c596b4cbf0d6d81a10e77d4dfa0..bc2b8f2e39e81ddb182e82cc7d44415b2cc3face 100644 >--- a/Source/WebCore/Modules/indexeddb/IDBCursor.idl >+++ b/Source/WebCore/Modules/indexeddb/IDBCursor.idl >@@ -24,7 +24,6 @@ > */ > > [ >- ActiveDOMObject, > Conditional=INDEXED_DATABASE, > CustomToJSObject, > JSCustomMarkFunction, >diff --git a/Source/WebCore/Modules/indexeddb/IDBCursorWithValue.cpp b/Source/WebCore/Modules/indexeddb/IDBCursorWithValue.cpp >index 444f3159f5f194555257af9bf181e2776636f992..810c3d4b4baf4afbae8ae1a14cf9f45edb74cedd 100644 >--- a/Source/WebCore/Modules/indexeddb/IDBCursorWithValue.cpp >+++ b/Source/WebCore/Modules/indexeddb/IDBCursorWithValue.cpp >@@ -32,23 +32,23 @@ > > namespace WebCore { > >-Ref<IDBCursorWithValue> IDBCursorWithValue::create(IDBTransaction& transaction, IDBObjectStore& objectStore, const IDBCursorInfo& info) >+Ref<IDBCursorWithValue> IDBCursorWithValue::create(IDBObjectStore& objectStore, const IDBCursorInfo& info) > { >- return adoptRef(*new IDBCursorWithValue(transaction, objectStore, info)); >+ return adoptRef(*new IDBCursorWithValue(objectStore, info)); > } > >-Ref<IDBCursorWithValue> IDBCursorWithValue::create(IDBTransaction& transaction, IDBIndex& index, const IDBCursorInfo& info) >+Ref<IDBCursorWithValue> IDBCursorWithValue::create(IDBIndex& index, const IDBCursorInfo& info) > { >- return adoptRef(*new IDBCursorWithValue(transaction, index, info)); >+ return adoptRef(*new IDBCursorWithValue(index, info)); > } > >-IDBCursorWithValue::IDBCursorWithValue(IDBTransaction& transaction, IDBObjectStore& objectStore, const IDBCursorInfo& info) >- : IDBCursor(transaction, objectStore, info) >+IDBCursorWithValue::IDBCursorWithValue(IDBObjectStore& objectStore, const IDBCursorInfo& info) >+ : IDBCursor(objectStore, info) > { > } > >-IDBCursorWithValue::IDBCursorWithValue(IDBTransaction& transaction, IDBIndex& index, const IDBCursorInfo& info) >- : IDBCursor(transaction, index, info) >+IDBCursorWithValue::IDBCursorWithValue(IDBIndex& index, const IDBCursorInfo& info) >+ : IDBCursor(index, info) > { > } > >diff --git a/Source/WebCore/Modules/indexeddb/IDBCursorWithValue.h b/Source/WebCore/Modules/indexeddb/IDBCursorWithValue.h >index f78891b7d8462f2e8c6cbf11de6ab915f63508bf..e403f7703623fb0a27a54d3dcd48fa0eddc2e0a9 100644 >--- a/Source/WebCore/Modules/indexeddb/IDBCursorWithValue.h >+++ b/Source/WebCore/Modules/indexeddb/IDBCursorWithValue.h >@@ -34,16 +34,16 @@ namespace WebCore { > > class IDBCursorWithValue final : public IDBCursor { > public: >- static Ref<IDBCursorWithValue> create(IDBTransaction&, IDBObjectStore&, const IDBCursorInfo&); >- static Ref<IDBCursorWithValue> create(IDBTransaction&, IDBIndex&, const IDBCursorInfo&); >+ static Ref<IDBCursorWithValue> create(IDBObjectStore&, const IDBCursorInfo&); >+ static Ref<IDBCursorWithValue> create(IDBIndex&, const IDBCursorInfo&); > > virtual ~IDBCursorWithValue(); > > bool isKeyCursorWithValue() const override { return true; } > > private: >- IDBCursorWithValue(IDBTransaction&, IDBObjectStore&, const IDBCursorInfo&); >- IDBCursorWithValue(IDBTransaction&, IDBIndex&, const IDBCursorInfo&); >+ IDBCursorWithValue(IDBObjectStore&, const IDBCursorInfo&); >+ IDBCursorWithValue(IDBIndex&, const IDBCursorInfo&); > }; > > } // namespace WebCore >diff --git a/Source/WebCore/Modules/indexeddb/IDBCursorWithValue.idl b/Source/WebCore/Modules/indexeddb/IDBCursorWithValue.idl >index 422a1bcd4c37328b2ccd64aa6280d6c6ec8181b4..5b047d51b16b651a07a8662fbda77035c4fcadbf 100644 >--- a/Source/WebCore/Modules/indexeddb/IDBCursorWithValue.idl >+++ b/Source/WebCore/Modules/indexeddb/IDBCursorWithValue.idl >@@ -25,7 +25,6 @@ > > [ > Conditional=INDEXED_DATABASE, >- ActiveDOMObject, > SkipVTableValidation, > JSCustomMarkFunction, > ] interface IDBCursorWithValue : IDBCursor { >diff --git a/Source/WebCore/Modules/indexeddb/IDBRequest.cpp b/Source/WebCore/Modules/indexeddb/IDBRequest.cpp >index 2c27dfd5f8060455ef1771b1dc98d933a14b9a61..35932860a57ef8d62afd15237708daf50d530662 100644 >--- a/Source/WebCore/Modules/indexeddb/IDBRequest.cpp >+++ b/Source/WebCore/Modules/indexeddb/IDBRequest.cpp >@@ -174,13 +174,8 @@ ExceptionOr<DOMException*> IDBRequest::error() const > void IDBRequest::setSource(IDBCursor& cursor) > { > ASSERT(&originThread() == &Thread::current()); >- ASSERT(!m_cursorRequestNotifier); > > m_source = Source { &cursor }; >- m_cursorRequestNotifier = std::make_unique<WTF::ScopeExit<WTF::Function<void()>>>([this]() { >- ASSERT(WTF::holds_alternative<RefPtr<IDBCursor>>(m_source.value())); >- WTF::get<RefPtr<IDBCursor>>(m_source.value())->decrementOutstandingRequestCount(); >- }); > } > > void IDBRequest::setVersionChangeTransaction(IDBTransaction& transaction) >@@ -318,8 +313,6 @@ void IDBRequest::dispatchEvent(Event& event) > > m_hasPendingActivity = false; > >- m_cursorRequestNotifier = nullptr; >- > { > TransactionActivator activator(m_transaction.get()); > EventDispatcher::dispatchEvent(targets, event); >@@ -474,7 +467,6 @@ void IDBRequest::willIterateCursor(IDBCursor& cursor) > ASSERT(m_transaction); > ASSERT(!m_pendingCursor); > ASSERT(&cursor == resultCursor()); >- ASSERT(!m_cursorRequestNotifier); > > m_pendingCursor = &cursor; > m_hasPendingActivity = true; >@@ -482,10 +474,6 @@ void IDBRequest::willIterateCursor(IDBCursor& cursor) > m_readyState = ReadyState::Pending; > m_domError = nullptr; > m_idbError = IDBError { }; >- >- m_cursorRequestNotifier = std::make_unique<WTF::ScopeExit<WTF::Function<void()>>>([this]() { >- m_pendingCursor->decrementOutstandingRequestCount(); >- }); > } > > void IDBRequest::didOpenOrIterateCursor(const IDBResultData& resultData) >@@ -501,7 +489,6 @@ void IDBRequest::didOpenOrIterateCursor(const IDBResultData& resultData) > m_result = Result { m_pendingCursor }; > } > >- m_cursorRequestNotifier = nullptr; > m_pendingCursor = nullptr; > > completeRequestAndDispatchEvent(resultData); >diff --git a/Source/WebCore/Modules/indexeddb/IDBRequest.h b/Source/WebCore/Modules/indexeddb/IDBRequest.h >index e914344fe8dfdc4d06a0684112ea67f042f1c6c3..dd8b4d6f63b23569a1b10373496b35fb7df63d5d 100644 >--- a/Source/WebCore/Modules/indexeddb/IDBRequest.h >+++ b/Source/WebCore/Modules/indexeddb/IDBRequest.h >@@ -173,8 +173,6 @@ private: > > RefPtr<IDBCursor> m_pendingCursor; > >- std::unique_ptr<WTF::ScopeExit<WTF::Function<void()>>> m_cursorRequestNotifier; >- > Ref<IDBClient::IDBConnectionProxy> m_connectionProxy; > }; > >diff --git a/Source/WebCore/Modules/indexeddb/IDBTransaction.cpp b/Source/WebCore/Modules/indexeddb/IDBTransaction.cpp >index 4811c7cadfa60e5441cb512518aba71f5a9640e7..61215843a13265904b73d310bf4f3ffec9bba080 100644 >--- a/Source/WebCore/Modules/indexeddb/IDBTransaction.cpp >+++ b/Source/WebCore/Modules/indexeddb/IDBTransaction.cpp >@@ -800,9 +800,9 @@ Ref<IDBRequest> IDBTransaction::requestOpenCursor(ExecState& state, IDBObjectSto > ASSERT(&m_database->originThread() == &Thread::current()); > > if (info.cursorType() == IndexedDB::CursorType::KeyOnly) >- return doRequestOpenCursor(state, IDBCursor::create(*this, objectStore, info)); >+ return doRequestOpenCursor(state, IDBCursor::create(objectStore, info)); > >- return doRequestOpenCursor(state, IDBCursorWithValue::create(*this, objectStore, info)); >+ return doRequestOpenCursor(state, IDBCursorWithValue::create(objectStore, info)); > } > > Ref<IDBRequest> IDBTransaction::requestOpenCursor(ExecState& state, IDBIndex& index, const IDBCursorInfo& info) >@@ -811,9 +811,9 @@ Ref<IDBRequest> IDBTransaction::requestOpenCursor(ExecState& state, IDBIndex& in > ASSERT(&m_database->originThread() == &Thread::current()); > > if (info.cursorType() == IndexedDB::CursorType::KeyOnly) >- return doRequestOpenCursor(state, IDBCursor::create(*this, index, info)); >+ return doRequestOpenCursor(state, IDBCursor::create(index, info)); > >- return doRequestOpenCursor(state, IDBCursorWithValue::create(*this, index, info)); >+ return doRequestOpenCursor(state, IDBCursorWithValue::create(index, info)); > } > > Ref<IDBRequest> IDBTransaction::doRequestOpenCursor(ExecState& state, Ref<IDBCursor>&& cursor)
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 188937
: 348052