Bug 1607634 - Part 4b: Changes for not-nullable actor types being wrapped in NotNull, r=ipc-reviewers,necko-reviewers,mccr8

These are the code changes required by the IPDL changes in part 4a.

Differential Revision: https://phabricator.services.mozilla.com/D168887
This commit is contained in:
Nika Layzell 2023-03-20 15:40:36 +00:00
parent 75bbcd0353
commit f47e7d485e
33 changed files with 109 additions and 99 deletions

View file

@ -148,7 +148,7 @@ void DocAccessibleWrap::CacheViewportCallback(nsITimer* aTimer,
accessible->Description(description); accessible->Description(description);
cacheData.AppendElement(BatchData( cacheData.AppendElement(BatchData(
OriginDocument(accessible->Document()->IPCDoc()), OriginDocument(WrapNotNull(accessible->Document()->IPCDoc())),
UNIQUE_ID(accessible), accessible->State(), accessible->Bounds(), UNIQUE_ID(accessible), accessible->State(), accessible->Bounds(),
accessible->ActionCount(), name, textValue, nodeID, description, accessible->ActionCount(), name, textValue, nodeID, description,
UnspecifiedNaN<double>(), UnspecifiedNaN<double>(), UnspecifiedNaN<double>(), UnspecifiedNaN<double>(),
@ -186,7 +186,8 @@ void DocAccessibleWrap::CacheViewportCallback(nsITimer* aTimer,
// In that case, just throw away this update. We will get a new one soon // In that case, just throw away this update. We will get a new one soon
// enough. // enough.
ipcDoc->GetPlatformExtension()->SendSetPivotBoundaries( ipcDoc->GetPlatformExtension()->SendSetPivotBoundaries(
firstDoc, UNIQUE_ID(first), lastDoc, UNIQUE_ID(last)); WrapNotNull(firstDoc), UNIQUE_ID(first), WrapNotNull(lastDoc),
UNIQUE_ID(last));
} }
} else if (RefPtr<SessionAccessibility> sessionAcc = } else if (RefPtr<SessionAccessibility> sessionAcc =
SessionAccessibility::GetInstanceFor(docAcc)) { SessionAccessibility::GetInstanceFor(docAcc)) {
@ -256,11 +257,11 @@ void DocAccessibleWrap::CacheFocusPath(AccessibleWrap* aAccessible) {
nsAutoString description; nsAutoString description;
acc->Description(description); acc->Description(description);
RefPtr<AccAttributes> attributes = acc->Attributes(); RefPtr<AccAttributes> attributes = acc->Attributes();
cacheData.AppendElement( cacheData.AppendElement(BatchData(
BatchData(OriginDocument(acc->Document()->IPCDoc()), UNIQUE_ID(acc), OriginDocument(WrapNotNull(acc->Document()->IPCDoc())),
acc->State(), acc->Bounds(), acc->ActionCount(), name, UNIQUE_ID(acc), acc->State(), acc->Bounds(), acc->ActionCount(), name,
textValue, nodeID, description, acc->CurValue(), textValue, nodeID, description, acc->CurValue(), acc->MinValue(),
acc->MinValue(), acc->MaxValue(), acc->Step(), attributes)); acc->MaxValue(), acc->Step(), attributes));
mFocusPath.InsertOrUpdate(acc->UniqueID(), RefPtr{acc}); mFocusPath.InsertOrUpdate(acc->UniqueID(), RefPtr{acc});
} }
@ -298,7 +299,7 @@ void DocAccessibleWrap::UpdateFocusPathBounds() {
} }
boundsData.AppendElement(BatchData( boundsData.AppendElement(BatchData(
OriginDocument(accessible->Document()->IPCDoc()), OriginDocument(WrapNotNull(accessible->Document()->IPCDoc())),
UNIQUE_ID(accessible), 0, accessible->Bounds(), 0, nsString(), UNIQUE_ID(accessible), 0, accessible->Bounds(), 0, nsString(),
nsString(), nsString(), nsString(), UnspecifiedNaN<double>(), nsString(), nsString(), nsString(), UnspecifiedNaN<double>(),
UnspecifiedNaN<double>(), UnspecifiedNaN<double>(), UnspecifiedNaN<double>(), UnspecifiedNaN<double>(),

View file

@ -958,7 +958,7 @@ void NotificationController::WillRefresh(mozilla::TimeStamp aTime) {
MOZ_DIAGNOSTIC_ASSERT(id); MOZ_DIAGNOSTIC_ASSERT(id);
DocAccessibleChild* ipcDoc = childDoc->IPCDoc(); DocAccessibleChild* ipcDoc = childDoc->IPCDoc();
if (ipcDoc) { if (ipcDoc) {
parentIPCDoc->SendBindChildDoc(ipcDoc, id); parentIPCDoc->SendBindChildDoc(WrapNotNull(ipcDoc), id);
continue; continue;
} }

View file

@ -802,7 +802,7 @@ mozilla::ipc::IPCResult DocAccessibleParent::RecvRoleChangedEvent(
} }
mozilla::ipc::IPCResult DocAccessibleParent::RecvBindChildDoc( mozilla::ipc::IPCResult DocAccessibleParent::RecvBindChildDoc(
PDocAccessibleParent* aChildDoc, const uint64_t& aID) { NotNull<PDocAccessibleParent*> aChildDoc, const uint64_t& aID) {
ACQUIRE_ANDROID_LOCK ACQUIRE_ANDROID_LOCK
// One document should never directly be the child of another. // One document should never directly be the child of another.
// We should always have at least an outer doc accessible in between. // We should always have at least an outer doc accessible in between.
@ -815,7 +815,7 @@ mozilla::ipc::IPCResult DocAccessibleParent::RecvBindChildDoc(
MOZ_ASSERT(CheckDocTree()); MOZ_ASSERT(CheckDocTree());
auto childDoc = static_cast<DocAccessibleParent*>(aChildDoc); auto childDoc = static_cast<DocAccessibleParent*>(aChildDoc.get());
childDoc->Unbind(); childDoc->Unbind();
ipc::IPCResult result = AddChildDoc(childDoc, aID, false); ipc::IPCResult result = AddChildDoc(childDoc, aID, false);
MOZ_ASSERT(result); MOZ_ASSERT(result);
@ -1261,7 +1261,7 @@ mozilla::ipc::IPCResult DocAccessibleParent::RecvBatch(
nsTArray<RemoteAccessible*> proxies(aData.Length()); nsTArray<RemoteAccessible*> proxies(aData.Length());
for (size_t i = 0; i < aData.Length(); i++) { for (size_t i = 0; i < aData.Length(); i++) {
DocAccessibleParent* doc = static_cast<DocAccessibleParent*>( DocAccessibleParent* doc = static_cast<DocAccessibleParent*>(
aData.ElementAt(i).Document().get_PDocAccessible().AsParent()); aData.ElementAt(i).Document().get_PDocAccessible().AsParent().get());
MOZ_ASSERT(doc); MOZ_ASSERT(doc);
if (doc->IsShutdown()) { if (doc->IsShutdown()) {

View file

@ -177,7 +177,7 @@ class DocAccessibleParent : public RemoteAccessible,
const a11y::role& aRole, const uint8_t& aRoleMapEntryIndex) final; const a11y::role& aRole, const uint8_t& aRoleMapEntryIndex) final;
virtual mozilla::ipc::IPCResult RecvBindChildDoc( virtual mozilla::ipc::IPCResult RecvBindChildDoc(
PDocAccessibleParent* aChildDoc, const uint64_t& aID) override; NotNull<PDocAccessibleParent*> aChildDoc, const uint64_t& aID) override;
void Unbind() { void Unbind() {
if (DocAccessibleParent* parent = ParentDoc()) { if (DocAccessibleParent* parent = ParentDoc()) {

View file

@ -305,8 +305,8 @@ bool DocAccessibleChild::ConstructChildDocInParentProcess(
return true; return true;
} }
bool DocAccessibleChild::SendBindChildDoc(DocAccessibleChild* aChildDoc, bool DocAccessibleChild::SendBindChildDoc(
const uint64_t& aNewParentID) { NotNull<DocAccessibleChild*> aChildDoc, const uint64_t& aNewParentID) {
if (IsConstructedInParentProcess()) { if (IsConstructedInParentProcess()) {
return DocAccessibleChildBase::SendBindChildDoc(aChildDoc, aNewParentID); return DocAccessibleChildBase::SendBindChildDoc(aChildDoc, aNewParentID);
} }

View file

@ -79,7 +79,7 @@ class DocAccessibleChild : public DocAccessibleChildBase {
bool ConstructChildDocInParentProcess(DocAccessibleChild* aNewChildDoc, bool ConstructChildDocInParentProcess(DocAccessibleChild* aNewChildDoc,
uint64_t aUniqueID, uint32_t aMsaaID); uint64_t aUniqueID, uint32_t aMsaaID);
bool SendBindChildDoc(DocAccessibleChild* aChildDoc, bool SendBindChildDoc(NotNull<DocAccessibleChild*> aChildDoc,
const uint64_t& aNewParentID); const uint64_t& aNewParentID);
/** /**
@ -346,7 +346,8 @@ class DocAccessibleChild : public DocAccessibleChildBase {
struct SerializedBindChildDoc final : public DeferredEvent { struct SerializedBindChildDoc final : public DeferredEvent {
SerializedBindChildDoc(DocAccessibleChild* aParentDoc, SerializedBindChildDoc(DocAccessibleChild* aParentDoc,
DocAccessibleChild* aChildDoc, uint64_t aNewParentID) NotNull<DocAccessibleChild*> aChildDoc,
uint64_t aNewParentID)
: DeferredEvent(aParentDoc), : DeferredEvent(aParentDoc),
mChildDoc(aChildDoc), mChildDoc(aChildDoc),
mNewParentID(aNewParentID) {} mNewParentID(aNewParentID) {}
@ -355,7 +356,7 @@ class DocAccessibleChild : public DocAccessibleChildBase {
Unused << aParentIPCDoc->SendBindChildDoc(mChildDoc, mNewParentID); Unused << aParentIPCDoc->SendBindChildDoc(mChildDoc, mNewParentID);
} }
DocAccessibleChild* mChildDoc; NotNull<DocAccessibleChild*> mChildDoc;
uint64_t mNewParentID; uint64_t mNewParentID;
}; };

View file

@ -432,15 +432,12 @@ RefPtr<ClientOpPromise> ClientManagerService::Navigate(
PClientManagerParent* manager = source->Manager(); PClientManagerParent* manager = source->Manager();
MOZ_DIAGNOSTIC_ASSERT(manager); MOZ_DIAGNOSTIC_ASSERT(manager);
ClientNavigateOpConstructorArgs args;
args.url() = aArgs.url();
args.baseURL() = aArgs.baseURL();
// This is safe to do because the ClientSourceChild cannot directly delete // This is safe to do because the ClientSourceChild cannot directly delete
// itself. Instead it sends a Teardown message to the parent which then // itself. Instead it sends a Teardown message to the parent which then
// calls delete. That means we can be sure that we are not racing with // calls delete. That means we can be sure that we are not racing with
// source destruction here. // source destruction here.
args.target() = source; ClientNavigateOpConstructorArgs args(WrapNotNull(source), aArgs.url(),
aArgs.baseURL());
RefPtr<ClientOpPromise::Private> promise = RefPtr<ClientOpPromise::Private> promise =
new ClientOpPromise::Private(__func__); new ClientOpPromise::Private(__func__);

View file

@ -162,7 +162,7 @@ RefPtr<ClientOpPromise> ClientNavigateOpChild::DoNavigate(
// access the ClientSource again. // access the ClientSource again.
{ {
ClientSourceChild* targetActor = ClientSourceChild* targetActor =
static_cast<ClientSourceChild*>(aArgs.target().AsChild()); static_cast<ClientSourceChild*>(aArgs.target().AsChild().get());
MOZ_DIAGNOSTIC_ASSERT(targetActor); MOZ_DIAGNOSTIC_ASSERT(targetActor);
ClientSource* target = targetActor->GetSource(); ClientSource* target = targetActor->GetSource();

View file

@ -251,7 +251,7 @@ void ResolveCallback(FileSystemGetWritableFileStreamResponse&& aResponse,
auto& properties = aResponse.get_FileSystemWritableFileStreamProperties(); auto& properties = aResponse.get_FileSystemWritableFileStreamProperties();
auto* const actor = static_cast<FileSystemWritableFileStreamChild*>( auto* const actor = static_cast<FileSystemWritableFileStreamChild*>(
properties.writableFileStream().AsChild()); properties.writableFileStream().AsChild().get());
mozilla::ipc::RandomAccessStreamParams params = mozilla::ipc::RandomAccessStreamParams params =
std::move(properties.streamParams()); std::move(properties.streamParams());

View file

@ -216,7 +216,8 @@ mozilla::ipc::IPCResult FileSystemManagerParent::RecvGetWritable(
} }
auto writableFileStreamParent = auto writableFileStreamParent =
MakeRefPtr<FileSystemWritableFileStreamParent>(this, aRequest.entryId()); MakeNotNull<RefPtr<FileSystemWritableFileStreamParent>>(
this, aRequest.entryId());
QM_TRY_UNWRAP( QM_TRY_UNWRAP(
nsCOMPtr<nsIRandomAccessStream> stream, nsCOMPtr<nsIRandomAccessStream> stream,

View file

@ -832,7 +832,7 @@ bool BackgroundFactoryChild::DeallocPBackgroundIDBDatabaseChild(
mozilla::ipc::IPCResult mozilla::ipc::IPCResult
BackgroundFactoryChild::RecvPBackgroundIDBDatabaseConstructor( BackgroundFactoryChild::RecvPBackgroundIDBDatabaseConstructor(
PBackgroundIDBDatabaseChild* aActor, const DatabaseSpec& aSpec, PBackgroundIDBDatabaseChild* aActor, const DatabaseSpec& aSpec,
PBackgroundIDBFactoryRequestChild* aRequest) { NotNull<PBackgroundIDBFactoryRequestChild*> aRequest) {
AssertIsOnOwningThread(); AssertIsOnOwningThread();
MOZ_ASSERT(aActor); MOZ_ASSERT(aActor);
@ -901,8 +901,8 @@ void BackgroundFactoryRequestChild::HandleResponse(
mRequest->Reset(); mRequest->Reset();
auto* databaseActor = auto* databaseActor = static_cast<BackgroundDatabaseChild*>(
static_cast<BackgroundDatabaseChild*>(aResponse.database().AsChild()); aResponse.database().AsChild().get());
MOZ_ASSERT(databaseActor); MOZ_ASSERT(databaseActor);
IDBDatabase* const database = [this, databaseActor]() -> IDBDatabase* { IDBDatabase* const database = [this, databaseActor]() -> IDBDatabase* {
@ -1326,7 +1326,6 @@ BackgroundDatabaseChild::RecvCloseAfterInvalidationComplete() {
} }
/******************************************************************************* /*******************************************************************************
structs/unions, r=#ipc-reviewers!)
* BackgroundTransactionBase * BackgroundTransactionBase
******************************************************************************/ ******************************************************************************/

View file

@ -112,7 +112,7 @@ class BackgroundFactoryChild final : public PBackgroundIDBFactoryChild {
mozilla::ipc::IPCResult RecvPBackgroundIDBDatabaseConstructor( mozilla::ipc::IPCResult RecvPBackgroundIDBDatabaseConstructor(
PBackgroundIDBDatabaseChild* aActor, const DatabaseSpec& aSpec, PBackgroundIDBDatabaseChild* aActor, const DatabaseSpec& aSpec,
PBackgroundIDBFactoryRequestChild* aRequest) override; NotNull<PBackgroundIDBFactoryRequestChild*> aRequest) override;
}; };
class BackgroundDatabaseChild; class BackgroundDatabaseChild;

View file

@ -2146,7 +2146,7 @@ class Factory final : public PBackgroundIDBFactoryParent,
PBackgroundIDBDatabaseParent* AllocPBackgroundIDBDatabaseParent( PBackgroundIDBDatabaseParent* AllocPBackgroundIDBDatabaseParent(
const DatabaseSpec& aSpec, const DatabaseSpec& aSpec,
PBackgroundIDBFactoryRequestParent* aRequest) override; NotNull<PBackgroundIDBFactoryRequestParent*> aRequest) override;
bool DeallocPBackgroundIDBDatabaseParent( bool DeallocPBackgroundIDBDatabaseParent(
PBackgroundIDBDatabaseParent* aActor) override; PBackgroundIDBDatabaseParent* aActor) override;
@ -9118,7 +9118,8 @@ bool Factory::DeallocPBackgroundIDBFactoryRequestParent(
} }
PBackgroundIDBDatabaseParent* Factory::AllocPBackgroundIDBDatabaseParent( PBackgroundIDBDatabaseParent* Factory::AllocPBackgroundIDBDatabaseParent(
const DatabaseSpec& aSpec, PBackgroundIDBFactoryRequestParent* aRequest) { const DatabaseSpec& aSpec,
NotNull<PBackgroundIDBFactoryRequestParent*> aRequest) {
MOZ_CRASH( MOZ_CRASH(
"PBackgroundIDBDatabaseParent actors should be constructed " "PBackgroundIDBDatabaseParent actors should be constructed "
"manually!"); "manually!");
@ -10268,7 +10269,8 @@ bool TransactionBase::VerifyRequestParams(
} }
for (const FileAddInfo& fileAddInfo : aParams.fileAddInfos()) { for (const FileAddInfo& fileAddInfo : aParams.fileAddInfos()) {
const PBackgroundIDBDatabaseFileParent* file = fileAddInfo.file().AsParent(); const PBackgroundIDBDatabaseFileParent* file =
fileAddInfo.file().AsParent();
switch (fileAddInfo.type()) { switch (fileAddInfo.type()) {
case StructuredCloneFileBase::eBlob: case StructuredCloneFileBase::eBlob:
@ -15848,7 +15850,8 @@ void OpenDatabaseOp::SendResults() {
// XXX OpenDatabaseRequestResponse stores a raw pointer, can this be // XXX OpenDatabaseRequestResponse stores a raw pointer, can this be
// avoided? // avoided?
response = OpenDatabaseRequestResponse{mDatabase.unsafeGetRawPtr()}; response = OpenDatabaseRequestResponse{
WrapNotNull(mDatabase.unsafeGetRawPtr())};
} else { } else {
response = ClampResultCode(rv); response = ClampResultCode(rv);
#ifdef DEBUG #ifdef DEBUG
@ -15987,7 +15990,7 @@ nsresult OpenDatabaseOp::EnsureDatabaseActorIsAlive() {
mDatabase->SetActorAlive(); mDatabase->SetActorAlive();
if (!factory->SendPBackgroundIDBDatabaseConstructor( if (!factory->SendPBackgroundIDBDatabaseConstructor(
mDatabase.unsafeGetRawPtr(), spec, this)) { mDatabase.unsafeGetRawPtr(), spec, WrapNotNull(this))) {
IDB_REPORT_INTERNAL_ERR(); IDB_REPORT_INTERNAL_ERR();
return NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR; return NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR;
} }

View file

@ -767,7 +767,8 @@ RefPtr<IDBRequest> IDBObjectStore::AddOrPut(JSContext* aCx,
return Err(NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR); return Err(NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
} }
return FileAddInfo{fileActor, StructuredCloneFileBase::eBlob}; return FileAddInfo{WrapNotNull(fileActor),
StructuredCloneFileBase::eBlob};
} }
case StructuredCloneFileBase::eWasmBytecode: case StructuredCloneFileBase::eWasmBytecode:
@ -781,7 +782,7 @@ RefPtr<IDBRequest> IDBObjectStore::AddOrPut(JSContext* aCx,
return Err(NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR); return Err(NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
} }
return FileAddInfo{fileActor, file.Type()}; return FileAddInfo{WrapNotNull(fileActor), file.Type()};
} }
default: default:

View file

@ -714,8 +714,8 @@ BrowserChild::ProvideWindow(nsIOpenWindowInfo* aOpenWindowInfo,
// code back to our caller. // code back to our caller.
ContentChild* cc = ContentChild::GetSingleton(); ContentChild* cc = ContentChild::GetSingleton();
return cc->ProvideWindowCommon( return cc->ProvideWindowCommon(
this, aOpenWindowInfo, aChromeFlags, aCalledFromJS, aURI, aName, WrapNotNull(this), aOpenWindowInfo, aChromeFlags, aCalledFromJS, aURI,
aFeatures, aForceNoOpener, aForceNoReferrer, aIsPopupRequested, aName, aFeatures, aForceNoOpener, aForceNoReferrer, aIsPopupRequested,
aLoadState, aWindowIsNew, aReturn); aLoadState, aWindowIsNew, aReturn);
} }

View file

@ -971,14 +971,12 @@ static nsresult GetCreateWindowParams(nsIOpenWindowInfo* aOpenWindowInfo,
} }
nsresult ContentChild::ProvideWindowCommon( nsresult ContentChild::ProvideWindowCommon(
BrowserChild* aTabOpener, nsIOpenWindowInfo* aOpenWindowInfo, NotNull<BrowserChild*> aTabOpener, nsIOpenWindowInfo* aOpenWindowInfo,
uint32_t aChromeFlags, bool aCalledFromJS, nsIURI* aURI, uint32_t aChromeFlags, bool aCalledFromJS, nsIURI* aURI,
const nsAString& aName, const nsACString& aFeatures, bool aForceNoOpener, const nsAString& aName, const nsACString& aFeatures, bool aForceNoOpener,
bool aForceNoReferrer, bool aIsPopupRequested, bool aForceNoReferrer, bool aIsPopupRequested,
nsDocShellLoadState* aLoadState, bool* aWindowIsNew, nsDocShellLoadState* aLoadState, bool* aWindowIsNew,
BrowsingContext** aReturn) { BrowsingContext** aReturn) {
MOZ_DIAGNOSTIC_ASSERT(aTabOpener, "We must have a tab opener");
*aReturn = nullptr; *aReturn = nullptr;
nsAutoCString features(aFeatures); nsAutoCString features(aFeatures);
@ -1097,9 +1095,9 @@ nsresult ContentChild::ProvideWindowCommon(
return NS_ERROR_ABORT; return NS_ERROR_ABORT;
} }
auto newChild = MakeRefPtr<BrowserChild>(this, tabId, *aTabOpener, auto newChild = MakeNotNull<RefPtr<BrowserChild>>(
browsingContext, aChromeFlags, this, tabId, *aTabOpener, browsingContext, aChromeFlags,
/* aIsTopLevel */ true); /* aIsTopLevel */ true);
if (IsShuttingDown()) { if (IsShuttingDown()) {
return NS_ERROR_ABORT; return NS_ERROR_ABORT;
@ -1119,8 +1117,7 @@ nsresult ContentChild::ProvideWindowCommon(
} }
// Tell the parent process to set up its PBrowserParent. // Tell the parent process to set up its PBrowserParent.
PopupIPCTabContext ipcContext; PopupIPCTabContext ipcContext(aTabOpener, 0);
ipcContext.opener() = aTabOpener;
if (NS_WARN_IF(!SendConstructPopupBrowser( if (NS_WARN_IF(!SendConstructPopupBrowser(
std::move(parentEp), std::move(windowParentEp), tabId, ipcContext, std::move(parentEp), std::move(windowParentEp), tabId, ipcContext,
windowInit, aChromeFlags))) { windowInit, aChromeFlags))) {
@ -1136,9 +1133,11 @@ nsresult ContentChild::ProvideWindowCommon(
// Now that |newChild| has had its IPC link established, call |Init| to set it // Now that |newChild| has had its IPC link established, call |Init| to set it
// up. // up.
// XXX: This MOZ_KnownLive is only necessary because the static analysis can't
// tell that NotNull<RefPtr<BrowserChild>> is a strong pointer.
RefPtr<nsPIDOMWindowOuter> parentWindow = RefPtr<nsPIDOMWindowOuter> parentWindow =
parent ? parent->GetDOMWindow() : nullptr; parent ? parent->GetDOMWindow() : nullptr;
if (NS_FAILED(newChild->Init(parentWindow, windowChild))) { if (NS_FAILED(MOZ_KnownLive(newChild)->Init(parentWindow, windowChild))) {
return NS_ERROR_ABORT; return NS_ERROR_ABORT;
} }

View file

@ -99,7 +99,7 @@ class ContentChild final : public PContentChild,
}; };
MOZ_CAN_RUN_SCRIPT_BOUNDARY nsresult ProvideWindowCommon( MOZ_CAN_RUN_SCRIPT_BOUNDARY nsresult ProvideWindowCommon(
BrowserChild* aTabOpener, nsIOpenWindowInfo* aOpenWindowInfo, NotNull<BrowserChild*> aTabOpener, nsIOpenWindowInfo* aOpenWindowInfo,
uint32_t aChromeFlags, bool aCalledFromJS, nsIURI* aURI, uint32_t aChromeFlags, bool aCalledFromJS, nsIURI* aURI,
const nsAString& aName, const nsACString& aFeatures, bool aForceNoOpener, const nsAString& aName, const nsACString& aFeatures, bool aForceNoOpener,
bool aForceNoReferrer, bool aIsPopupRequested, bool aForceNoReferrer, bool aIsPopupRequested,

View file

@ -74,7 +74,8 @@ nsresult TCPServerSocketParent::SendCallbackAccept(TCPSocketParent* socket) {
// successfully, otherwise |socket| could be leaked. // successfully, otherwise |socket| could be leaked.
socket->AddIPDLReference(); socket->AddIPDLReference();
mozilla::Unused << PTCPServerSocketParent::SendCallbackAccept(socket); mozilla::Unused << PTCPServerSocketParent::SendCallbackAccept(
WrapNotNull(socket));
} else { } else {
NS_ERROR("Sending data from PTCPSocketParent was failed."); NS_ERROR("Sending data from PTCPSocketParent was failed.");
} }

View file

@ -53,7 +53,7 @@ WebBrowserPersistResourcesChild::VisitDocument(
// state that causes a document's parent actor to be exposed to // state that causes a document's parent actor to be exposed to
// XPCOM (for both parent->child and child->parent construction), // XPCOM (for both parent->child and child->parent construction),
// which simplifies the lifetime management. // which simplifies the lifetime management.
SendVisitDocument(subActor); SendVisitDocument(WrapNotNull(subActor));
subActor->Start(aSubDocument); subActor->Start(aSubDocument);
return NS_OK; return NS_OK;
} }

View file

@ -56,10 +56,11 @@ mozilla::ipc::IPCResult WebBrowserPersistResourcesParent::RecvVisitResource(
} }
mozilla::ipc::IPCResult WebBrowserPersistResourcesParent::RecvVisitDocument( mozilla::ipc::IPCResult WebBrowserPersistResourcesParent::RecvVisitDocument(
PWebBrowserPersistDocumentParent* aSubDocument) { NotNull<PWebBrowserPersistDocumentParent*> aSubDocument) {
// Don't expose the subdocument to the visitor until it's ready // Don't expose the subdocument to the visitor until it's ready
// (until the actor isn't in START state). // (until the actor isn't in START state).
static_cast<WebBrowserPersistDocumentParent*>(aSubDocument)->SetOnReady(this); static_cast<WebBrowserPersistDocumentParent*>(aSubDocument.get())
->SetOnReady(this);
return IPC_OK(); return IPC_OK();
} }

View file

@ -28,7 +28,7 @@ class WebBrowserPersistResourcesParent final
const nsContentPolicyType& aContentPolicyType) override; const nsContentPolicyType& aContentPolicyType) override;
virtual mozilla::ipc::IPCResult RecvVisitDocument( virtual mozilla::ipc::IPCResult RecvVisitDocument(
PWebBrowserPersistDocumentParent* aSubDocument) override; NotNull<PWebBrowserPersistDocumentParent*> aSubDocument) override;
virtual mozilla::ipc::IPCResult RecvVisitBrowsingContext( virtual mozilla::ipc::IPCResult RecvVisitBrowsingContext(
const dom::MaybeDiscarded<dom::BrowsingContext>& aContext) override; const dom::MaybeDiscarded<dom::BrowsingContext>& aContext) override;

View file

@ -108,9 +108,9 @@ void ImageBridgeChild::UseTextures(
bool readLocked = t.mTextureClient->OnForwardedToHost(); bool readLocked = t.mTextureClient->OnForwardedToHost();
textures.AppendElement(TimedTexture(t.mTextureClient->GetIPDLActor(), textures.AppendElement(TimedTexture(
t.mTimeStamp, t.mPictureRect, WrapNotNull(t.mTextureClient->GetIPDLActor()), t.mTimeStamp,
t.mFrameID, t.mProducerID, readLocked)); t.mPictureRect, t.mFrameID, t.mProducerID, readLocked));
// Wait end of usage on host side if TextureFlags::RECYCLE is set // Wait end of usage on host side if TextureFlags::RECYCLE is set
HoldUntilCompositableRefReleasedIfNecessary(t.mTextureClient); HoldUntilCompositableRefReleasedIfNecessary(t.mTextureClient);
@ -853,7 +853,7 @@ static bool IBCAddOpDestroy(CompositableTransaction* aTxn,
} }
bool ImageBridgeChild::DestroyInTransaction(PTextureChild* aTexture) { bool ImageBridgeChild::DestroyInTransaction(PTextureChild* aTexture) {
return IBCAddOpDestroy(mTxn, OpDestroy(aTexture)); return IBCAddOpDestroy(mTxn, OpDestroy(WrapNotNull(aTexture)));
} }
bool ImageBridgeChild::DestroyInTransaction(const CompositableHandle& aHandle) { bool ImageBridgeChild::DestroyInTransaction(const CompositableHandle& aHandle) {
@ -871,9 +871,9 @@ void ImageBridgeChild::RemoveTextureFromCompositable(
return; return;
} }
mTxn->AddNoSwapEdit( mTxn->AddNoSwapEdit(CompositableOperation(
CompositableOperation(aCompositable->GetIPCHandle(), aCompositable->GetIPCHandle(),
OpRemoveTexture(aTexture->GetIPDLActor()))); OpRemoveTexture(WrapNotNull(aTexture->GetIPDLActor()))));
} }
bool ImageBridgeChild::IsSameProcess() const { bool ImageBridgeChild::IsSameProcess() const {

View file

@ -350,7 +350,7 @@ void IpcResourceUpdateQueue::PushExternalImageForTexture(
MOZ_RELEASE_ASSERT(aTexture->GetIPDLActor()->GetIPCChannel() == MOZ_RELEASE_ASSERT(aTexture->GetIPDLActor()->GetIPCChannel() ==
mWriter.WrBridge()->GetIPCChannel()); mWriter.WrBridge()->GetIPCChannel());
mUpdates.AppendElement(layers::OpPushExternalImageForTexture( mUpdates.AppendElement(layers::OpPushExternalImageForTexture(
aExtId, aKey, aTexture->GetIPDLActor(), aIsUpdate)); aExtId, aKey, WrapNotNull(aTexture->GetIPDLActor()), aIsUpdate));
} }
bool IpcResourceUpdateQueue::UpdateImageBuffer( bool IpcResourceUpdateQueue::UpdateImageBuffer(

View file

@ -391,7 +391,7 @@ void WebRenderBridgeChild::ReleaseCompositable(
} }
bool WebRenderBridgeChild::DestroyInTransaction(PTextureChild* aTexture) { bool WebRenderBridgeChild::DestroyInTransaction(PTextureChild* aTexture) {
return AddOpDestroy(OpDestroy(aTexture)); return AddOpDestroy(OpDestroy(WrapNotNull(aTexture)));
} }
bool WebRenderBridgeChild::DestroyInTransaction( bool WebRenderBridgeChild::DestroyInTransaction(
@ -411,9 +411,9 @@ void WebRenderBridgeChild::RemoveTextureFromCompositable(
return; return;
} }
AddWebRenderParentCommand( AddWebRenderParentCommand(CompositableOperation(
CompositableOperation(aCompositable->GetIPCHandle(), aCompositable->GetIPCHandle(),
OpRemoveTexture(aTexture->GetIPDLActor()))); OpRemoveTexture(WrapNotNull(aTexture->GetIPDLActor()))));
} }
void WebRenderBridgeChild::UseTextures( void WebRenderBridgeChild::UseTextures(
@ -434,9 +434,9 @@ void WebRenderBridgeChild::UseTextures(
GetIPCChannel()); GetIPCChannel());
bool readLocked = t.mTextureClient->OnForwardedToHost(); bool readLocked = t.mTextureClient->OnForwardedToHost();
textures.AppendElement(TimedTexture(t.mTextureClient->GetIPDLActor(), textures.AppendElement(TimedTexture(
t.mTimeStamp, t.mPictureRect, WrapNotNull(t.mTextureClient->GetIPDLActor()), t.mTimeStamp,
t.mFrameID, t.mProducerID, readLocked)); t.mPictureRect, t.mFrameID, t.mProducerID, readLocked));
GetCompositorBridgeChild()->HoldUntilCompositableRefReleasedIfNecessary( GetCompositorBridgeChild()->HoldUntilCompositableRefReleasedIfNecessary(
t.mTextureClient); t.mTextureClient);
} }

View file

@ -1691,7 +1691,7 @@ void WebRenderBridgeParent::MaybeCaptureScreenPixels() {
#endif #endif
mozilla::ipc::IPCResult WebRenderBridgeParent::RecvGetSnapshot( mozilla::ipc::IPCResult WebRenderBridgeParent::RecvGetSnapshot(
PTextureParent* aTexture, bool* aNeedsYFlip) { NotNull<PTextureParent*> aTexture, bool* aNeedsYFlip) {
*aNeedsYFlip = false; *aNeedsYFlip = false;
CompositorBridgeParent* cbp = GetRootCompositorBridgeParent(); CompositorBridgeParent* cbp = GetRootCompositorBridgeParent();
if (mDestroyed || !cbp || cbp->IsPaused()) { if (mDestroyed || !cbp || cbp->IsPaused()) {

View file

@ -135,7 +135,7 @@ class WebRenderBridgeParent final : public PWebRenderBridgeParent,
mozilla::ipc::IPCResult RecvParentCommands( mozilla::ipc::IPCResult RecvParentCommands(
const wr::IdNamespace& aIdNamespace, const wr::IdNamespace& aIdNamespace,
nsTArray<WebRenderParentCommand>&& commands) override; nsTArray<WebRenderParentCommand>&& commands) override;
mozilla::ipc::IPCResult RecvGetSnapshot(PTextureParent* aTexture, mozilla::ipc::IPCResult RecvGetSnapshot(NotNull<PTextureParent*> aTexture,
bool* aNeedsYFlip) override; bool* aNeedsYFlip) override;
mozilla::ipc::IPCResult RecvSetLayersObserverEpoch( mozilla::ipc::IPCResult RecvSetLayersObserverEpoch(

View file

@ -529,7 +529,8 @@ void WebRenderLayerManager::MakeSnapshotIfRequired(LayoutDeviceIntSize aSize) {
IntRect bounds = ToOutsideIntRect(mTarget->GetClipExtents()); IntRect bounds = ToOutsideIntRect(mTarget->GetClipExtents());
bool needsYFlip = false; bool needsYFlip = false;
if (!WrBridge()->SendGetSnapshot(texture->GetIPDLActor(), &needsYFlip)) { if (!WrBridge()->SendGetSnapshot(WrapNotNull(texture->GetIPDLActor()),
&needsYFlip)) {
return; return;
} }

View file

@ -40,8 +40,9 @@ void Vibrate(const nsTArray<uint32_t>& pattern, WindowIdentifier&& id) {
WindowIdentifier newID(std::move(id)); WindowIdentifier newID(std::move(id));
newID.AppendProcessID(); newID.AppendProcessID();
Hal()->SendVibrate(pattern, newID.AsArray(), if (BrowserChild* bc = BrowserChild::GetFrom(newID.GetWindow())) {
BrowserChild::GetFrom(newID.GetWindow())); Hal()->SendVibrate(pattern, newID.AsArray(), WrapNotNull(bc));
}
} }
void CancelVibrate(WindowIdentifier&& id) { void CancelVibrate(WindowIdentifier&& id) {
@ -49,8 +50,9 @@ void CancelVibrate(WindowIdentifier&& id) {
WindowIdentifier newID(std::move(id)); WindowIdentifier newID(std::move(id));
newID.AppendProcessID(); newID.AppendProcessID();
Hal()->SendCancelVibrate(newID.AsArray(), if (BrowserChild* bc = BrowserChild::GetFrom(newID.GetWindow())) {
BrowserChild::GetFrom(newID.GetWindow())); Hal()->SendCancelVibrate(newID.AsArray(), WrapNotNull(bc));
}
} }
void EnableBatteryNotifications() { Hal()->SendEnableBatteryNotifications(); } void EnableBatteryNotifications() { Hal()->SendEnableBatteryNotifications(); }
@ -151,7 +153,7 @@ class HalParent : public PHalParent,
virtual mozilla::ipc::IPCResult RecvVibrate( virtual mozilla::ipc::IPCResult RecvVibrate(
nsTArray<unsigned int>&& pattern, nsTArray<uint64_t>&& id, nsTArray<unsigned int>&& pattern, nsTArray<uint64_t>&& id,
PBrowserParent* browserParent) override { NotNull<PBrowserParent*> browserParent) override {
// We give all content vibration permission. // We give all content vibration permission.
// BrowserParent *browserParent = BrowserParent::GetFrom(browserParent); // BrowserParent *browserParent = BrowserParent::GetFrom(browserParent);
/* xxxkhuey wtf /* xxxkhuey wtf
@ -163,7 +165,8 @@ class HalParent : public PHalParent,
} }
virtual mozilla::ipc::IPCResult RecvCancelVibrate( virtual mozilla::ipc::IPCResult RecvCancelVibrate(
nsTArray<uint64_t>&& id, PBrowserParent* browserParent) override { nsTArray<uint64_t>&& id,
NotNull<PBrowserParent*> browserParent) override {
// BrowserParent *browserParent = BrowserParent::GetFrom(browserParent); // BrowserParent *browserParent = BrowserParent::GetFrom(browserParent);
/* XXXkhuey wtf /* XXXkhuey wtf
nsCOMPtr<nsIDOMWindow> window = nsCOMPtr<nsIDOMWindow> window =

View file

@ -2549,7 +2549,7 @@ HttpChannelChild::OpenAlternativeOutputStream(const nsACString& aType,
stream->AddIPDLReference(); stream->AddIPDLReference();
if (!gNeckoChild->SendPAltDataOutputStreamConstructor( if (!gNeckoChild->SendPAltDataOutputStreamConstructor(
stream, nsCString(aType), aPredictedSize, this)) { stream, nsCString(aType), aPredictedSize, WrapNotNull(this))) {
return NS_ERROR_FAILURE; return NS_ERROR_FAILURE;
} }

View file

@ -148,7 +148,8 @@ nsresult HttpConnectionMgrParent::AddTransaction(HttpTransactionShell* aTrans,
return NS_ERROR_NOT_AVAILABLE; return NS_ERROR_NOT_AVAILABLE;
} }
Unused << SendAddTransaction(aTrans->AsHttpTransactionParent(), aPriority); Unused << SendAddTransaction(WrapNotNull(aTrans->AsHttpTransactionParent()),
aPriority);
return NS_OK; return NS_OK;
} }
@ -162,8 +163,8 @@ nsresult HttpConnectionMgrParent::AddTransactionWithStickyConn(
} }
Unused << SendAddTransactionWithStickyConn( Unused << SendAddTransactionWithStickyConn(
aTrans->AsHttpTransactionParent(), aPriority, WrapNotNull(aTrans->AsHttpTransactionParent()), aPriority,
aTransWithStickyConn->AsHttpTransactionParent()); WrapNotNull(aTransWithStickyConn->AsHttpTransactionParent()));
return NS_OK; return NS_OK;
} }
@ -175,8 +176,8 @@ nsresult HttpConnectionMgrParent::RescheduleTransaction(
return NS_ERROR_NOT_AVAILABLE; return NS_ERROR_NOT_AVAILABLE;
} }
Unused << SendRescheduleTransaction(aTrans->AsHttpTransactionParent(), Unused << SendRescheduleTransaction(
aPriority); WrapNotNull(aTrans->AsHttpTransactionParent()), aPriority);
return NS_OK; return NS_OK;
} }
@ -189,7 +190,7 @@ void HttpConnectionMgrParent::UpdateClassOfServiceOnTransaction(
} }
Unused << SendUpdateClassOfServiceOnTransaction( Unused << SendUpdateClassOfServiceOnTransaction(
aTrans->AsHttpTransactionParent(), aClassOfService); WrapNotNull(aTrans->AsHttpTransactionParent()), aClassOfService);
} }
nsresult HttpConnectionMgrParent::CancelTransaction( nsresult HttpConnectionMgrParent::CancelTransaction(
@ -200,7 +201,8 @@ nsresult HttpConnectionMgrParent::CancelTransaction(
return NS_ERROR_NOT_AVAILABLE; return NS_ERROR_NOT_AVAILABLE;
} }
Unused << SendCancelTransaction(aTrans->AsHttpTransactionParent(), aReason); Unused << SendCancelTransaction(
WrapNotNull(aTrans->AsHttpTransactionParent()), aReason);
return NS_OK; return NS_OK;
} }
@ -248,9 +250,9 @@ nsresult HttpConnectionMgrParent::SpeculativeConnect(
auto task = [self, connInfo{std::move(connInfo)}, auto task = [self, connInfo{std::move(connInfo)},
overriderArgs{std::move(overriderArgs)}, aCaps, overriderArgs{std::move(overriderArgs)}, aCaps,
trans{std::move(trans)}, aFetchHTTPSRR]() { trans{std::move(trans)}, aFetchHTTPSRR]() {
Maybe<AltSvcTransactionParent*> maybeTrans; Maybe<NotNull<AltSvcTransactionParent*>> maybeTrans;
if (trans) { if (trans) {
maybeTrans.emplace(trans.get()); maybeTrans.emplace(WrapNotNull(trans.get()));
} }
Unused << self->SendSpeculativeConnect(connInfo, overriderArgs, aCaps, Unused << self->SendSpeculativeConnect(connInfo, overriderArgs, aCaps,
maybeTrans, aFetchHTTPSRR); maybeTrans, aFetchHTTPSRR);
@ -301,7 +303,8 @@ nsresult HttpConnectionMgrParent::CompleteUpgrade(
// We need to link the id and the upgrade listener here, so // We need to link the id and the upgrade listener here, so
// WebSocketConnectionParent can connect to the listener correctly later. // WebSocketConnectionParent can connect to the listener correctly later.
uint32_t id = AddHttpUpgradeListenerToMap(aUpgradeListener); uint32_t id = AddHttpUpgradeListenerToMap(aUpgradeListener);
Unused << SendStartWebSocketConnection(aTrans->AsHttpTransactionParent(), id); Unused << SendStartWebSocketConnection(
WrapNotNull(aTrans->AsHttpTransactionParent()), id);
return NS_OK; return NS_OK;
} }

View file

@ -109,7 +109,7 @@ nsresult HttpTransactionChild::InitInternal(
uint32_t pushedStreamId = 0; uint32_t pushedStreamId = 0;
if (aPushedStreamArg) { if (aPushedStreamArg) {
HttpTransactionChild* transChild = static_cast<HttpTransactionChild*>( HttpTransactionChild* transChild = static_cast<HttpTransactionChild*>(
aPushedStreamArg.ref().transWithPushedStream().AsChild()); aPushedStreamArg.ref().transWithPushedStream().AsChild().get());
transWithPushedStream = transChild->GetHttpTransaction(); transWithPushedStream = transChild->GetHttpTransaction();
pushedStreamId = aPushedStreamArg.ref().pushedStreamId(); pushedStreamId = aPushedStreamArg.ref().pushedStreamId();
} }

View file

@ -123,14 +123,13 @@ nsresult HttpTransactionParent::Init(
Maybe<H2PushedStreamArg> pushedStreamArg; Maybe<H2PushedStreamArg> pushedStreamArg;
if (aTransWithPushedStream && aPushedStreamId) { if (aTransWithPushedStream && aPushedStreamId) {
MOZ_ASSERT(aTransWithPushedStream->AsHttpTransactionParent()); MOZ_ASSERT(aTransWithPushedStream->AsHttpTransactionParent());
pushedStreamArg.emplace(); pushedStreamArg.emplace(
pushedStreamArg.ref().transWithPushedStream() = WrapNotNull(aTransWithPushedStream->AsHttpTransactionParent()),
aTransWithPushedStream->AsHttpTransactionParent(); aPushedStreamId);
pushedStreamArg.ref().pushedStreamId() = aPushedStreamId;
} }
nsCOMPtr<nsIThrottledInputChannel> throttled = do_QueryInterface(mEventsink); nsCOMPtr<nsIThrottledInputChannel> throttled = do_QueryInterface(mEventsink);
Maybe<PInputChannelThrottleQueueParent*> throttleQueue; Maybe<NotNull<PInputChannelThrottleQueueParent*>> throttleQueue;
if (throttled) { if (throttled) {
nsCOMPtr<nsIInputChannelThrottleQueue> queue; nsCOMPtr<nsIInputChannelThrottleQueue> queue;
nsresult rv = throttled->GetThrottleQueue(getter_AddRefs(queue)); nsresult rv = throttled->GetThrottleQueue(getter_AddRefs(queue));
@ -140,7 +139,7 @@ nsresult HttpTransactionParent::Init(
queue.get())); queue.get()));
RefPtr<InputChannelThrottleQueueParent> tqParent = do_QueryObject(queue); RefPtr<InputChannelThrottleQueueParent> tqParent = do_QueryObject(queue);
MOZ_ASSERT(tqParent); MOZ_ASSERT(tqParent);
throttleQueue.emplace(tqParent.get()); throttleQueue.emplace(WrapNotNull(tqParent.get()));
} }
} }

View file

@ -495,7 +495,7 @@ WebSocketChannelChild::AsyncOpenNative(
nsCOMPtr<nsIURI> uri; nsCOMPtr<nsIURI> uri;
Maybe<LoadInfoArgs> loadInfoArgs; Maybe<LoadInfoArgs> loadInfoArgs;
Maybe<PTransportProviderChild*> transportProvider; Maybe<NotNull<PTransportProviderChild*>> transportProvider;
if (!mIsServerSide) { if (!mIsServerSide) {
uri = aURI; uri = aURI;
@ -509,7 +509,7 @@ WebSocketChannelChild::AsyncOpenNative(
nsresult rv = mServerTransportProvider->GetIPCChild(&ipcChild); nsresult rv = mServerTransportProvider->GetIPCChild(&ipcChild);
NS_ENSURE_SUCCESS(rv, rv); NS_ENSURE_SUCCESS(rv, rv);
transportProvider = Some(ipcChild); transportProvider = Some(WrapNotNull(ipcChild));
} }
// This must be called before sending constructor message. // This must be called before sending constructor message.