diff --git a/dom/indexedDB/IDBFactory.cpp b/dom/indexedDB/IDBFactory.cpp index 1f890665adb..d9a04375fa8 100644 --- a/dom/indexedDB/IDBFactory.cpp +++ b/dom/indexedDB/IDBFactory.cpp @@ -157,7 +157,7 @@ IDBFactory::Create(nsPIDOMWindow* aWindow, TabChild* tabChild = TabChild::GetFrom(aWindow); IDB_ENSURE_TRUE(tabChild, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR); - IndexedDBChild* actor = new IndexedDBChild(tabChild, origin); + IndexedDBChild* actor = new IndexedDBChild(origin); bool allowed; tabChild->SendPIndexedDBConstructor(actor, group, origin, &allowed); @@ -216,7 +216,7 @@ IDBFactory::Create(JSContext* aCx, ContentChild* contentChild = ContentChild::GetSingleton(); IDB_ENSURE_TRUE(contentChild, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR); - IndexedDBChild* actor = new IndexedDBChild(contentChild, origin); + IndexedDBChild* actor = new IndexedDBChild(origin); contentChild->SendPIndexedDBConstructor(actor); diff --git a/dom/indexedDB/IDBObjectStore.cpp b/dom/indexedDB/IDBObjectStore.cpp index 8b508f196ed..748a56a7d21 100644 --- a/dom/indexedDB/IDBObjectStore.cpp +++ b/dom/indexedDB/IDBObjectStore.cpp @@ -17,7 +17,6 @@ #include "mozilla/dom/nsIContentParent.h" #include "mozilla/dom/FileHandleBinding.h" #include "mozilla/dom/StructuredCloneTags.h" -#include "mozilla/dom/TabChild.h" #include "mozilla/dom/ipc/Blob.h" #include "mozilla/dom/quota/FileStreams.h" #include "mozilla/Endian.h" @@ -112,8 +111,7 @@ public: virtual nsresult Dispatch(nsIEventTarget* aDatabaseThread) MOZ_OVERRIDE; virtual nsresult - PackArgumentsForParentProcess(ObjectStoreRequestParams& aParams, - nsIContentChild* aBlobCreator) = 0; + PackArgumentsForParentProcess(ObjectStoreRequestParams& aParams) = 0; virtual nsresult UnpackResponseFromParentProcess(const ResponseValue& aResponseValue) = 0; @@ -186,8 +184,7 @@ public: virtual void ReleaseMainThreadObjects() MOZ_OVERRIDE; virtual nsresult - PackArgumentsForParentProcess(ObjectStoreRequestParams& aParams, - nsIContentChild* aBlobCreator) MOZ_OVERRIDE; + PackArgumentsForParentProcess(ObjectStoreRequestParams& aParams) MOZ_OVERRIDE; virtual ChildProcessSendResult SendResponseToChildProcess(nsresult aResultCode) MOZ_OVERRIDE; @@ -231,8 +228,7 @@ public: virtual void ReleaseMainThreadObjects() MOZ_OVERRIDE; virtual nsresult - PackArgumentsForParentProcess(ObjectStoreRequestParams& aParams, - nsIContentChild* aBlobCreator) MOZ_OVERRIDE; + PackArgumentsForParentProcess(ObjectStoreRequestParams& aParams) MOZ_OVERRIDE; virtual ChildProcessSendResult SendResponseToChildProcess(nsresult aResultCode) MOZ_OVERRIDE; @@ -267,8 +263,7 @@ public: JS::MutableHandle aVal) MOZ_OVERRIDE; virtual nsresult - PackArgumentsForParentProcess(ObjectStoreRequestParams& aParams, - nsIContentChild* aBlobCreator) MOZ_OVERRIDE; + PackArgumentsForParentProcess(ObjectStoreRequestParams& aParams) MOZ_OVERRIDE; virtual ChildProcessSendResult SendResponseToChildProcess(nsresult aResultCode) MOZ_OVERRIDE; @@ -291,8 +286,7 @@ public: MOZ_OVERRIDE; virtual nsresult - PackArgumentsForParentProcess(ObjectStoreRequestParams& aParams, - nsIContentChild* aBlobCreator) MOZ_OVERRIDE; + PackArgumentsForParentProcess(ObjectStoreRequestParams& aParams) MOZ_OVERRIDE; virtual ChildProcessSendResult SendResponseToChildProcess(nsresult aResultCode) MOZ_OVERRIDE; @@ -328,8 +322,7 @@ public: virtual void ReleaseMainThreadObjects() MOZ_OVERRIDE; virtual nsresult - PackArgumentsForParentProcess(ObjectStoreRequestParams& aParams, - nsIContentChild* aBlobCreator) MOZ_OVERRIDE; + PackArgumentsForParentProcess(ObjectStoreRequestParams& aParams) MOZ_OVERRIDE; virtual ChildProcessSendResult SendResponseToChildProcess(nsresult aResultCode) MOZ_OVERRIDE; @@ -380,8 +373,7 @@ public: ReleaseMainThreadObjects() MOZ_OVERRIDE; virtual nsresult - PackArgumentsForParentProcess(ObjectStoreRequestParams& aParams, - nsIContentChild* aBlobCreator) MOZ_OVERRIDE; + PackArgumentsForParentProcess(ObjectStoreRequestParams& aParams) MOZ_OVERRIDE; virtual ChildProcessSendResult SendResponseToChildProcess(nsresult aResultCode) MOZ_OVERRIDE; @@ -488,8 +480,7 @@ public: virtual void ReleaseMainThreadObjects() MOZ_OVERRIDE; virtual nsresult - PackArgumentsForParentProcess(ObjectStoreRequestParams& aParams, - nsIContentChild* aBlobCreator) MOZ_OVERRIDE; + PackArgumentsForParentProcess(ObjectStoreRequestParams& aParams) MOZ_OVERRIDE; virtual ChildProcessSendResult SendResponseToChildProcess(nsresult aResultCode) MOZ_OVERRIDE; @@ -531,8 +522,7 @@ public: ReleaseMainThreadObjects() MOZ_OVERRIDE; virtual nsresult - PackArgumentsForParentProcess(ObjectStoreRequestParams& aParams, - nsIContentChild* aBlobCreator) MOZ_OVERRIDE; + PackArgumentsForParentProcess(ObjectStoreRequestParams& aParams) MOZ_OVERRIDE; virtual ChildProcessSendResult SendResponseToChildProcess(nsresult aResultCode) MOZ_OVERRIDE; @@ -570,8 +560,7 @@ public: virtual void ReleaseMainThreadObjects() MOZ_OVERRIDE; virtual nsresult - PackArgumentsForParentProcess(ObjectStoreRequestParams& aParams, - nsIContentChild* aBlobCreator) MOZ_OVERRIDE; + PackArgumentsForParentProcess(ObjectStoreRequestParams& aParams) MOZ_OVERRIDE; virtual ChildProcessSendResult SendResponseToChildProcess(nsresult aResultCode) MOZ_OVERRIDE; @@ -3051,22 +3040,7 @@ ObjectStoreHelper::Dispatch(nsIEventTarget* aDatabaseThread) NS_ASSERTION(objectStoreActor, "Must have an actor here!"); ObjectStoreRequestParams params; - - // Our "parent" process may be either the root process or another content - // process if this indexedDB is managed by a PBrowser that is managed by a - // PContentBridge. We need to find which one it is so that we can create - // PBlobs that are managed by the right nsIContentChild. - IndexedDBChild* rootActor = - static_cast(objectStoreActor->Manager()-> - Manager()->Manager()); - nsIContentChild* blobCreator; - if (rootActor->GetManagerContent()) { - blobCreator = rootActor->GetManagerContent(); - } else { - blobCreator = rootActor->GetManagerTab()->Manager(); - } - - nsresult rv = PackArgumentsForParentProcess(params, blobCreator); + nsresult rv = PackArgumentsForParentProcess(params); IDB_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR); NoDispatchEventTarget target; @@ -3346,12 +3320,10 @@ AddHelper::ReleaseMainThreadObjects() } nsresult -AddHelper::PackArgumentsForParentProcess(ObjectStoreRequestParams& aParams, - nsIContentChild* aBlobCreator) +AddHelper::PackArgumentsForParentProcess(ObjectStoreRequestParams& aParams) { NS_ASSERTION(NS_IsMainThread(), "Wrong thread!"); NS_ASSERTION(!IndexedDatabaseManager::IsMainProcess(), "Wrong process!"); - NS_ASSERTION(aBlobCreator, "Must have a valid creator!"); PROFILER_MAIN_THREAD_LABEL("AddHelper", "PackArgumentsForParentProcess", js::ProfileEntry::Category::STORAGE); @@ -3369,7 +3341,8 @@ AddHelper::PackArgumentsForParentProcess(ObjectStoreRequestParams& aParams, InfallibleTArray& blobsChild = commonParams.blobsChild(); blobsChild.SetCapacity(fileCount); - NS_ASSERTION(aBlobCreator, "This should never be null!"); + ContentChild* contentChild = ContentChild::GetSingleton(); + NS_ASSERTION(contentChild, "This should never be null!"); for (uint32_t index = 0; index < fileCount; index++) { const StructuredCloneFile& file = files[index]; @@ -3378,7 +3351,7 @@ AddHelper::PackArgumentsForParentProcess(ObjectStoreRequestParams& aParams, NS_ASSERTION(!file.mFileInfo, "This is not yet supported!"); BlobChild* actor = - aBlobCreator->GetOrCreateActorForBlob(file.mFile); + contentChild->GetOrCreateActorForBlob(file.mFile); if (!actor) { IDB_REPORT_INTERNAL_ERR(); return NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR; @@ -3514,13 +3487,11 @@ GetHelper::ReleaseMainThreadObjects() } nsresult -GetHelper::PackArgumentsForParentProcess(ObjectStoreRequestParams& aParams, - nsIContentChild* aBlobCreator) +GetHelper::PackArgumentsForParentProcess(ObjectStoreRequestParams& aParams) { NS_ASSERTION(NS_IsMainThread(), "Wrong thread!"); NS_ASSERTION(!IndexedDatabaseManager::IsMainProcess(), "Wrong process!"); NS_ASSERTION(mKeyRange, "This should never be null!"); - NS_ASSERTION(aBlobCreator, "Must have a valid creator!"); PROFILER_MAIN_THREAD_LABEL("GetHelper", "PackArgumentsForParentProcess [IDBObjectStore.cpp]", js::ProfileEntry::Category::STORAGE); @@ -3654,13 +3625,11 @@ DeleteHelper::GetSuccessResult(JSContext* aCx, } nsresult -DeleteHelper::PackArgumentsForParentProcess(ObjectStoreRequestParams& aParams, - nsIContentChild* aBlobCreator) +DeleteHelper::PackArgumentsForParentProcess(ObjectStoreRequestParams& aParams) { NS_ASSERTION(NS_IsMainThread(), "Wrong thread!"); NS_ASSERTION(!IndexedDatabaseManager::IsMainProcess(), "Wrong process!"); NS_ASSERTION(mKeyRange, "This should never be null!"); - NS_ASSERTION(aBlobCreator, "Must have a valid creator!"); PROFILER_MAIN_THREAD_LABEL("DeleteHelper", "PackArgumentsForParentProcess", js::ProfileEntry::Category::STORAGE); @@ -3739,12 +3708,10 @@ ClearHelper::DoDatabaseWork(mozIStorageConnection* aConnection) } nsresult -ClearHelper::PackArgumentsForParentProcess(ObjectStoreRequestParams& aParams, - nsIContentChild* aBlobCreator) +ClearHelper::PackArgumentsForParentProcess(ObjectStoreRequestParams& aParams) { NS_ASSERTION(NS_IsMainThread(), "Wrong thread!"); NS_ASSERTION(!IndexedDatabaseManager::IsMainProcess(), "Wrong process!"); - NS_ASSERTION(aBlobCreator, "Must have a valid creator!"); PROFILER_MAIN_THREAD_LABEL("ClearHelper", "PackArgumentsForParentProcess", js::ProfileEntry::Category::STORAGE); @@ -3975,12 +3942,11 @@ OpenCursorHelper::ReleaseMainThreadObjects() } nsresult -OpenCursorHelper::PackArgumentsForParentProcess(ObjectStoreRequestParams& aParams, - nsIContentChild* aBlobCreator) +OpenCursorHelper::PackArgumentsForParentProcess( + ObjectStoreRequestParams& aParams) { NS_ASSERTION(NS_IsMainThread(), "Wrong thread!"); NS_ASSERTION(!IndexedDatabaseManager::IsMainProcess(), "Wrong process!"); - NS_ASSERTION(aBlobCreator, "Must have a valid creator!"); PROFILER_MAIN_THREAD_LABEL("OpenCursorHelper", "PackArgumentsForParentProcess [IDBObjectStore.cpp]", js::ProfileEntry::Category::STORAGE); @@ -4299,12 +4265,11 @@ OpenKeyCursorHelper::ReleaseMainThreadObjects() } nsresult -OpenKeyCursorHelper::PackArgumentsForParentProcess(ObjectStoreRequestParams& aParams, - nsIContentChild* aBlobCreator) +OpenKeyCursorHelper::PackArgumentsForParentProcess( + ObjectStoreRequestParams& aParams) { MOZ_ASSERT(NS_IsMainThread()); MOZ_ASSERT(!IndexedDatabaseManager::IsMainProcess()); - NS_ASSERTION(aBlobCreator, "Must have a valid creator!"); PROFILER_MAIN_THREAD_LABEL("OpenKeyCursorHelper", "PackArgumentsForParentProcess [IDBObjectStore.cpp]", js::ProfileEntry::Category::STORAGE); @@ -4740,12 +4705,10 @@ GetAllHelper::ReleaseMainThreadObjects() } nsresult -GetAllHelper::PackArgumentsForParentProcess(ObjectStoreRequestParams& aParams, - nsIContentChild* aBlobCreator) +GetAllHelper::PackArgumentsForParentProcess(ObjectStoreRequestParams& aParams) { NS_ASSERTION(NS_IsMainThread(), "Wrong thread!"); NS_ASSERTION(!IndexedDatabaseManager::IsMainProcess(), "Wrong process!"); - NS_ASSERTION(aBlobCreator, "Must have a valid creator!"); PROFILER_MAIN_THREAD_LABEL("GetAllHelper", "PackArgumentsForParentProcess [IDBObjectStore.cpp]", js::ProfileEntry::Category::STORAGE); @@ -4988,12 +4951,11 @@ GetAllKeysHelper::ReleaseMainThreadObjects() } nsresult -GetAllKeysHelper::PackArgumentsForParentProcess(ObjectStoreRequestParams& aParams, - nsIContentChild* aBlobCreator) +GetAllKeysHelper::PackArgumentsForParentProcess( + ObjectStoreRequestParams& aParams) { MOZ_ASSERT(NS_IsMainThread()); MOZ_ASSERT(!IndexedDatabaseManager::IsMainProcess()); - NS_ASSERTION(aBlobCreator, "Must have a valid creator!"); PROFILER_MAIN_THREAD_LABEL("GetAllKeysHelper", "PackArgumentsForParentProcess [IDBObjectStore.cpp]", js::ProfileEntry::Category::STORAGE); @@ -5141,12 +5103,10 @@ CountHelper::ReleaseMainThreadObjects() } nsresult -CountHelper::PackArgumentsForParentProcess(ObjectStoreRequestParams& aParams, - nsIContentChild* aBlobCreator) +CountHelper::PackArgumentsForParentProcess(ObjectStoreRequestParams& aParams) { NS_ASSERTION(NS_IsMainThread(), "Wrong thread!"); NS_ASSERTION(!IndexedDatabaseManager::IsMainProcess(), "Wrong process!"); - NS_ASSERTION(aBlobCreator, "Must have a valid creator!"); PROFILER_MAIN_THREAD_LABEL("CountHelper", "PackArgumentsForParentProcess [IDBObjectStore.cpp]", js::ProfileEntry::Category::STORAGE); diff --git a/dom/indexedDB/ipc/IndexedDBChild.cpp b/dom/indexedDB/ipc/IndexedDBChild.cpp index 266b737ee45..ae607556e27 100644 --- a/dom/indexedDB/ipc/IndexedDBChild.cpp +++ b/dom/indexedDB/ipc/IndexedDBChild.cpp @@ -159,31 +159,12 @@ public: * IndexedDBChild ******************************************************************************/ -IndexedDBChild::IndexedDBChild(ContentChild* aContentChild, - const nsCString& aASCIIOrigin) -: mFactory(nullptr) -, mManagerContent(aContentChild) -, mManagerTab(nullptr) -, mASCIIOrigin(aASCIIOrigin) +IndexedDBChild::IndexedDBChild(const nsCString& aASCIIOrigin) +: mFactory(nullptr), mASCIIOrigin(aASCIIOrigin) #ifdef DEBUG -, mDisconnected(false) + , mDisconnected(false) #endif { - MOZ_ASSERT(aContentChild); - MOZ_COUNT_CTOR(IndexedDBChild); -} - -IndexedDBChild::IndexedDBChild(TabChild* aTabChild, - const nsCString& aASCIIOrigin) -: mFactory(nullptr) -, mManagerContent(nullptr) -, mManagerTab(aTabChild) -, mASCIIOrigin(aASCIIOrigin) -#ifdef DEBUG -, mDisconnected(false) -#endif -{ - MOZ_ASSERT(aTabChild); MOZ_COUNT_CTOR(IndexedDBChild); } diff --git a/dom/indexedDB/ipc/IndexedDBChild.h b/dom/indexedDB/ipc/IndexedDBChild.h index 9683668e1dc..b96e39a133c 100644 --- a/dom/indexedDB/ipc/IndexedDBChild.h +++ b/dom/indexedDB/ipc/IndexedDBChild.h @@ -19,13 +19,6 @@ #include "mozilla/dom/indexedDB/PIndexedDBRequestChild.h" #include "mozilla/dom/indexedDB/PIndexedDBTransactionChild.h" -namespace mozilla { -namespace dom { -class ContentChild; -class TabChild; -} // dom -} // mozilla - BEGIN_INDEXEDDB_NAMESPACE class AsyncConnectionHelper; @@ -43,9 +36,6 @@ class IDBTransactionListener; class IndexedDBChild : public PIndexedDBChild { IDBFactory* mFactory; - ContentChild* mManagerContent; - TabChild* mManagerTab; - nsCString mASCIIOrigin; #ifdef DEBUG @@ -53,8 +43,7 @@ class IndexedDBChild : public PIndexedDBChild #endif public: - IndexedDBChild(ContentChild* aContentChild, const nsCString& aASCIIOrigin); - IndexedDBChild(TabChild* aTabChild, const nsCString& aASCIIOrigin); + IndexedDBChild(const nsCString& aASCIIOrigin); virtual ~IndexedDBChild(); const nsCString& @@ -63,18 +52,6 @@ public: return mASCIIOrigin; } - ContentChild* - GetManagerContent() const - { - return mManagerContent; - } - - TabChild* - GetManagerTab() const - { - return mManagerTab; - } - void SetFactory(IDBFactory* aFactory);