diff --git a/dom/ipc/ContentChild.cpp b/dom/ipc/ContentChild.cpp index 4da2b4955868..23ce0d29287d 100644 --- a/dom/ipc/ContentChild.cpp +++ b/dom/ipc/ContentChild.cpp @@ -50,7 +50,6 @@ #include "mozilla/dom/RemoteWorkerService.h" #include "mozilla/dom/ServiceWorkerManager.h" #include "mozilla/dom/TabGroup.h" -#include "mozilla/dom/nsIContentChild.h" #include "mozilla/dom/URLClassifierChild.h" #include "mozilla/dom/WorkerDebugger.h" #include "mozilla/dom/WorkerDebuggerManager.h" @@ -583,9 +582,8 @@ ContentChild::~ContentChild() { #endif NS_INTERFACE_MAP_BEGIN(ContentChild) - NS_INTERFACE_MAP_ENTRY(nsIContentChild) NS_INTERFACE_MAP_ENTRY(nsIWindowProvider) - NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIContentChild) + NS_INTERFACE_MAP_ENTRY(nsISupports) NS_INTERFACE_MAP_END mozilla::ipc::IPCResult ContentChild::RecvSetXPCOMProcessAttributes( @@ -2836,8 +2834,7 @@ void ContentChild::StartForceKillTimer() { mozilla::ipc::IPCResult ContentChild::RecvShutdown() { nsCOMPtr os = services::GetObserverService(); if (os) { - os->NotifyObservers(static_cast(this), - "content-child-will-shutdown", nullptr); + os->NotifyObservers(this, "content-child-will-shutdown", nullptr); } ShutdownInternal(); @@ -2884,8 +2881,7 @@ void ContentChild::ShutdownInternal() { nsCOMPtr os = services::GetObserverService(); if (os) { - os->NotifyObservers(static_cast(this), - "content-child-shutdown", nullptr); + os->NotifyObservers(this, "content-child-shutdown", nullptr); } #if defined(XP_WIN) diff --git a/dom/ipc/ContentChild.h b/dom/ipc/ContentChild.h index 8f92c6ed1762..affc447b234f 100644 --- a/dom/ipc/ContentChild.h +++ b/dom/ipc/ContentChild.h @@ -9,14 +9,18 @@ #include "mozilla/Atomics.h" #include "mozilla/Attributes.h" -#include "mozilla/dom/nsIContentChild.h" #include "mozilla/dom/PBrowserOrId.h" #include "mozilla/dom/PContentChild.h" +#include "mozilla/dom/CPOWManagerGetter.h" #include "mozilla/StaticPtr.h" +#include "mozilla/ipc/Shmem.h" +#include "mozilla/jsipc/CrossProcessObjectWrappers.h" #include "nsAutoPtr.h" #include "nsHashKeys.h" #include "nsIObserver.h" #include "nsTHashtable.h" +#include "nsStringFwd.h" +#include "nsTArrayForwardDeclare.h" #include "nsRefPtrHashtable.h" #include "nsIWindowProvider.h" @@ -77,7 +81,8 @@ class FileCreatorHelper; class ContentChild final : public PContentChild, public nsIWindowProvider, - public nsIContentChild { + public CPOWManagerGetter, + public mozilla::ipc::IShmemAllocator { typedef mozilla::dom::ClonedMessageData ClonedMessageData; typedef mozilla::ipc::FileDescriptor FileDescriptor; typedef mozilla::ipc::OptionalURIParams OptionalURIParams; diff --git a/dom/ipc/ContentParent.cpp b/dom/ipc/ContentParent.cpp index 2fd18c305e0a..b66e62f260eb 100644 --- a/dom/ipc/ContentParent.cpp +++ b/dom/ipc/ContentParent.cpp @@ -451,7 +451,7 @@ ContentParentsMemoryReporter::CollectReports( "queued-ipc-messages/content-parent" "(%s, pid=%d, %s, 0x%p, refcnt=%" PRIuPTR ")", NS_ConvertUTF16toUTF8(friendlyName).get(), cp->Pid(), channelStr, - static_cast(cp), refcnt); + static_cast(cp), refcnt); NS_NAMED_LITERAL_CSTRING( desc, @@ -2224,8 +2224,7 @@ ContentParent::ContentParent(ContentParent* aOpener, RecordReplayState aRecordReplayState, const nsAString& aRecordingFile, int32_t aJSPluginID) - : nsIContentParent(), - mSelfRef(nullptr), + : mSelfRef(nullptr), mSubprocess(nullptr), mLaunchTS(TimeStamp::Now()), mLaunchYieldTS(mLaunchTS), @@ -2912,7 +2911,7 @@ NS_IMPL_CYCLE_COLLECTING_ADDREF(ContentParent) NS_IMPL_CYCLE_COLLECTING_RELEASE(ContentParent) NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(ContentParent) - NS_INTERFACE_MAP_ENTRY(nsIContentParent) + NS_INTERFACE_MAP_ENTRY_CONCRETE(ContentParent) NS_INTERFACE_MAP_ENTRY(nsIObserver) NS_INTERFACE_MAP_ENTRY(nsIDOMGeoPositionCallback) NS_INTERFACE_MAP_ENTRY(nsIDOMGeoPositionErrorCallback) diff --git a/dom/ipc/ContentParent.h b/dom/ipc/ContentParent.h index 5b84899d9fb5..e491de5cc013 100644 --- a/dom/ipc/ContentParent.h +++ b/dom/ipc/ContentParent.h @@ -8,11 +8,14 @@ #define mozilla_dom_ContentParent_h #include "mozilla/dom/PContentParent.h" -#include "mozilla/dom/nsIContentParent.h" +#include "mozilla/dom/CPOWManagerGetter.h" +#include "mozilla/dom/ipc/IdType.h" #include "mozilla/gfx/gfxVarReceiver.h" #include "mozilla/gfx/GPUProcessListener.h" #include "mozilla/ipc/BackgroundUtils.h" #include "mozilla/ipc/GeckoChildProcessHost.h" +#include "mozilla/ipc/PParentToChildStreamParent.h" +#include "mozilla/ipc/PChildToParentStreamParent.h" #include "mozilla/Attributes.h" #include "mozilla/FileUtils.h" #include "mozilla/HalTypes.h" @@ -89,6 +92,7 @@ class ProtocolFuzzerHelper; namespace jsipc { class PJavaScriptParent; +class CpowEntry; } // namespace jsipc namespace layers { @@ -106,8 +110,14 @@ class TabContext; class GetFilesHelper; class MemoryReportRequestHost; +#define NS_CONTENTPARENT_IID \ + { \ + 0xeeec9ebf, 0x8ecf, 0x4e38, { \ + 0x81, 0xda, 0xb7, 0x34, 0x13, 0x7e, 0xac, 0xf3 \ + } \ + } + class ContentParent final : public PContentParent, - public nsIContentParent, public nsIObserver, public nsIDOMGeoPositionCallback, public nsIDOMGeoPositionErrorCallback, @@ -115,7 +125,10 @@ class ContentParent final : public PContentParent, public gfx::gfxVarReceiver, public mozilla::LinkedListElement, public gfx::GPUProcessListener, - public mozilla::MemoryReportingProcess { + public mozilla::MemoryReportingProcess, + public mozilla::dom::ipc::MessageManagerCallback, + public CPOWManagerGetter, + public mozilla::ipc::IShmemAllocator { typedef mozilla::ipc::GeckoChildProcessHost GeckoChildProcessHost; typedef mozilla::ipc::OptionalURIParams OptionalURIParams; typedef mozilla::ipc::PFileDescriptorSetParent PFileDescriptorSetParent; @@ -136,6 +149,8 @@ class ContentParent final : public PContentParent, using LaunchPromise = GeckoChildProcessHost::LaunchPromise>; + NS_DECLARE_STATIC_IID_ACCESSOR(NS_CONTENTPARENT_IID) + /** * Create a subprocess suitable for use later as a content process. */ @@ -1299,6 +1314,8 @@ class ContentParent final : public PContentParent, nsTHashtable> mGroups; }; +NS_DEFINE_STATIC_IID_ACCESSOR(ContentParent, NS_CONTENTPARENT_IID) + } // namespace dom } // namespace mozilla diff --git a/dom/ipc/ProcessPriorityManager.cpp b/dom/ipc/ProcessPriorityManager.cpp index 3d4e4525a0b1..39f92d7bc3fc 100644 --- a/dom/ipc/ProcessPriorityManager.cpp +++ b/dom/ipc/ProcessPriorityManager.cpp @@ -440,10 +440,9 @@ void ProcessPriorityManagerImpl::ObserveContentParentCreated( nsISupports* aContentParent) { // Do nothing; it's sufficient to get the PPPM. But assign to nsRefPtr so we // don't leak the already_AddRefed object. - nsCOMPtr cp = do_QueryInterface(aContentParent); + RefPtr cp = do_QueryObject(aContentParent); RefPtr pppm = - GetParticularProcessPriorityManager( - static_cast(cp.get())); + GetParticularProcessPriorityManager(cp); } void ProcessPriorityManagerImpl::ObserveContentParentDestroyed( diff --git a/dom/ipc/moz.build b/dom/ipc/moz.build index 57ea51055687..b997041fb0a6 100644 --- a/dom/ipc/moz.build +++ b/dom/ipc/moz.build @@ -43,8 +43,6 @@ EXPORTS.mozilla.dom += [ 'JSWindowActorParent.h', 'JSWindowActorService.h', 'MemoryReportRequest.h', - 'nsIContentChild.h', - 'nsIContentParent.h', 'PermissionMessageUtils.h', 'RemoteFrameChild.h', 'RemoteFrameParent.h', diff --git a/dom/ipc/nsIContentChild.h b/dom/ipc/nsIContentChild.h deleted file mode 100644 index dacd65d78d71..000000000000 --- a/dom/ipc/nsIContentChild.h +++ /dev/null @@ -1,64 +0,0 @@ -/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* vim: set ts=8 sts=2 et sw=2 tw=80: */ -/* This Source Code Form is subject to the terms of the Mozilla Public - * 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/. */ - -#ifndef mozilla_dom_nsIContentChild_h -#define mozilla_dom_nsIContentChild_h - -#include "mozilla/dom/ipc/IdType.h" - -#include "nsISupports.h" -#include "nsStringFwd.h" -#include "nsTArrayForwardDeclare.h" -#include "mozilla/dom/CPOWManagerGetter.h" -#include "mozilla/ipc/Shmem.h" -#include "mozilla/jsipc/CrossProcessObjectWrappers.h" - -#define NS_ICONTENTCHILD_IID \ - { \ - 0x4eed2e73, 0x94ba, 0x48a8, { \ - 0xa2, 0xd1, 0xa5, 0xed, 0x86, 0xd7, 0xbb, 0xe4 \ - } \ - } - -namespace IPC { -class Principal; -} // namespace IPC - -namespace mozilla { -namespace ipc { -class FileDescriptor; -class PChildToParentStreamChild; -class PParentToChildStreamChild; -class Shmem; -} // namespace ipc - -namespace jsipc { -class PJavaScriptChild; -class CpowEntry; -} // namespace jsipc - -namespace dom { - -class Blob; -class BlobImpl; -class BlobConstructorParams; -class ClonedMessageData; -class IPCTabContext; -class PBrowserChild; - -class nsIContentChild : public nsISupports, - public CPOWManagerGetter, - public mozilla::ipc::IShmemAllocator { - public: - NS_DECLARE_STATIC_IID_ACCESSOR(NS_ICONTENTCHILD_IID) -}; - -NS_DEFINE_STATIC_IID_ACCESSOR(nsIContentChild, NS_ICONTENTCHILD_IID) - -} // namespace dom -} // namespace mozilla - -#endif /* mozilla_dom_nsIContentChild_h */ diff --git a/dom/ipc/nsIContentParent.h b/dom/ipc/nsIContentParent.h deleted file mode 100644 index e94323d54b06..000000000000 --- a/dom/ipc/nsIContentParent.h +++ /dev/null @@ -1,67 +0,0 @@ -/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* vim: set ts=8 sts=2 et sw=2 tw=80: */ -/* This Source Code Form is subject to the terms of the Mozilla Public - * 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/. */ - -#ifndef mozilla_dom_nsIContentParent_h -#define mozilla_dom_nsIContentParent_h - -#include "mozilla/Attributes.h" -#include "mozilla/dom/ipc/IdType.h" -#include "mozilla/ipc/ProtocolUtils.h" -#include "mozilla/ipc/PChildToParentStreamParent.h" -#include "mozilla/ipc/PParentToChildStreamParent.h" - -#include "nsFrameMessageManager.h" -#include "nsISupports.h" -#include "mozilla/dom/CPOWManagerGetter.h" - -#define NS_ICONTENTPARENT_IID \ - { \ - 0xeeec9ebf, 0x8ecf, 0x4e38, { \ - 0x81, 0xda, 0xb7, 0x34, 0x13, 0x7e, 0xac, 0xf3 \ - } \ - } - -namespace IPC { -class Principal; -} // namespace IPC - -namespace mozilla { - -namespace jsipc { -class PJavaScriptParent; -class CpowEntry; -} // namespace jsipc - -namespace ipc { -class PChildToParentStreamParent; -class PParentToChildStreamParent; -class PIPCBlobInputStreamParent; -} // namespace ipc - -namespace dom { - -class Blob; -class BlobConstructorParams; -class BlobImpl; -class ProcessMessageManager; -class ContentParent; -class IPCTabContext; -class PBrowserParent; - -class nsIContentParent : public nsISupports, - public mozilla::dom::ipc::MessageManagerCallback, - public CPOWManagerGetter, - public mozilla::ipc::IShmemAllocator { - public: - NS_DECLARE_STATIC_IID_ACCESSOR(NS_ICONTENTPARENT_IID) -}; - -NS_DEFINE_STATIC_IID_ACCESSOR(nsIContentParent, NS_ICONTENTPARENT_IID) - -} // namespace dom -} // namespace mozilla - -#endif /* mozilla_dom_nsIContentParent_h */ diff --git a/ipc/chromium/src/chrome/common/ipc_message_utils.h b/ipc/chromium/src/chrome/common/ipc_message_utils.h index 32a4e64f67a1..ae5ab0ead8d7 100644 --- a/ipc/chromium/src/chrome/common/ipc_message_utils.h +++ b/ipc/chromium/src/chrome/common/ipc_message_utils.h @@ -19,6 +19,9 @@ #if defined(OS_POSIX) # include "chrome/common/file_descriptor_set_posix.h" #endif +#if defined(OS_WIN) +# include "windows.h" +#endif #include "chrome/common/ipc_message.h" template