mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-27 23:02:20 +00:00
Bug 1350637 - Part 1: Move PStorage stubs from PContent to PBackground; r=asuth r=billm
--HG-- rename : dom/storage/PStorage.ipdl => dom/storage/PBackgroundStorage.ipdl
This commit is contained in:
parent
425ec06f61
commit
ceff0f7d8f
@ -36,7 +36,6 @@
|
||||
#include "mozilla/dom/ProcessGlobal.h"
|
||||
#include "mozilla/dom/PushNotifier.h"
|
||||
#include "mozilla/dom/LocalStorage.h"
|
||||
#include "mozilla/dom/StorageIPC.h"
|
||||
#include "mozilla/dom/TabGroup.h"
|
||||
#include "mozilla/dom/workers/ServiceWorkerManager.h"
|
||||
#include "mozilla/dom/nsIContentChild.h"
|
||||
@ -2105,21 +2104,6 @@ ContentChild::DeallocPMediaChild(media::PMediaChild *aActor)
|
||||
return media::DeallocPMediaChild(aActor);
|
||||
}
|
||||
|
||||
PStorageChild*
|
||||
ContentChild::AllocPStorageChild()
|
||||
{
|
||||
MOZ_CRASH("We should never be manually allocating PStorageChild actors");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
bool
|
||||
ContentChild::DeallocPStorageChild(PStorageChild* aActor)
|
||||
{
|
||||
StorageDBChild* child = static_cast<StorageDBChild*>(aActor);
|
||||
child->ReleaseIPDLReference();
|
||||
return true;
|
||||
}
|
||||
|
||||
PSpeechSynthesisChild*
|
||||
ContentChild::AllocPSpeechSynthesisChild()
|
||||
{
|
||||
|
@ -49,7 +49,6 @@ namespace dom {
|
||||
|
||||
class AlertObserver;
|
||||
class ConsoleListener;
|
||||
class PStorageChild;
|
||||
class ClonedMessageData;
|
||||
class TabChild;
|
||||
class GetFilesHelperChild;
|
||||
@ -300,10 +299,6 @@ public:
|
||||
|
||||
virtual bool DeallocPMediaChild(PMediaChild* aActor) override;
|
||||
|
||||
virtual PStorageChild* AllocPStorageChild() override;
|
||||
|
||||
virtual bool DeallocPStorageChild(PStorageChild* aActor) override;
|
||||
|
||||
virtual PPresentationChild* AllocPPresentationChild() override;
|
||||
|
||||
virtual bool DeallocPPresentationChild(PPresentationChild* aActor) override;
|
||||
|
@ -48,8 +48,6 @@
|
||||
#include "mozilla/dom/PContentPermissionRequestParent.h"
|
||||
#include "mozilla/dom/PCycleCollectWithLogsParent.h"
|
||||
#include "mozilla/dom/ServiceWorkerRegistrar.h"
|
||||
#include "mozilla/dom/Storage.h"
|
||||
#include "mozilla/dom/StorageIPC.h"
|
||||
#include "mozilla/dom/power/PowerManagerService.h"
|
||||
#include "mozilla/dom/Permissions.h"
|
||||
#include "mozilla/dom/PresentationParent.h"
|
||||
@ -3304,20 +3302,6 @@ ContentParent::DeallocPMediaParent(media::PMediaParent *aActor)
|
||||
return media::DeallocPMediaParent(aActor);
|
||||
}
|
||||
|
||||
PStorageParent*
|
||||
ContentParent::AllocPStorageParent()
|
||||
{
|
||||
return new StorageDBParent();
|
||||
}
|
||||
|
||||
bool
|
||||
ContentParent::DeallocPStorageParent(PStorageParent* aActor)
|
||||
{
|
||||
StorageDBParent* child = static_cast<StorageDBParent*>(aActor);
|
||||
child->ReleaseIPDLReference();
|
||||
return true;
|
||||
}
|
||||
|
||||
PPresentationParent*
|
||||
ContentParent::AllocPPresentationParent()
|
||||
{
|
||||
|
@ -97,7 +97,6 @@ namespace dom {
|
||||
|
||||
class Element;
|
||||
class TabParent;
|
||||
class PStorageParent;
|
||||
class ClonedMessageData;
|
||||
class MemoryReport;
|
||||
class TabContext;
|
||||
@ -449,13 +448,6 @@ public:
|
||||
virtual PHeapSnapshotTempFileHelperParent*
|
||||
AllocPHeapSnapshotTempFileHelperParent() override;
|
||||
|
||||
virtual PStorageParent* AllocPStorageParent() override;
|
||||
|
||||
virtual mozilla::ipc::IPCResult RecvPStorageConstructor(PStorageParent* aActor) override
|
||||
{
|
||||
return PContentParent::RecvPStorageConstructor(aActor);
|
||||
}
|
||||
|
||||
virtual PJavaScriptParent*
|
||||
AllocPJavaScriptParent() override;
|
||||
|
||||
@ -931,8 +923,6 @@ private:
|
||||
|
||||
virtual bool DeallocPMediaParent(PMediaParent* aActor) override;
|
||||
|
||||
virtual bool DeallocPStorageParent(PStorageParent* aActor) override;
|
||||
|
||||
virtual PPresentationParent* AllocPPresentationParent() override;
|
||||
|
||||
virtual bool DeallocPPresentationParent(PPresentationParent* aActor) override;
|
||||
|
@ -31,7 +31,6 @@ include protocol PParentToChildStream;
|
||||
include protocol POfflineCacheUpdate;
|
||||
include protocol PRenderFrame;
|
||||
include protocol PSpeechSynthesis;
|
||||
include protocol PStorage;
|
||||
include protocol PTestShell;
|
||||
include protocol PJavaScript;
|
||||
include protocol PRemoteSpellcheckEngine;
|
||||
@ -291,7 +290,6 @@ nested(upto inside_cpow) sync protocol PContent
|
||||
manages PChildToParentStream;
|
||||
manages PParentToChildStream;
|
||||
manages PSpeechSynthesis;
|
||||
manages PStorage;
|
||||
manages PTestShell;
|
||||
manages PJavaScript;
|
||||
manages PRemoteSpellcheckEngine;
|
||||
@ -713,8 +711,6 @@ parent:
|
||||
|
||||
async PSpeechSynthesis();
|
||||
|
||||
nested(inside_cpow) async PStorage();
|
||||
|
||||
async PMedia();
|
||||
|
||||
async PWebrtcGlobal();
|
||||
|
@ -126,7 +126,6 @@ LOCAL_INCLUDES += [
|
||||
'/dom/geolocation',
|
||||
'/dom/media/webspeech/synth/ipc',
|
||||
'/dom/security',
|
||||
'/dom/storage',
|
||||
'/dom/workers',
|
||||
'/extensions/cookie',
|
||||
'/extensions/spellcheck/src',
|
||||
|
@ -685,14 +685,8 @@ LocalStorageCache::StartDatabase()
|
||||
}
|
||||
|
||||
if (XRE_IsParentProcess()) {
|
||||
nsAutoPtr<StorageDBThread> db(new StorageDBThread());
|
||||
|
||||
nsresult rv = db->Init();
|
||||
if (NS_FAILED(rv)) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
sDatabase = db.forget();
|
||||
// XXX Fix me!
|
||||
return nullptr;
|
||||
} else {
|
||||
// Use LocalStorageManager::Ensure in case we're called from
|
||||
// DOMSessionStorageManager's initializer and we haven't yet initialized the
|
||||
|
@ -4,7 +4,7 @@
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
include protocol PContent;
|
||||
include protocol PBackground;
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
@ -12,16 +12,16 @@ namespace dom {
|
||||
/* This protocol bridges async access to the database thread running on the
|
||||
* parent process and caches running on the child process.
|
||||
*/
|
||||
nested(upto inside_cpow) sync protocol PStorage
|
||||
sync protocol PBackgroundStorage
|
||||
{
|
||||
manager PContent;
|
||||
manager PBackground;
|
||||
|
||||
parent:
|
||||
async __delete__();
|
||||
|
||||
nested(inside_cpow) sync Preload(nsCString originSuffix,
|
||||
nsCString originNoSuffix,
|
||||
uint32_t alreadyLoadedCount)
|
||||
sync Preload(nsCString originSuffix,
|
||||
nsCString originNoSuffix,
|
||||
uint32_t alreadyLoadedCount)
|
||||
returns (nsString[] keys, nsString[] values, nsresult rv);
|
||||
|
||||
async AsyncPreload(nsCString originSuffix, nsCString originNoSuffix,
|
@ -10,6 +10,9 @@
|
||||
|
||||
#include "mozilla/dom/ContentChild.h"
|
||||
#include "mozilla/dom/ContentParent.h"
|
||||
#include "mozilla/ipc/BackgroundChild.h"
|
||||
#include "mozilla/ipc/BackgroundParent.h"
|
||||
#include "mozilla/ipc/PBackgroundChild.h"
|
||||
#include "mozilla/Unused.h"
|
||||
#include "nsIDiskSpaceWatcher.h"
|
||||
#include "nsThreadUtils.h"
|
||||
@ -80,9 +83,15 @@ StorageDBChild::OriginsHavingData()
|
||||
nsresult
|
||||
StorageDBChild::Init()
|
||||
{
|
||||
ContentChild* child = ContentChild::GetSingleton();
|
||||
PBackgroundChild* actor = BackgroundChild::GetOrCreateForCurrentThread();
|
||||
if (NS_WARN_IF(!actor)) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
AddIPDLReference();
|
||||
child->SendPStorageConstructor(this);
|
||||
|
||||
actor->SendPBackgroundStorageConstructor(this);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@ -333,6 +342,8 @@ private:
|
||||
mozilla::Unused << mParent->SendOriginsHavingData(scopes);
|
||||
}
|
||||
|
||||
// XXX Fix me!
|
||||
#if 0
|
||||
// We need to check if the device is in a low disk space situation, so
|
||||
// we can forbid in that case any write in localStorage.
|
||||
nsCOMPtr<nsIDiskSpaceWatcher> diskSpaceWatcher =
|
||||
@ -348,6 +359,7 @@ private:
|
||||
mozilla::Unused << mParent->SendObserve(
|
||||
nsDependentCString("low-disk-space"), EmptyString(), EmptyCString());
|
||||
}
|
||||
#endif
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
@ -787,5 +799,37 @@ StorageDBParent::UsageParentBridge::LoadUsage(const int64_t aUsage)
|
||||
NS_DispatchToMainThread(r);
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
* Exported functions
|
||||
******************************************************************************/
|
||||
|
||||
PBackgroundStorageParent*
|
||||
AllocPBackgroundStorageParent()
|
||||
{
|
||||
AssertIsOnBackgroundThread();
|
||||
|
||||
return new StorageDBParent();
|
||||
}
|
||||
|
||||
mozilla::ipc::IPCResult
|
||||
RecvPBackgroundStorageConstructor(PBackgroundStorageParent* aActor)
|
||||
{
|
||||
AssertIsOnBackgroundThread();
|
||||
MOZ_ASSERT(aActor);
|
||||
|
||||
return IPC_OK();
|
||||
}
|
||||
|
||||
bool
|
||||
DeallocPBackgroundStorageParent(PBackgroundStorageParent* aActor)
|
||||
{
|
||||
AssertIsOnBackgroundThread();
|
||||
MOZ_ASSERT(aActor);
|
||||
|
||||
StorageDBParent* actor = static_cast<StorageDBParent*>(aActor);
|
||||
actor->ReleaseIPDLReference();
|
||||
return true;
|
||||
}
|
||||
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
|
@ -7,8 +7,8 @@
|
||||
#ifndef mozilla_dom_StorageIPC_h
|
||||
#define mozilla_dom_StorageIPC_h
|
||||
|
||||
#include "mozilla/dom/PStorageChild.h"
|
||||
#include "mozilla/dom/PStorageParent.h"
|
||||
#include "mozilla/dom/PBackgroundStorageChild.h"
|
||||
#include "mozilla/dom/PBackgroundStorageParent.h"
|
||||
#include "StorageDBThread.h"
|
||||
#include "LocalStorageCache.h"
|
||||
#include "StorageObserver.h"
|
||||
@ -22,13 +22,14 @@ class OriginAttributesPattern;
|
||||
namespace dom {
|
||||
|
||||
class LocalStorageManager;
|
||||
class PBackgroundStorageParent;
|
||||
|
||||
// Child side of the IPC protocol, exposes as DB interface but
|
||||
// is responsible to send all requests to the parent process
|
||||
// and expects asynchronous answers. Those are then transparently
|
||||
// forwarded back to consumers on the child process.
|
||||
class StorageDBChild final : public StorageDBBridge
|
||||
, public PStorageChild
|
||||
, public PBackgroundStorageChild
|
||||
{
|
||||
virtual ~StorageDBChild();
|
||||
|
||||
@ -123,7 +124,7 @@ private:
|
||||
// LocalStorageCache consumer.
|
||||
// Also responsible for forwardning all chrome operation notifications
|
||||
// such as cookie cleaning etc to the child process.
|
||||
class StorageDBParent final : public PStorageParent
|
||||
class StorageDBParent final : public PBackgroundStorageParent
|
||||
, public StorageObserverSink
|
||||
{
|
||||
virtual ~StorageDBParent();
|
||||
@ -236,6 +237,15 @@ private:
|
||||
bool mIPCOpen;
|
||||
};
|
||||
|
||||
PBackgroundStorageParent*
|
||||
AllocPBackgroundStorageParent();
|
||||
|
||||
mozilla::ipc::IPCResult
|
||||
RecvPBackgroundStorageConstructor(PBackgroundStorageParent* aActor);
|
||||
|
||||
bool
|
||||
DeallocPBackgroundStorageParent(PBackgroundStorageParent* aActor);
|
||||
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
|
||||
|
@ -34,7 +34,7 @@ UNIFIED_SOURCES += [
|
||||
]
|
||||
|
||||
IPDL_SOURCES += [
|
||||
'PStorage.ipdl',
|
||||
'PBackgroundStorage.ipdl',
|
||||
]
|
||||
|
||||
include('/ipc/chromium/chromium-config.mozbuild')
|
||||
|
@ -25,6 +25,7 @@
|
||||
#include "mozilla/dom/ipc/IPCBlobInputStreamChild.h"
|
||||
#include "mozilla/dom/ipc/PendingIPCBlobChild.h"
|
||||
#include "mozilla/dom/quota/PQuotaChild.h"
|
||||
#include "mozilla/dom/StorageIPC.h"
|
||||
#include "mozilla/dom/GamepadEventChannelChild.h"
|
||||
#include "mozilla/dom/GamepadTestChannelChild.h"
|
||||
#include "mozilla/dom/MessagePortChild.h"
|
||||
@ -77,6 +78,7 @@ using mozilla::dom::asmjscache::PAsmJSCacheEntryChild;
|
||||
using mozilla::dom::cache::PCacheChild;
|
||||
using mozilla::dom::cache::PCacheStorageChild;
|
||||
using mozilla::dom::cache::PCacheStreamControlChild;
|
||||
using mozilla::dom::StorageDBChild;
|
||||
|
||||
using mozilla::dom::WebAuthnTransactionChild;
|
||||
|
||||
@ -202,6 +204,23 @@ BackgroundChildImpl::DeallocPBackgroundIndexedDBUtilsChild(
|
||||
return true;
|
||||
}
|
||||
|
||||
BackgroundChildImpl::PBackgroundStorageChild*
|
||||
BackgroundChildImpl::AllocPBackgroundStorageChild()
|
||||
{
|
||||
MOZ_CRASH("PBackgroundStorageChild actors should be manually constructed!");
|
||||
}
|
||||
|
||||
bool
|
||||
BackgroundChildImpl::DeallocPBackgroundStorageChild(
|
||||
PBackgroundStorageChild* aActor)
|
||||
{
|
||||
MOZ_ASSERT(aActor);
|
||||
|
||||
StorageDBChild* child = static_cast<StorageDBChild*>(aActor);
|
||||
child->ReleaseIPDLReference();
|
||||
return true;
|
||||
}
|
||||
|
||||
PPendingIPCBlobChild*
|
||||
BackgroundChildImpl::AllocPPendingIPCBlobChild(const IPCBlob& aBlob)
|
||||
{
|
||||
|
@ -70,6 +70,12 @@ protected:
|
||||
DeallocPBackgroundIndexedDBUtilsChild(PBackgroundIndexedDBUtilsChild* aActor)
|
||||
override;
|
||||
|
||||
virtual PBackgroundStorageChild*
|
||||
AllocPBackgroundStorageChild() override;
|
||||
|
||||
virtual bool
|
||||
DeallocPBackgroundStorageChild(PBackgroundStorageChild* aActor) override;
|
||||
|
||||
virtual PPendingIPCBlobChild*
|
||||
AllocPPendingIPCBlobChild(const IPCBlob& aBlob) override;
|
||||
|
||||
|
@ -29,6 +29,7 @@
|
||||
#include "mozilla/dom/ipc/IPCBlobInputStreamParent.h"
|
||||
#include "mozilla/dom/ipc/PendingIPCBlobParent.h"
|
||||
#include "mozilla/dom/quota/ActorsParent.h"
|
||||
#include "mozilla/dom/StorageIPC.h"
|
||||
#include "mozilla/ipc/BackgroundParent.h"
|
||||
#include "mozilla/ipc/BackgroundUtils.h"
|
||||
#include "mozilla/ipc/IPCStreamAlloc.h"
|
||||
@ -242,6 +243,38 @@ BackgroundParentImpl::RecvFlushPendingFileDeletions()
|
||||
return IPC_OK();
|
||||
}
|
||||
|
||||
auto
|
||||
BackgroundParentImpl::AllocPBackgroundStorageParent()
|
||||
-> PBackgroundStorageParent*
|
||||
{
|
||||
AssertIsInMainProcess();
|
||||
AssertIsOnBackgroundThread();
|
||||
|
||||
return mozilla::dom::AllocPBackgroundStorageParent();
|
||||
}
|
||||
|
||||
mozilla::ipc::IPCResult
|
||||
BackgroundParentImpl::RecvPBackgroundStorageConstructor(
|
||||
PBackgroundStorageParent* aActor)
|
||||
{
|
||||
AssertIsInMainProcess();
|
||||
AssertIsOnBackgroundThread();
|
||||
MOZ_ASSERT(aActor);
|
||||
|
||||
return mozilla::dom::RecvPBackgroundStorageConstructor(aActor);
|
||||
}
|
||||
|
||||
bool
|
||||
BackgroundParentImpl::DeallocPBackgroundStorageParent(
|
||||
PBackgroundStorageParent* aActor)
|
||||
{
|
||||
AssertIsInMainProcess();
|
||||
AssertIsOnBackgroundThread();
|
||||
MOZ_ASSERT(aActor);
|
||||
|
||||
return mozilla::dom::DeallocPBackgroundStorageParent(aActor);
|
||||
}
|
||||
|
||||
PPendingIPCBlobParent*
|
||||
BackgroundParentImpl::AllocPPendingIPCBlobParent(const IPCBlob& aBlob)
|
||||
{
|
||||
|
@ -63,6 +63,15 @@ protected:
|
||||
virtual mozilla::ipc::IPCResult
|
||||
RecvFlushPendingFileDeletions() override;
|
||||
|
||||
virtual PBackgroundStorageParent*
|
||||
AllocPBackgroundStorageParent() override;
|
||||
|
||||
virtual mozilla::ipc::IPCResult
|
||||
RecvPBackgroundStorageConstructor(PBackgroundStorageParent* aActor) override;
|
||||
|
||||
virtual bool
|
||||
DeallocPBackgroundStorageParent(PBackgroundStorageParent* aActor) override;
|
||||
|
||||
virtual PPendingIPCBlobParent*
|
||||
AllocPPendingIPCBlobParent(const IPCBlob& aBlob) override;
|
||||
|
||||
|
@ -5,6 +5,7 @@
|
||||
include protocol PAsmJSCacheEntry;
|
||||
include protocol PBackgroundIDBFactory;
|
||||
include protocol PBackgroundIndexedDBUtils;
|
||||
include protocol PBackgroundStorage;
|
||||
include protocol PBackgroundTest;
|
||||
include protocol PBroadcastChannel;
|
||||
include protocol PCache;
|
||||
@ -53,6 +54,7 @@ sync protocol PBackground
|
||||
manages PAsmJSCacheEntry;
|
||||
manages PBackgroundIDBFactory;
|
||||
manages PBackgroundIndexedDBUtils;
|
||||
manages PBackgroundStorage;
|
||||
manages PBackgroundTest;
|
||||
manages PBroadcastChannel;
|
||||
manages PCache;
|
||||
@ -86,6 +88,8 @@ parent:
|
||||
// Use only for testing!
|
||||
async FlushPendingFileDeletions();
|
||||
|
||||
async PBackgroundStorage();
|
||||
|
||||
async PVsync();
|
||||
|
||||
async PCameras();
|
||||
|
@ -189,6 +189,7 @@ LOCAL_INCLUDES += [
|
||||
'/caps',
|
||||
'/dom/broadcastchannel',
|
||||
'/dom/indexedDB',
|
||||
'/dom/storage',
|
||||
'/dom/workers',
|
||||
'/media/webrtc/trunk',
|
||||
'/xpcom/build',
|
||||
|
@ -930,7 +930,7 @@ description =
|
||||
description =
|
||||
[PBrowserStream::NPN_RequestRead]
|
||||
description =
|
||||
[PStorage::Preload]
|
||||
[PBackgroundStorage::Preload]
|
||||
description =
|
||||
[PRemoteSpellcheckEngine::Check]
|
||||
description =
|
||||
|
Loading…
Reference in New Issue
Block a user