Bug 1613854 - De-virtualize IPDL protocol methods in ActorsChild. r=dom-workers-and-storage-reviewers,janv,jld

Differential Revision: https://phabricator.services.mozilla.com/D61991

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Simon Giesecke 2020-02-14 00:58:53 +00:00
Родитель 18dedc99e3
Коммит 7e65d8de67
3 изменённых файлов: 81 добавлений и 64 удалений

Просмотреть файл

@ -7,10 +7,10 @@
#ifndef mozilla_dom_indexeddb_actorschild_h__
#define mozilla_dom_indexeddb_actorschild_h__
#include "IDBCursorType.h"
#include "IDBTransaction.h"
#include "js/RootingAPI.h"
#include "mozilla/Attributes.h"
#include "mozilla/dom/IDBCursorType.h"
#include "mozilla/dom/IDBTransaction.h"
#include "mozilla/dom/indexedDB/PBackgroundIDBCursorChild.h"
#include "mozilla/dom/indexedDB/PBackgroundIDBDatabaseChild.h"
#include "mozilla/dom/indexedDB/PBackgroundIDBDatabaseRequestChild.h"
@ -169,21 +169,20 @@ class BackgroundFactoryChild final : public PBackgroundIDBFactoryChild {
void SendDeleteMeInternal();
public:
// IPDL methods are only called by IPDL.
void ActorDestroy(ActorDestroyReason aWhy) override;
PBackgroundIDBFactoryRequestChild* AllocPBackgroundIDBFactoryRequestChild(
const FactoryRequestParams& aParams) override;
const FactoryRequestParams& aParams);
bool DeallocPBackgroundIDBFactoryRequestChild(
PBackgroundIDBFactoryRequestChild* aActor) override;
PBackgroundIDBFactoryRequestChild* aActor);
PBackgroundIDBDatabaseChild* AllocPBackgroundIDBDatabaseChild(
const DatabaseSpec& aSpec,
PBackgroundIDBFactoryRequestChild* aRequest) override;
const DatabaseSpec& aSpec, PBackgroundIDBFactoryRequestChild* aRequest);
bool DeallocPBackgroundIDBDatabaseChild(
PBackgroundIDBDatabaseChild* aActor) override;
bool DeallocPBackgroundIDBDatabaseChild(PBackgroundIDBDatabaseChild* aActor);
mozilla::ipc::IPCResult RecvPBackgroundIDBDatabaseConstructor(
PBackgroundIDBDatabaseChild* aActor, const DatabaseSpec& aSpec,
@ -260,6 +259,7 @@ class BackgroundFactoryRequestChild final
bool HandleResponse(const DeleteDatabaseRequestResponse& aResponse);
public:
// IPDL methods are only called by IPDL.
void ActorDestroy(ActorDestroyReason aWhy) override;
@ -267,9 +267,9 @@ class BackgroundFactoryRequestChild final
const FactoryRequestResponse& aResponse) override;
mozilla::ipc::IPCResult RecvPermissionChallenge(
const PrincipalInfo& aPrincipalInfo) override;
const PrincipalInfo& aPrincipalInfo);
mozilla::ipc::IPCResult RecvBlocked(const uint64_t& aCurrentVersion) override;
mozilla::ipc::IPCResult RecvBlocked(const uint64_t& aCurrentVersion);
};
class BackgroundDatabaseChild final : public PBackgroundIDBDatabaseChild {
@ -317,31 +317,32 @@ class BackgroundDatabaseChild final : public PBackgroundIDBDatabaseChild {
void ReleaseDOMObject();
public:
// IPDL methods are only called by IPDL.
void ActorDestroy(ActorDestroyReason aWhy) override;
PBackgroundIDBDatabaseFileChild* AllocPBackgroundIDBDatabaseFileChild(
const IPCBlob& aIPCBlob) override;
const IPCBlob& aIPCBlob);
bool DeallocPBackgroundIDBDatabaseFileChild(
PBackgroundIDBDatabaseFileChild* aActor) override;
PBackgroundIDBDatabaseFileChild* aActor);
PBackgroundIDBDatabaseRequestChild* AllocPBackgroundIDBDatabaseRequestChild(
const DatabaseRequestParams& aParams) override;
const DatabaseRequestParams& aParams);
bool DeallocPBackgroundIDBDatabaseRequestChild(
PBackgroundIDBDatabaseRequestChild* aActor) override;
PBackgroundIDBDatabaseRequestChild* aActor);
PBackgroundIDBTransactionChild* AllocPBackgroundIDBTransactionChild(
const nsTArray<nsString>& aObjectStoreNames, const Mode& aMode) override;
const nsTArray<nsString>& aObjectStoreNames, const Mode& aMode);
bool DeallocPBackgroundIDBTransactionChild(
PBackgroundIDBTransactionChild* aActor) override;
PBackgroundIDBTransactionChild* aActor);
PBackgroundIDBVersionChangeTransactionChild*
AllocPBackgroundIDBVersionChangeTransactionChild(
const uint64_t& aCurrentVersion, const uint64_t& aRequestedVersion,
const int64_t& aNextObjectStoreId, const int64_t& aNextIndexId) override;
const int64_t& aNextObjectStoreId, const int64_t& aNextIndexId);
mozilla::ipc::IPCResult RecvPBackgroundIDBVersionChangeTransactionConstructor(
PBackgroundIDBVersionChangeTransactionChild* aActor,
@ -349,20 +350,19 @@ class BackgroundDatabaseChild final : public PBackgroundIDBDatabaseChild {
const int64_t& aNextObjectStoreId, const int64_t& aNextIndexId) override;
bool DeallocPBackgroundIDBVersionChangeTransactionChild(
PBackgroundIDBVersionChangeTransactionChild* aActor) override;
PBackgroundIDBVersionChangeTransactionChild* aActor);
PBackgroundMutableFileChild* AllocPBackgroundMutableFileChild(
const nsString& aName, const nsString& aType) override;
const nsString& aName, const nsString& aType);
bool DeallocPBackgroundMutableFileChild(
PBackgroundMutableFileChild* aActor) override;
bool DeallocPBackgroundMutableFileChild(PBackgroundMutableFileChild* aActor);
mozilla::ipc::IPCResult RecvVersionChange(
const uint64_t& aOldVersion, const Maybe<uint64_t>& aNewVersion) override;
mozilla::ipc::IPCResult RecvVersionChange(const uint64_t& aOldVersion,
const Maybe<uint64_t>& aNewVersion);
mozilla::ipc::IPCResult RecvInvalidate() override;
mozilla::ipc::IPCResult RecvInvalidate();
mozilla::ipc::IPCResult RecvCloseAfterInvalidationComplete() override;
mozilla::ipc::IPCResult RecvCloseAfterInvalidationComplete();
};
class BackgroundDatabaseRequestChild final
@ -384,6 +384,7 @@ class BackgroundDatabaseRequestChild final
bool HandleResponse(const CreateFileRequestResponse& aResponse);
public:
// IPDL methods are only called by IPDL.
mozilla::ipc::IPCResult Recv__delete__(
const DatabaseRequestResponse& aResponse) override;
@ -452,22 +453,21 @@ class BackgroundTransactionChild final : public BackgroundTransactionBase,
// Only destroyed by BackgroundDatabaseChild.
~BackgroundTransactionChild();
public:
// IPDL methods are only called by IPDL.
void ActorDestroy(ActorDestroyReason aWhy) override;
mozilla::ipc::IPCResult RecvComplete(const nsresult& aResult) override;
mozilla::ipc::IPCResult RecvComplete(const nsresult& aResult);
PBackgroundIDBRequestChild* AllocPBackgroundIDBRequestChild(
const RequestParams& aParams) override;
const RequestParams& aParams);
bool DeallocPBackgroundIDBRequestChild(
PBackgroundIDBRequestChild* aActor) override;
bool DeallocPBackgroundIDBRequestChild(PBackgroundIDBRequestChild* aActor);
PBackgroundIDBCursorChild* AllocPBackgroundIDBCursorChild(
const OpenCursorParams& aParams) override;
const OpenCursorParams& aParams);
bool DeallocPBackgroundIDBCursorChild(
PBackgroundIDBCursorChild* aActor) override;
bool DeallocPBackgroundIDBCursorChild(PBackgroundIDBCursorChild* aActor);
};
class BackgroundVersionChangeTransactionChild final
@ -499,22 +499,21 @@ class BackgroundVersionChangeTransactionChild final
BackgroundTransactionBase::SetDOMTransaction(aDOMObject);
}
public:
// IPDL methods are only called by IPDL.
void ActorDestroy(ActorDestroyReason aWhy) override;
mozilla::ipc::IPCResult RecvComplete(const nsresult& aResult) override;
mozilla::ipc::IPCResult RecvComplete(const nsresult& aResult);
PBackgroundIDBRequestChild* AllocPBackgroundIDBRequestChild(
const RequestParams& aParams) override;
const RequestParams& aParams);
bool DeallocPBackgroundIDBRequestChild(
PBackgroundIDBRequestChild* aActor) override;
bool DeallocPBackgroundIDBRequestChild(PBackgroundIDBRequestChild* aActor);
PBackgroundIDBCursorChild* AllocPBackgroundIDBCursorChild(
const OpenCursorParams& aParams) override;
const OpenCursorParams& aParams);
bool DeallocPBackgroundIDBCursorChild(
PBackgroundIDBCursorChild* aActor) override;
bool DeallocPBackgroundIDBCursorChild(PBackgroundIDBCursorChild* aActor);
};
class BackgroundMutableFileChild final : public PBackgroundMutableFileChild {
@ -555,14 +554,14 @@ class BackgroundMutableFileChild final : public PBackgroundMutableFileChild {
void SendDeleteMeInternal();
public:
// IPDL methods are only called by IPDL.
void ActorDestroy(ActorDestroyReason aWhy) override;
PBackgroundFileHandleChild* AllocPBackgroundFileHandleChild(
const FileMode& aMode) override;
const FileMode& aMode);
bool DeallocPBackgroundFileHandleChild(
PBackgroundFileHandleChild* aActor) override;
bool DeallocPBackgroundFileHandleChild(PBackgroundFileHandleChild* aActor);
};
class BackgroundRequestChild final : public BackgroundRequestChildBase,
@ -620,14 +619,14 @@ class BackgroundRequestChild final : public BackgroundRequestChildBase,
nsresult HandlePreprocessInternal(
const nsTArray<PreprocessInfo>& aPreprocessInfos);
public:
// IPDL methods are only called by IPDL.
void ActorDestroy(ActorDestroyReason aWhy) override;
mozilla::ipc::IPCResult Recv__delete__(
const RequestResponse& aResponse) override;
mozilla::ipc::IPCResult RecvPreprocess(
const PreprocessParams& aParams) override;
mozilla::ipc::IPCResult RecvPreprocess(const PreprocessParams& aParams);
};
struct CloneInfo {
@ -734,13 +733,12 @@ class BackgroundCursorChild final : public BackgroundCursorChildBase {
MOZ_MUST_USE RefPtr<IDBCursor> HandleIndividualCursorResponse(
bool aUseAsCurrentResult, Args&&... aArgs);
public:
// IPDL methods are only called by IPDL.
void ActorDestroy(ActorDestroyReason aWhy) override;
mozilla::ipc::IPCResult RecvResponse(
const CursorResponse& aResponse) override;
mozilla::ipc::IPCResult RecvResponse(const CursorResponse& aResponse);
public:
// Force callers to use SendContinueInternal.
bool SendContinue(const CursorRequestParams& aParams, const Key& aCurrentKey,
const Key& aCurrentObjectStoreKey) = delete;
@ -784,16 +782,16 @@ class BackgroundFileHandleChild : public PBackgroundFileHandleChild {
void NoteComplete();
public:
// IPDL methods are only called by IPDL.
void ActorDestroy(ActorDestroyReason aWhy) override;
mozilla::ipc::IPCResult RecvComplete(const bool& aAborted) override;
mozilla::ipc::IPCResult RecvComplete(const bool& aAborted);
PBackgroundFileRequestChild* AllocPBackgroundFileRequestChild(
const FileRequestParams& aParams) override;
const FileRequestParams& aParams);
bool DeallocPBackgroundFileRequestChild(
PBackgroundFileRequestChild* aActor) override;
bool DeallocPBackgroundFileRequestChild(PBackgroundFileRequestChild* aActor);
};
class BackgroundFileRequestChild final : public PBackgroundFileRequestChild {
@ -828,6 +826,7 @@ class BackgroundFileRequestChild final : public PBackgroundFileRequestChild {
void HandleResponse(JS::Handle<JS::Value> aResponse);
public:
// IPDL methods are only called by IPDL.
void ActorDestroy(ActorDestroyReason aWhy) override;
@ -835,7 +834,7 @@ class BackgroundFileRequestChild final : public PBackgroundFileRequestChild {
const FileRequestResponse& aResponse) override;
mozilla::ipc::IPCResult RecvProgress(const uint64_t& aProgress,
const uint64_t& aProgressMax) override;
const uint64_t& aProgressMax);
};
class BackgroundUtilsChild final : public PBackgroundIndexedDBUtilsChild {
@ -862,6 +861,7 @@ class BackgroundUtilsChild final : public PBackgroundIndexedDBUtilsChild {
void SendDeleteMeInternal();
public:
// IPDL methods are only called by IPDL.
void ActorDestroy(ActorDestroyReason aWhy) override;
};

Просмотреть файл

@ -44,6 +44,7 @@ EXPORTS.mozilla.dom += [
]
EXPORTS.mozilla.dom.indexedDB += [
'ActorsChild.h',
'ActorsParent.h',
'IDBResult.h',
'Key.h',

Просмотреть файл

@ -406,6 +406,34 @@ DIRECT_CALL_OVERRIDES = {
("PTestUrgentHangs", "parent"): (
"TestUrgentHangsParent", "mozilla/_ipdltest/TestUrgentHangs.h"
),
("PBackgroundFileHandle", "child"):
("indexedDB::BackgroundFileHandleChild", "mozilla/dom/indexedDB/ActorsChild.h"),
("PBackgroundFileRequest", "child"):
("indexedDB::BackgroundFileRequestChild", "mozilla/dom/indexedDB/ActorsChild.h"),
("PBackgroundIDBCursor", "child"):
("indexedDB::BackgroundCursorChildBase", "mozilla/dom/indexedDB/ActorsChild.h"),
("PBackgroundIDBDatabase", "child"):
("indexedDB::BackgroundDatabaseChild", "mozilla/dom/indexedDB/ActorsChild.h"),
("PBackgroundIDBDatabaseRequest", "child"):
("indexedDB::BackgroundDatabaseRequestChild",
"mozilla/dom/indexedDB/ActorsChild.h"),
("PBackgroundIDBFactory", "child"):
("indexedDB::BackgroundFactoryChild", "mozilla/dom/indexedDB/ActorsChild.h"),
("PBackgroundIDBFactoryRequest", "child"):
("indexedDB::BackgroundFactoryRequestChild",
"mozilla/dom/indexedDB/ActorsChild.h"),
("PBackgroundIDBRequest", "child"):
("indexedDB::BackgroundRequestChild", "mozilla/dom/indexedDB/ActorsChild.h"),
("PBackgroundIDBTransaction", "child"):
("indexedDB::BackgroundTransactionChild", "mozilla/dom/indexedDB/ActorsChild.h"),
("PBackgroundIDBVersionChangeTransaction", "child"):
("indexedDB::BackgroundVersionChangeTransactionChild",
"mozilla/dom/indexedDB/ActorsChild.h"),
("PBackgroundIndexedDBUtils", "child"):
("indexedDB::BackgroundUtilsChild", "mozilla/dom/indexedDB/ActorsChild.h"),
("PBackgroundMutableFile", "child"):
("indexedDB::BackgroundMutableFileChild", "mozilla/dom/indexedDB/ActorsChild.h"),
}
# Our long term goal is to burn this list down, so new entries should be added
@ -464,23 +492,11 @@ VIRTUAL_CALL_CLASSES = set([
# .h is not exported
("PBackground", "child"),
("PBackground", "parent"),
("PBackgroundFileHandle", "child"),
("PBackgroundFileRequest", "child"),
("PBackgroundIDBCursor", "child"),
("PBackgroundIDBDatabase", "child"),
("PBackgroundIDBDatabaseRequest", "child"),
("PBackgroundIDBFactory", "child"),
("PBackgroundIDBFactoryRequest", "child"),
("PBackgroundIDBRequest", "child"),
("PBackgroundIDBTransaction", "child"),
("PBackgroundIDBVersionChangeTransaction", "child"),
("PBackgroundIndexedDBUtils", "child"),
("PBackgroundLSDatabase", "child"),
("PBackgroundLSObserver", "child"),
("PBackgroundLSRequest", "child"),
("PBackgroundLSSimpleRequest", "child"),
("PBackgroundLSSnapshot", "child"),
("PBackgroundMutableFile", "child"),
("PBackgroundSDBConnection", "child"),
("PBackgroundSDBRequest", "child"),
("PBroadcastChannel", "child"),