mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-28 15:23:51 +00:00
Bug 1596409 - P1.1: Make socket process support IPCStream r=dragana
Differential Revision: https://phabricator.services.mozilla.com/D54289 --HG-- extra : moz-landing-system : lando
This commit is contained in:
parent
a36959414d
commit
f3bddbd52b
@ -53,28 +53,14 @@ class TemporaryFileInputStream final : public nsFileInputStream {
|
||||
void Serialize(InputStreamParams& aParams,
|
||||
FileDescriptorArray& aFileDescriptors, bool aDelayedStart,
|
||||
uint32_t aMaxSize, uint32_t* aSizeUsed,
|
||||
ContentChild* aManager) override {
|
||||
ParentToChildStreamActorManager* aManager) override {
|
||||
MOZ_CRASH("This inputStream cannot be serialized.");
|
||||
}
|
||||
|
||||
void Serialize(InputStreamParams& aParams,
|
||||
FileDescriptorArray& aFileDescriptors, bool aDelayedStart,
|
||||
uint32_t aMaxSize, uint32_t* aSizeUsed,
|
||||
PBackgroundChild* aManager) override {
|
||||
MOZ_CRASH("This inputStream cannot be serialized.");
|
||||
}
|
||||
|
||||
void Serialize(InputStreamParams& aParams,
|
||||
FileDescriptorArray& aFileDescriptors, bool aDelayedStart,
|
||||
uint32_t aMaxSize, uint32_t* aSizeUsed,
|
||||
ContentParent* aManager) override {
|
||||
MOZ_CRASH("This inputStream cannot be serialized.");
|
||||
}
|
||||
|
||||
void Serialize(InputStreamParams& aParams,
|
||||
FileDescriptorArray& aFileDescriptors, bool aDelayedStart,
|
||||
uint32_t aMaxSize, uint32_t* aSizeUsed,
|
||||
PBackgroundParent* aManager) override {
|
||||
ChildToParentStreamActorManager* aManager) override {
|
||||
MOZ_CRASH("This inputStream cannot be serialized.");
|
||||
}
|
||||
|
||||
|
@ -563,44 +563,22 @@ IPCBlobInputStream::OnInputStreamReady(nsIAsyncInputStream* aStream) {
|
||||
|
||||
// nsIIPCSerializableInputStream
|
||||
|
||||
void IPCBlobInputStream::Serialize(mozilla::ipc::InputStreamParams& aParams,
|
||||
FileDescriptorArray& aFileDescriptors,
|
||||
bool aDelayedStart, uint32_t aMaxSize,
|
||||
uint32_t* aSizeUsed,
|
||||
ContentChild* aManager) {
|
||||
void IPCBlobInputStream::Serialize(
|
||||
mozilla::ipc::InputStreamParams& aParams,
|
||||
FileDescriptorArray& aFileDescriptors, bool aDelayedStart,
|
||||
uint32_t aMaxSize, uint32_t* aSizeUsed,
|
||||
mozilla::ipc::ParentToChildStreamActorManager* aManager) {
|
||||
MOZ_ASSERT(aSizeUsed);
|
||||
*aSizeUsed = 0;
|
||||
|
||||
SerializeInternal(aParams);
|
||||
}
|
||||
|
||||
void IPCBlobInputStream::Serialize(mozilla::ipc::InputStreamParams& aParams,
|
||||
FileDescriptorArray& aFileDescriptors,
|
||||
bool aDelayedStart, uint32_t aMaxSize,
|
||||
uint32_t* aSizeUsed,
|
||||
mozilla::ipc::PBackgroundChild* aManager) {
|
||||
MOZ_ASSERT(aSizeUsed);
|
||||
*aSizeUsed = 0;
|
||||
|
||||
SerializeInternal(aParams);
|
||||
}
|
||||
|
||||
void IPCBlobInputStream::Serialize(mozilla::ipc::InputStreamParams& aParams,
|
||||
FileDescriptorArray& aFileDescriptors,
|
||||
bool aDelayedStart, uint32_t aMaxSize,
|
||||
uint32_t* aSizeUsed,
|
||||
ContentParent* aManager) {
|
||||
MOZ_ASSERT(aSizeUsed);
|
||||
*aSizeUsed = 0;
|
||||
|
||||
SerializeInternal(aParams);
|
||||
}
|
||||
|
||||
void IPCBlobInputStream::Serialize(mozilla::ipc::InputStreamParams& aParams,
|
||||
FileDescriptorArray& aFileDescriptors,
|
||||
bool aDelayedStart, uint32_t aMaxSize,
|
||||
uint32_t* aSizeUsed,
|
||||
mozilla::ipc::PBackgroundParent* aManager) {
|
||||
void IPCBlobInputStream::Serialize(
|
||||
mozilla::ipc::InputStreamParams& aParams,
|
||||
FileDescriptorArray& aFileDescriptors, bool aDelayedStart,
|
||||
uint32_t aMaxSize, uint32_t* aSizeUsed,
|
||||
mozilla::ipc::ChildToParentStreamActorManager* aManager) {
|
||||
MOZ_ASSERT(aSizeUsed);
|
||||
*aSizeUsed = 0;
|
||||
|
||||
|
@ -271,23 +271,8 @@ StreamWrapper::IsNonBlocking(bool* _retval) {
|
||||
void StreamWrapper::Serialize(InputStreamParams& aParams,
|
||||
FileDescriptorArray& aFileDescriptors,
|
||||
bool aDelayedStart, uint32_t aMaxSize,
|
||||
uint32_t* aSizeUsed, ContentChild* aManager) {
|
||||
SerializeInternal(aParams, aFileDescriptors, aDelayedStart, aMaxSize,
|
||||
aSizeUsed, aManager);
|
||||
}
|
||||
|
||||
void StreamWrapper::Serialize(InputStreamParams& aParams,
|
||||
FileDescriptorArray& aFileDescriptors,
|
||||
bool aDelayedStart, uint32_t aMaxSize,
|
||||
uint32_t* aSizeUsed, PBackgroundChild* aManager) {
|
||||
SerializeInternal(aParams, aFileDescriptors, aDelayedStart, aMaxSize,
|
||||
aSizeUsed, aManager);
|
||||
}
|
||||
|
||||
void StreamWrapper::Serialize(InputStreamParams& aParams,
|
||||
FileDescriptorArray& aFileDescriptors,
|
||||
bool aDelayedStart, uint32_t aMaxSize,
|
||||
uint32_t* aSizeUsed, ContentParent* aManager) {
|
||||
uint32_t* aSizeUsed,
|
||||
ParentToChildStreamActorManager* aManager) {
|
||||
SerializeInternal(aParams, aFileDescriptors, aDelayedStart, aMaxSize,
|
||||
aSizeUsed, aManager);
|
||||
}
|
||||
@ -296,7 +281,7 @@ void StreamWrapper::Serialize(InputStreamParams& aParams,
|
||||
FileDescriptorArray& aFileDescriptors,
|
||||
bool aDelayedStart, uint32_t aMaxSize,
|
||||
uint32_t* aSizeUsed,
|
||||
PBackgroundParent* aManager) {
|
||||
ChildToParentStreamActorManager* aManager) {
|
||||
SerializeInternal(aParams, aFileDescriptors, aDelayedStart, aMaxSize,
|
||||
aSizeUsed, aManager);
|
||||
}
|
||||
|
@ -247,7 +247,6 @@
|
||||
#include "mozilla/dom/MediaController.h"
|
||||
#include "mozilla/dom/PPresentationChild.h"
|
||||
#include "mozilla/dom/PresentationIPCService.h"
|
||||
#include "mozilla/ipc/InputStreamUtils.h"
|
||||
#include "mozilla/ipc/IPCStreamAlloc.h"
|
||||
#include "mozilla/ipc/IPCStreamDestination.h"
|
||||
#include "mozilla/ipc/IPCStreamSource.h"
|
||||
@ -1949,6 +1948,8 @@ void ContentChild::GetAvailableDictionaries(nsTArray<nsString>& aDictionaries) {
|
||||
|
||||
PFileDescriptorSetChild* ContentChild::SendPFileDescriptorSetConstructor(
|
||||
const FileDescriptor& aFD) {
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
||||
if (IsShuttingDown()) {
|
||||
return nullptr;
|
||||
}
|
||||
@ -2195,6 +2196,8 @@ bool ContentChild::DeallocPPrintingChild(PPrintingChild* printing) {
|
||||
|
||||
PChildToParentStreamChild* ContentChild::SendPChildToParentStreamConstructor(
|
||||
PChildToParentStreamChild* aActor) {
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
||||
if (IsShuttingDown()) {
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -16,6 +16,7 @@
|
||||
#include "mozilla/dom/RemoteBrowser.h"
|
||||
#include "mozilla/dom/CPOWManagerGetter.h"
|
||||
#include "mozilla/StaticPtr.h"
|
||||
#include "mozilla/ipc/InputStreamUtils.h"
|
||||
#include "mozilla/ipc/Shmem.h"
|
||||
#include "mozilla/jsipc/CrossProcessObjectWrappers.h"
|
||||
#include "nsAutoPtr.h"
|
||||
@ -76,10 +77,12 @@ class GetFilesHelperChild;
|
||||
class TabContext;
|
||||
enum class MediaControlActions : uint32_t;
|
||||
|
||||
class ContentChild final : public PContentChild,
|
||||
public nsIWindowProvider,
|
||||
public CPOWManagerGetter,
|
||||
public mozilla::ipc::IShmemAllocator {
|
||||
class ContentChild final
|
||||
: public PContentChild,
|
||||
public nsIWindowProvider,
|
||||
public CPOWManagerGetter,
|
||||
public mozilla::ipc::IShmemAllocator,
|
||||
public mozilla::ipc::ChildToParentStreamActorManager {
|
||||
typedef mozilla::dom::ClonedMessageData ClonedMessageData;
|
||||
typedef mozilla::ipc::FileDescriptor FileDescriptor;
|
||||
typedef mozilla::ipc::PFileDescriptorSetChild PFileDescriptorSetChild;
|
||||
@ -255,9 +258,6 @@ class ContentChild final : public PContentChild,
|
||||
|
||||
bool DeallocPPrintingChild(PPrintingChild*);
|
||||
|
||||
PChildToParentStreamChild* SendPChildToParentStreamConstructor(
|
||||
PChildToParentStreamChild*);
|
||||
|
||||
PChildToParentStreamChild* AllocPChildToParentStreamChild();
|
||||
bool DeallocPChildToParentStreamChild(PChildToParentStreamChild*);
|
||||
|
||||
@ -502,9 +502,6 @@ class ContentChild final : public PContentChild,
|
||||
|
||||
bool IsForBrowser() const { return mIsForBrowser; }
|
||||
|
||||
PFileDescriptorSetChild* SendPFileDescriptorSetConstructor(
|
||||
const FileDescriptor&);
|
||||
|
||||
PFileDescriptorSetChild* AllocPFileDescriptorSetChild(const FileDescriptor&);
|
||||
|
||||
bool DeallocPFileDescriptorSetChild(PFileDescriptorSetChild*);
|
||||
@ -706,6 +703,11 @@ class ContentChild final : public PContentChild,
|
||||
Endpoint<PSandboxTestingChild>&& aEndpoint);
|
||||
#endif
|
||||
|
||||
PChildToParentStreamChild* SendPChildToParentStreamConstructor(
|
||||
PChildToParentStreamChild* aActor) override;
|
||||
PFileDescriptorSetChild* SendPFileDescriptorSetConstructor(
|
||||
const FileDescriptor& aFD) override;
|
||||
|
||||
private:
|
||||
static void ForceKillTimerCallback(nsITimer* aTimer, void* aClosure);
|
||||
void StartForceKillTimer();
|
||||
|
@ -6112,6 +6112,19 @@ mozilla::ipc::IPCResult ContentParent::RecvCommitBrowsingContextTransaction(
|
||||
aTransaction.Apply(aContext);
|
||||
return IPC_OK();
|
||||
}
|
||||
|
||||
PParentToChildStreamParent* ContentParent::SendPParentToChildStreamConstructor(
|
||||
PParentToChildStreamParent* aActor) {
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
return PContentParent::SendPParentToChildStreamConstructor(aActor);
|
||||
}
|
||||
|
||||
PFileDescriptorSetParent* ContentParent::SendPFileDescriptorSetConstructor(
|
||||
const FileDescriptor& aFD) {
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
return PContentParent::SendPFileDescriptorSetConstructor(aFD);
|
||||
}
|
||||
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
|
||||
|
@ -15,6 +15,7 @@
|
||||
#include "mozilla/gfx/GPUProcessListener.h"
|
||||
#include "mozilla/ipc/BackgroundUtils.h"
|
||||
#include "mozilla/ipc/GeckoChildProcessHost.h"
|
||||
#include "mozilla/ipc/InputStreamUtils.h"
|
||||
#include "mozilla/ipc/PParentToChildStreamParent.h"
|
||||
#include "mozilla/ipc/PChildToParentStreamParent.h"
|
||||
#include "mozilla/Attributes.h"
|
||||
@ -127,18 +128,20 @@ struct CancelContentJSOptions;
|
||||
} \
|
||||
}
|
||||
|
||||
class ContentParent final : public PContentParent,
|
||||
public nsIObserver,
|
||||
public nsIDOMGeoPositionCallback,
|
||||
public nsIDOMGeoPositionErrorCallback,
|
||||
public nsIInterfaceRequestor,
|
||||
public gfx::gfxVarReceiver,
|
||||
public mozilla::LinkedListElement<ContentParent>,
|
||||
public gfx::GPUProcessListener,
|
||||
public mozilla::MemoryReportingProcess,
|
||||
public mozilla::dom::ipc::MessageManagerCallback,
|
||||
public CPOWManagerGetter,
|
||||
public mozilla::ipc::IShmemAllocator {
|
||||
class ContentParent final
|
||||
: public PContentParent,
|
||||
public nsIObserver,
|
||||
public nsIDOMGeoPositionCallback,
|
||||
public nsIDOMGeoPositionErrorCallback,
|
||||
public nsIInterfaceRequestor,
|
||||
public gfx::gfxVarReceiver,
|
||||
public mozilla::LinkedListElement<ContentParent>,
|
||||
public gfx::GPUProcessListener,
|
||||
public mozilla::MemoryReportingProcess,
|
||||
public mozilla::dom::ipc::MessageManagerCallback,
|
||||
public CPOWManagerGetter,
|
||||
public mozilla::ipc::IShmemAllocator,
|
||||
public mozilla::ipc::ParentToChildStreamActorManager {
|
||||
typedef mozilla::ipc::GeckoChildProcessHost GeckoChildProcessHost;
|
||||
typedef mozilla::ipc::PFileDescriptorSetParent PFileDescriptorSetParent;
|
||||
typedef mozilla::ipc::TestShellParent TestShellParent;
|
||||
@ -650,6 +653,11 @@ class ContentParent final : public PContentParent,
|
||||
|
||||
FORWARD_SHMEM_ALLOCATOR_TO(PContentParent)
|
||||
|
||||
PParentToChildStreamParent* SendPParentToChildStreamConstructor(
|
||||
PParentToChildStreamParent* aActor) override;
|
||||
PFileDescriptorSetParent* SendPFileDescriptorSetConstructor(
|
||||
const FileDescriptor& aFD) override;
|
||||
|
||||
protected:
|
||||
bool CheckBrowsingContextOwnership(BrowsingContext* aBC,
|
||||
const char* aOperation) const;
|
||||
|
@ -758,6 +758,17 @@ bool BackgroundChildImpl::DeallocPMediaTransportChild(
|
||||
return true;
|
||||
}
|
||||
|
||||
PChildToParentStreamChild*
|
||||
BackgroundChildImpl::SendPChildToParentStreamConstructor(
|
||||
PChildToParentStreamChild* aActor) {
|
||||
return PBackgroundChild::SendPChildToParentStreamConstructor(aActor);
|
||||
}
|
||||
|
||||
PFileDescriptorSetChild* BackgroundChildImpl::SendPFileDescriptorSetConstructor(
|
||||
const FileDescriptor& aFD) {
|
||||
return PBackgroundChild::SendPFileDescriptorSetConstructor(aFD);
|
||||
}
|
||||
|
||||
} // namespace ipc
|
||||
} // namespace mozilla
|
||||
|
||||
|
@ -8,6 +8,7 @@
|
||||
#define mozilla_ipc_backgroundchildimpl_h__
|
||||
|
||||
#include "mozilla/Attributes.h"
|
||||
#include "mozilla/ipc/InputStreamUtils.h"
|
||||
#include "mozilla/ipc/PBackgroundChild.h"
|
||||
#include "nsRefPtrHashtable.h"
|
||||
#include "nsAutoPtr.h"
|
||||
@ -28,7 +29,8 @@ namespace ipc {
|
||||
|
||||
// Instances of this class should never be created directly. This class is meant
|
||||
// to be inherited in BackgroundImpl.
|
||||
class BackgroundChildImpl : public PBackgroundChild {
|
||||
class BackgroundChildImpl : public PBackgroundChild,
|
||||
public ChildToParentStreamActorManager {
|
||||
public:
|
||||
class ThreadLocal;
|
||||
|
||||
@ -39,6 +41,11 @@ class BackgroundChildImpl : public PBackgroundChild {
|
||||
// This functions is implemented in BackgroundImpl.cpp.
|
||||
static ThreadLocal* GetThreadLocalForCurrentThread();
|
||||
|
||||
PChildToParentStreamChild* SendPChildToParentStreamConstructor(
|
||||
PChildToParentStreamChild* aActor) override;
|
||||
PFileDescriptorSetChild* SendPFileDescriptorSetConstructor(
|
||||
const FileDescriptor& aFD) override;
|
||||
|
||||
protected:
|
||||
BackgroundChildImpl();
|
||||
virtual ~BackgroundChildImpl();
|
||||
|
@ -1310,6 +1310,18 @@ bool BackgroundParentImpl::DeallocPMediaTransportParent(
|
||||
return true;
|
||||
}
|
||||
|
||||
PParentToChildStreamParent*
|
||||
BackgroundParentImpl::SendPParentToChildStreamConstructor(
|
||||
PParentToChildStreamParent* aActor) {
|
||||
return PBackgroundParent::SendPParentToChildStreamConstructor(aActor);
|
||||
}
|
||||
|
||||
PFileDescriptorSetParent*
|
||||
BackgroundParentImpl::SendPFileDescriptorSetConstructor(
|
||||
const FileDescriptor& aFD) {
|
||||
return PBackgroundParent::SendPFileDescriptorSetConstructor(aFD);
|
||||
}
|
||||
|
||||
} // namespace ipc
|
||||
} // namespace mozilla
|
||||
|
||||
|
@ -8,6 +8,7 @@
|
||||
#define mozilla_ipc_backgroundparentimpl_h__
|
||||
|
||||
#include "mozilla/Attributes.h"
|
||||
#include "mozilla/ipc/InputStreamUtils.h"
|
||||
#include "mozilla/ipc/PBackgroundParent.h"
|
||||
|
||||
namespace mozilla {
|
||||
@ -20,7 +21,14 @@ namespace ipc {
|
||||
|
||||
// Instances of this class should never be created directly. This class is meant
|
||||
// to be inherited in BackgroundImpl.
|
||||
class BackgroundParentImpl : public PBackgroundParent {
|
||||
class BackgroundParentImpl : public PBackgroundParent,
|
||||
public ParentToChildStreamActorManager {
|
||||
public:
|
||||
PParentToChildStreamParent* SendPParentToChildStreamConstructor(
|
||||
PParentToChildStreamParent* aActor) override;
|
||||
PFileDescriptorSetParent* SendPFileDescriptorSetConstructor(
|
||||
const FileDescriptor& aFD) override;
|
||||
|
||||
protected:
|
||||
BackgroundParentImpl();
|
||||
virtual ~BackgroundParentImpl();
|
||||
|
@ -20,6 +20,12 @@ class ContentChild;
|
||||
|
||||
} // namespace dom
|
||||
|
||||
namespace net {
|
||||
|
||||
class SocketProcessChild;
|
||||
|
||||
} // namespace net
|
||||
|
||||
namespace ipc {
|
||||
|
||||
class BackgroundChildImpl;
|
||||
@ -28,6 +34,7 @@ class FileDescriptor;
|
||||
class FileDescriptorSetChild final : public PFileDescriptorSetChild {
|
||||
friend class BackgroundChildImpl;
|
||||
friend class mozilla::dom::ContentChild;
|
||||
friend class mozilla::net::SocketProcessChild;
|
||||
friend class PFileDescriptorSetChild;
|
||||
|
||||
nsTArray<FileDescriptor> mFileDescriptors;
|
||||
|
@ -20,6 +20,12 @@ class ContentParent;
|
||||
|
||||
} // namespace dom
|
||||
|
||||
namespace net {
|
||||
|
||||
class SocketProcessParent;
|
||||
|
||||
} // namespace net
|
||||
|
||||
namespace ipc {
|
||||
|
||||
class BackgroundParentImpl;
|
||||
@ -28,6 +34,7 @@ class FileDescriptor;
|
||||
class FileDescriptorSetParent final : public PFileDescriptorSetParent {
|
||||
friend class BackgroundParentImpl;
|
||||
friend class mozilla::dom::ContentParent;
|
||||
friend class mozilla::net::SocketProcessParent;
|
||||
friend class PFileDescriptorSetParent;
|
||||
|
||||
nsTArray<FileDescriptor> mFileDescriptors;
|
||||
|
@ -8,8 +8,6 @@
|
||||
#include "IPCStreamSource.h"
|
||||
|
||||
#include "mozilla/Unused.h"
|
||||
#include "mozilla/dom/ContentChild.h"
|
||||
#include "mozilla/ipc/PBackgroundChild.h"
|
||||
#include "mozilla/ipc/PChildToParentStreamChild.h"
|
||||
#include "mozilla/ipc/PParentToChildStreamChild.h"
|
||||
|
||||
@ -68,29 +66,8 @@ class IPCStreamSourceChild final : public PChildToParentStreamChild,
|
||||
|
||||
/* static */
|
||||
PChildToParentStreamChild* IPCStreamSource::Create(
|
||||
nsIAsyncInputStream* aInputStream, dom::ContentChild* aManager) {
|
||||
MOZ_ASSERT(aInputStream);
|
||||
MOZ_ASSERT(aManager);
|
||||
|
||||
// PContent can only be used on the main thread
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
||||
IPCStreamSourceChild* source = IPCStreamSourceChild::Create(aInputStream);
|
||||
if (!source) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (!aManager->SendPChildToParentStreamConstructor(source)) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
source->ActorConstructed();
|
||||
return source;
|
||||
}
|
||||
|
||||
/* static */
|
||||
PChildToParentStreamChild* IPCStreamSource::Create(
|
||||
nsIAsyncInputStream* aInputStream, PBackgroundChild* aManager) {
|
||||
nsIAsyncInputStream* aInputStream,
|
||||
ChildToParentStreamActorManager* aManager) {
|
||||
MOZ_ASSERT(aInputStream);
|
||||
MOZ_ASSERT(aManager);
|
||||
|
||||
|
@ -5,8 +5,6 @@
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "IPCStreamDestination.h"
|
||||
#include "mozilla/dom/ContentParent.h"
|
||||
#include "mozilla/ipc/PBackgroundParent.h"
|
||||
#include "mozilla/ipc/PChildToParentStreamParent.h"
|
||||
#include "mozilla/ipc/PParentToChildStreamParent.h"
|
||||
#include "mozilla/Unused.h"
|
||||
@ -66,30 +64,8 @@ class IPCStreamSourceParent final : public PParentToChildStreamParent,
|
||||
|
||||
/* static */
|
||||
PParentToChildStreamParent* IPCStreamSource::Create(
|
||||
nsIAsyncInputStream* aInputStream, dom::ContentParent* aManager) {
|
||||
MOZ_ASSERT(aInputStream);
|
||||
MOZ_ASSERT(aManager);
|
||||
|
||||
// PContent can only be used on the main thread
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
||||
IPCStreamSourceParent* source = IPCStreamSourceParent::Create(aInputStream);
|
||||
if (!source) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (!aManager->SendPParentToChildStreamConstructor(source)) {
|
||||
// no delete here, the manager will delete the actor for us.
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
source->ActorConstructed();
|
||||
return source;
|
||||
}
|
||||
|
||||
/* static */
|
||||
PParentToChildStreamParent* IPCStreamSource::Create(
|
||||
nsIAsyncInputStream* aInputStream, PBackgroundParent* aManager) {
|
||||
nsIAsyncInputStream* aInputStream,
|
||||
ParentToChildStreamActorManager* aManager) {
|
||||
MOZ_ASSERT(aInputStream);
|
||||
MOZ_ASSERT(aManager);
|
||||
|
||||
|
@ -14,19 +14,14 @@ class nsIAsyncInputStream;
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
namespace dom {
|
||||
class ContentChild;
|
||||
class ContentParent;
|
||||
} // namespace dom
|
||||
|
||||
namespace wr {
|
||||
struct ByteBuffer;
|
||||
} // namespace wr
|
||||
|
||||
namespace ipc {
|
||||
|
||||
class PBackgroundChild;
|
||||
class PBackgroundParent;
|
||||
class ParentToChildStreamActorManager;
|
||||
class ChildToParentStreamActorManager;
|
||||
class PChildToParentStreamChild;
|
||||
class PParentToChildStreamParent;
|
||||
|
||||
@ -57,29 +52,17 @@ class PParentToChildStreamParent;
|
||||
// defined in InputStreamUtils.h instead of using IPCStreamSource directly.
|
||||
class IPCStreamSource {
|
||||
public:
|
||||
// Create a IPCStreamSource using a PContent IPC manager on the
|
||||
// main thread. This can return nullptr if the provided stream is
|
||||
// blocking.
|
||||
static PChildToParentStreamChild* Create(nsIAsyncInputStream* aInputStream,
|
||||
dom::ContentChild* aManager);
|
||||
// Create a IPCStreamSource using a ChildToParentStreamActorManager manager.
|
||||
// This can return nullptr if the provided stream is blocking.
|
||||
static PChildToParentStreamChild* Create(
|
||||
nsIAsyncInputStream* aInputStream,
|
||||
ChildToParentStreamActorManager* aManager);
|
||||
|
||||
// Create a IPCStreamSource using a PBackground IPC manager on the
|
||||
// main thread or a Worker thread. This can return nullptr if the provided
|
||||
// stream is blocking or if the Worker thread is already shutting down.
|
||||
static PChildToParentStreamChild* Create(nsIAsyncInputStream* aInputStream,
|
||||
PBackgroundChild* aManager);
|
||||
|
||||
// Create a IPCStreamSource using a PContent IPC manager on the
|
||||
// main thread. This can return nullptr if the provided stream is
|
||||
// blocking.
|
||||
static PParentToChildStreamParent* Create(nsIAsyncInputStream* aInputStream,
|
||||
dom::ContentParent* aManager);
|
||||
|
||||
// Create a IPCStreamSource using a PBackground IPC manager on the
|
||||
// main thread or a Worker thread. This can return nullptr if the provided
|
||||
// stream is blocking or if the Worker thread is already shutting down.
|
||||
static PParentToChildStreamParent* Create(nsIAsyncInputStream* aInputStream,
|
||||
PBackgroundParent* aManager);
|
||||
// Create a IPCStreamSource using a ParentToChildStreamActorManager manager.
|
||||
// This can return nullptr if the provided stream is blocking.
|
||||
static PParentToChildStreamParent* Create(
|
||||
nsIAsyncInputStream* aInputStream,
|
||||
ParentToChildStreamActorManager* aManager);
|
||||
|
||||
static IPCStreamSource* Cast(PChildToParentStreamChild* aActor);
|
||||
|
||||
|
@ -15,10 +15,12 @@
|
||||
#include "mozilla/ipc/FileDescriptorSetChild.h"
|
||||
#include "mozilla/ipc/FileDescriptorSetParent.h"
|
||||
#include "mozilla/ipc/InputStreamUtils.h"
|
||||
#include "mozilla/ipc/PBackgroundChild.h"
|
||||
#include "mozilla/ipc/PBackgroundParent.h"
|
||||
#include "mozilla/net/SocketProcessChild.h"
|
||||
#include "mozilla/net/SocketProcessParent.h"
|
||||
#include "mozilla/Unused.h"
|
||||
#include "nsNetCID.h"
|
||||
#include "BackgroundParentImpl.h"
|
||||
#include "BackgroundChildImpl.h"
|
||||
|
||||
using namespace mozilla::dom;
|
||||
|
||||
@ -355,6 +357,28 @@ bool AutoIPCStream::Serialize(nsIInputStream* aStream,
|
||||
return true;
|
||||
}
|
||||
|
||||
BackgroundChildImpl* impl = static_cast<BackgroundChildImpl*>(aManager);
|
||||
if (!SerializeInputStreamChild(aStream, impl, mValue, mOptionalValue,
|
||||
mDelayedStart)) {
|
||||
MOZ_CRASH("IPCStream creation failed!");
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool AutoIPCStream::Serialize(nsIInputStream* aStream,
|
||||
net::SocketProcessChild* aManager) {
|
||||
MOZ_ASSERT(aStream || !mValue);
|
||||
MOZ_ASSERT(aManager);
|
||||
MOZ_ASSERT(mValue || mOptionalValue);
|
||||
MOZ_ASSERT(!mTaken);
|
||||
MOZ_ASSERT(!IsSet());
|
||||
|
||||
// If NormalizeOptionalValue returns false, we don't have to proceed.
|
||||
if (!NormalizeOptionalValue(aStream, mValue, mOptionalValue)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!SerializeInputStreamChild(aStream, aManager, mValue, mOptionalValue,
|
||||
mDelayedStart)) {
|
||||
MOZ_CRASH("IPCStream creation failed!");
|
||||
@ -397,6 +421,28 @@ bool AutoIPCStream::Serialize(nsIInputStream* aStream,
|
||||
return true;
|
||||
}
|
||||
|
||||
BackgroundParentImpl* impl = static_cast<BackgroundParentImpl*>(aManager);
|
||||
if (!SerializeInputStreamParent(aStream, impl, mValue, mOptionalValue,
|
||||
mDelayedStart)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool AutoIPCStream::Serialize(nsIInputStream* aStream,
|
||||
net::SocketProcessParent* aManager) {
|
||||
MOZ_ASSERT(aStream || !mValue);
|
||||
MOZ_ASSERT(aManager);
|
||||
MOZ_ASSERT(mValue || mOptionalValue);
|
||||
MOZ_ASSERT(!mTaken);
|
||||
MOZ_ASSERT(!IsSet());
|
||||
|
||||
// If NormalizeOptionalValue returns false, we don't have to proceed.
|
||||
if (!NormalizeOptionalValue(aStream, mValue, mOptionalValue)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!SerializeInputStreamParent(aStream, aManager, mValue, mOptionalValue,
|
||||
mDelayedStart)) {
|
||||
return false;
|
||||
|
@ -18,6 +18,11 @@ class ContentChild;
|
||||
class ContentParent;
|
||||
} // namespace dom
|
||||
|
||||
namespace net {
|
||||
class SocketProcessParent;
|
||||
class SocketProcessChild;
|
||||
} // namespace net
|
||||
|
||||
namespace ipc {
|
||||
|
||||
class PBackgroundChild;
|
||||
@ -153,6 +158,11 @@ class AutoIPCStream {
|
||||
// be called on the main thread or Worker threads.
|
||||
bool Serialize(nsIInputStream* aStream, PBackgroundChild* aManager);
|
||||
|
||||
// Serialize the input stream or create a SendStream actor using the
|
||||
// SocketProcess manager. If neither of these succeed, then crash. This
|
||||
// should only be used on the main thread.
|
||||
bool Serialize(nsIInputStream* aStream, net::SocketProcessChild* aManager);
|
||||
|
||||
// Serialize the input stream.
|
||||
MOZ_MUST_USE bool Serialize(nsIInputStream* aStream,
|
||||
dom::ContentParent* aManager);
|
||||
@ -161,6 +171,10 @@ class AutoIPCStream {
|
||||
MOZ_MUST_USE bool Serialize(nsIInputStream* aStream,
|
||||
PBackgroundParent* aManager);
|
||||
|
||||
// Serialize the input stream.
|
||||
MOZ_MUST_USE bool Serialize(nsIInputStream* aStream,
|
||||
net::SocketProcessParent* aManager);
|
||||
|
||||
// Get the IPCStream as a non-optional value. This will
|
||||
// assert if a stream has not been serialized or if it has already been taken.
|
||||
// This should only be called if the value is being, or has already been, sent
|
||||
|
@ -120,7 +120,8 @@ void SerializeInputStreamAsPipeInternal(nsIInputStream* aInputStream,
|
||||
void InputStreamHelper::SerializeInputStream(
|
||||
nsIInputStream* aInputStream, InputStreamParams& aParams,
|
||||
nsTArray<FileDescriptor>& aFileDescriptors, bool aDelayedStart,
|
||||
uint32_t aMaxSize, uint32_t* aSizeUsed, ContentChild* aManager) {
|
||||
uint32_t aMaxSize, uint32_t* aSizeUsed,
|
||||
ParentToChildStreamActorManager* aManager) {
|
||||
SerializeInputStreamInternal(aInputStream, aParams, aFileDescriptors,
|
||||
aDelayedStart, aMaxSize, aSizeUsed, aManager);
|
||||
}
|
||||
@ -128,54 +129,22 @@ void InputStreamHelper::SerializeInputStream(
|
||||
void InputStreamHelper::SerializeInputStream(
|
||||
nsIInputStream* aInputStream, InputStreamParams& aParams,
|
||||
nsTArray<FileDescriptor>& aFileDescriptors, bool aDelayedStart,
|
||||
uint32_t aMaxSize, uint32_t* aSizeUsed, PBackgroundChild* aManager) {
|
||||
uint32_t aMaxSize, uint32_t* aSizeUsed,
|
||||
ChildToParentStreamActorManager* aManager) {
|
||||
SerializeInputStreamInternal(aInputStream, aParams, aFileDescriptors,
|
||||
aDelayedStart, aMaxSize, aSizeUsed, aManager);
|
||||
}
|
||||
|
||||
void InputStreamHelper::SerializeInputStream(
|
||||
void InputStreamHelper::SerializeInputStreamAsPipe(
|
||||
nsIInputStream* aInputStream, InputStreamParams& aParams,
|
||||
nsTArray<FileDescriptor>& aFileDescriptors, bool aDelayedStart,
|
||||
uint32_t aMaxSize, uint32_t* aSizeUsed, ContentParent* aManager) {
|
||||
SerializeInputStreamInternal(aInputStream, aParams, aFileDescriptors,
|
||||
aDelayedStart, aMaxSize, aSizeUsed, aManager);
|
||||
}
|
||||
|
||||
void InputStreamHelper::SerializeInputStream(
|
||||
nsIInputStream* aInputStream, InputStreamParams& aParams,
|
||||
nsTArray<FileDescriptor>& aFileDescriptors, bool aDelayedStart,
|
||||
uint32_t aMaxSize, uint32_t* aSizeUsed, PBackgroundParent* aManager) {
|
||||
SerializeInputStreamInternal(aInputStream, aParams, aFileDescriptors,
|
||||
aDelayedStart, aMaxSize, aSizeUsed, aManager);
|
||||
}
|
||||
|
||||
void InputStreamHelper::SerializeInputStreamAsPipe(nsIInputStream* aInputStream,
|
||||
InputStreamParams& aParams,
|
||||
bool aDelayedStart,
|
||||
ContentChild* aManager) {
|
||||
SerializeInputStreamAsPipeInternal(aInputStream, aParams, aDelayedStart,
|
||||
aManager);
|
||||
}
|
||||
|
||||
void InputStreamHelper::SerializeInputStreamAsPipe(nsIInputStream* aInputStream,
|
||||
InputStreamParams& aParams,
|
||||
bool aDelayedStart,
|
||||
PBackgroundChild* aManager) {
|
||||
SerializeInputStreamAsPipeInternal(aInputStream, aParams, aDelayedStart,
|
||||
aManager);
|
||||
}
|
||||
|
||||
void InputStreamHelper::SerializeInputStreamAsPipe(nsIInputStream* aInputStream,
|
||||
InputStreamParams& aParams,
|
||||
bool aDelayedStart,
|
||||
ContentParent* aManager) {
|
||||
bool aDelayedStart, ParentToChildStreamActorManager* aManager) {
|
||||
SerializeInputStreamAsPipeInternal(aInputStream, aParams, aDelayedStart,
|
||||
aManager);
|
||||
}
|
||||
|
||||
void InputStreamHelper::SerializeInputStreamAsPipe(
|
||||
nsIInputStream* aInputStream, InputStreamParams& aParams,
|
||||
bool aDelayedStart, PBackgroundParent* aManager) {
|
||||
bool aDelayedStart, ChildToParentStreamActorManager* aManager) {
|
||||
SerializeInputStreamAsPipeInternal(aInputStream, aParams, aDelayedStart,
|
||||
aManager);
|
||||
}
|
||||
|
@ -16,11 +16,33 @@ namespace mozilla {
|
||||
namespace ipc {
|
||||
|
||||
class FileDescriptor;
|
||||
class PFileDescriptorSetChild;
|
||||
class PFileDescriptorSetParent;
|
||||
class PChildToParentStreamChild;
|
||||
class PParentToChildStreamParent;
|
||||
|
||||
// Provide two interfaces for sending PParentToChildStream and
|
||||
// PFileDescriptorSet constructor messages.
|
||||
class ParentToChildStreamActorManager {
|
||||
public:
|
||||
virtual PParentToChildStreamParent* SendPParentToChildStreamConstructor(
|
||||
PParentToChildStreamParent* aActor) = 0;
|
||||
virtual PFileDescriptorSetParent* SendPFileDescriptorSetConstructor(
|
||||
const FileDescriptor& aFD) = 0;
|
||||
};
|
||||
|
||||
class ChildToParentStreamActorManager {
|
||||
public:
|
||||
virtual PChildToParentStreamChild* SendPChildToParentStreamConstructor(
|
||||
PChildToParentStreamChild* aActor) = 0;
|
||||
virtual PFileDescriptorSetChild* SendPFileDescriptorSetConstructor(
|
||||
const FileDescriptor& aFD) = 0;
|
||||
};
|
||||
|
||||
// If you want to serialize an inputStream, please use AutoIPCStream.
|
||||
class InputStreamHelper {
|
||||
public:
|
||||
// These 4 methods allow to serialize an inputStream into InputStreamParams.
|
||||
// These 2 methods allow to serialize an inputStream into InputStreamParams.
|
||||
// The manager is needed in case a stream needs to serialize itself as
|
||||
// IPCRemoteStream.
|
||||
// The stream serializes itself fully only if the resulting IPC message will
|
||||
@ -34,50 +56,24 @@ class InputStreamHelper {
|
||||
nsTArray<FileDescriptor>& aFileDescriptors,
|
||||
bool aDelayedStart, uint32_t aMaxSize,
|
||||
uint32_t* aSizeUsed,
|
||||
mozilla::dom::ContentChild* aManager);
|
||||
ParentToChildStreamActorManager* aManager);
|
||||
|
||||
static void SerializeInputStream(nsIInputStream* aInputStream,
|
||||
InputStreamParams& aParams,
|
||||
nsTArray<FileDescriptor>& aFileDescriptors,
|
||||
bool aDelayedStart, uint32_t aMaxSize,
|
||||
uint32_t* aSizeUsed,
|
||||
PBackgroundChild* aManager);
|
||||
|
||||
static void SerializeInputStream(nsIInputStream* aInputStream,
|
||||
InputStreamParams& aParams,
|
||||
nsTArray<FileDescriptor>& aFileDescriptors,
|
||||
bool aDelayedStart, uint32_t aMaxSize,
|
||||
uint32_t* aSizeUsed,
|
||||
mozilla::dom::ContentParent* aManager);
|
||||
|
||||
static void SerializeInputStream(nsIInputStream* aInputStream,
|
||||
InputStreamParams& aParams,
|
||||
nsTArray<FileDescriptor>& aFileDescriptors,
|
||||
bool aDelayedStart, uint32_t aMaxSize,
|
||||
uint32_t* aSizeUsed,
|
||||
PBackgroundParent* aManager);
|
||||
ChildToParentStreamActorManager* aManager);
|
||||
|
||||
// When a stream wants to serialize itself as IPCRemoteStream, it uses one of
|
||||
// these methods.
|
||||
static void SerializeInputStreamAsPipe(nsIInputStream* aInputStream,
|
||||
InputStreamParams& aParams,
|
||||
bool aDelayedStart,
|
||||
mozilla::dom::ContentChild* aManager);
|
||||
static void SerializeInputStreamAsPipe(
|
||||
nsIInputStream* aInputStream, InputStreamParams& aParams,
|
||||
bool aDelayedStart, ParentToChildStreamActorManager* aManager);
|
||||
|
||||
static void SerializeInputStreamAsPipe(nsIInputStream* aInputStream,
|
||||
InputStreamParams& aParams,
|
||||
bool aDelayedStart,
|
||||
PBackgroundChild* aManager);
|
||||
|
||||
static void SerializeInputStreamAsPipe(nsIInputStream* aInputStream,
|
||||
InputStreamParams& aParams,
|
||||
bool aDelayedStart,
|
||||
mozilla::dom::ContentParent* aManager);
|
||||
|
||||
static void SerializeInputStreamAsPipe(nsIInputStream* aInputStream,
|
||||
InputStreamParams& aParams,
|
||||
bool aDelayedStart,
|
||||
PBackgroundParent* aManager);
|
||||
static void SerializeInputStreamAsPipe(
|
||||
nsIInputStream* aInputStream, InputStreamParams& aParams,
|
||||
bool aDelayedStart, ChildToParentStreamActorManager* aManager);
|
||||
|
||||
// After the sending of the inputStream into the IPC pipe, some of the
|
||||
// InputStreamParams data struct needs to be activated (IPCRemoteStream).
|
||||
|
@ -4,6 +4,7 @@
|
||||
|
||||
include protocol PBackground;
|
||||
include protocol PContent;
|
||||
include protocol PSocketProcess;
|
||||
|
||||
include "mozilla/layers/WebRenderMessageUtils.h";
|
||||
|
||||
@ -16,7 +17,7 @@ namespace ipc {
|
||||
// protocols in sync.
|
||||
protocol PChildToParentStream
|
||||
{
|
||||
manager PBackground or PContent;
|
||||
manager PBackground or PContent or PSocketProcess;
|
||||
|
||||
parent:
|
||||
async Buffer(ByteBuffer aBuffer);
|
||||
|
@ -4,13 +4,14 @@
|
||||
|
||||
include protocol PBackground;
|
||||
include protocol PContent;
|
||||
include protocol PSocketProcess;
|
||||
|
||||
namespace mozilla {
|
||||
namespace ipc {
|
||||
|
||||
protocol PFileDescriptorSet
|
||||
{
|
||||
manager PBackground or PContent;
|
||||
manager PBackground or PContent or PSocketProcess;
|
||||
|
||||
both:
|
||||
async AddFileDescriptor(FileDescriptor fd);
|
||||
|
@ -4,6 +4,7 @@
|
||||
|
||||
include protocol PBackground;
|
||||
include protocol PContent;
|
||||
include protocol PSocketProcess;
|
||||
|
||||
include "mozilla/layers/WebRenderMessageUtils.h";
|
||||
|
||||
@ -16,7 +17,7 @@ namespace ipc {
|
||||
// protocols in sync.
|
||||
protocol PParentToChildStream
|
||||
{
|
||||
manager PBackground or PContent;
|
||||
manager PBackground or PContent or PSocketProcess;
|
||||
|
||||
child:
|
||||
async Buffer(ByteBuffer aBuffer);
|
||||
|
@ -13,20 +13,12 @@
|
||||
#include "nsTArrayForwardDeclare.h"
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
namespace dom {
|
||||
|
||||
class ContentChild;
|
||||
class ContentParent;
|
||||
|
||||
} // namespace dom
|
||||
|
||||
namespace ipc {
|
||||
|
||||
class FileDescriptor;
|
||||
class InputStreamParams;
|
||||
class PBackgroundChild;
|
||||
class PBackgroundParent;
|
||||
class ChildToParentStreamActorManager;
|
||||
class ParentToChildStreamActorManager;
|
||||
|
||||
} // namespace ipc
|
||||
|
||||
@ -45,29 +37,17 @@ class NS_NO_VTABLE nsIIPCSerializableInputStream : public nsISupports {
|
||||
|
||||
NS_DECLARE_STATIC_IID_ACCESSOR(NS_IIPCSERIALIZABLEINPUTSTREAM_IID)
|
||||
|
||||
virtual void Serialize(mozilla::ipc::InputStreamParams& aParams,
|
||||
FileDescriptorArray& aFileDescriptors,
|
||||
bool aDelayedStart, uint32_t aMaxSize,
|
||||
uint32_t* aSizeUsed,
|
||||
mozilla::dom::ContentChild* aManager) = 0;
|
||||
virtual void Serialize(
|
||||
mozilla::ipc::InputStreamParams& aParams,
|
||||
FileDescriptorArray& aFileDescriptors, bool aDelayedStart,
|
||||
uint32_t aMaxSize, uint32_t* aSizeUsed,
|
||||
mozilla::ipc::ParentToChildStreamActorManager* aManager) = 0;
|
||||
|
||||
virtual void Serialize(mozilla::ipc::InputStreamParams& aParams,
|
||||
FileDescriptorArray& aFileDescriptors,
|
||||
bool aDelayedStart, uint32_t aMaxSize,
|
||||
uint32_t* aSizeUsed,
|
||||
mozilla::ipc::PBackgroundChild* aManager) = 0;
|
||||
|
||||
virtual void Serialize(mozilla::ipc::InputStreamParams& aParams,
|
||||
FileDescriptorArray& aFileDescriptors,
|
||||
bool aDelayedStart, uint32_t aMaxSize,
|
||||
uint32_t* aSizeUsed,
|
||||
mozilla::dom::ContentParent* aManager) = 0;
|
||||
|
||||
virtual void Serialize(mozilla::ipc::InputStreamParams& aParams,
|
||||
FileDescriptorArray& aFileDescriptors,
|
||||
bool aDelayedStart, uint32_t aMaxSize,
|
||||
uint32_t* aSizeUsed,
|
||||
mozilla::ipc::PBackgroundParent* aManager) = 0;
|
||||
virtual void Serialize(
|
||||
mozilla::ipc::InputStreamParams& aParams,
|
||||
FileDescriptorArray& aFileDescriptors, bool aDelayedStart,
|
||||
uint32_t aMaxSize, uint32_t* aSizeUsed,
|
||||
mozilla::ipc::ChildToParentStreamActorManager* aManager) = 0;
|
||||
|
||||
virtual bool Deserialize(const mozilla::ipc::InputStreamParams& aParams,
|
||||
const FileDescriptorArray& aFileDescriptors) = 0;
|
||||
@ -76,118 +56,70 @@ class NS_NO_VTABLE nsIIPCSerializableInputStream : public nsISupports {
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(nsIIPCSerializableInputStream,
|
||||
NS_IIPCSERIALIZABLEINPUTSTREAM_IID)
|
||||
|
||||
#define NS_DECL_NSIIPCSERIALIZABLEINPUTSTREAM \
|
||||
virtual void Serialize(mozilla::ipc::InputStreamParams&, \
|
||||
FileDescriptorArray&, bool, uint32_t, uint32_t*, \
|
||||
mozilla::dom::ContentChild*) override; \
|
||||
\
|
||||
virtual void Serialize(mozilla::ipc::InputStreamParams&, \
|
||||
FileDescriptorArray&, bool, uint32_t, uint32_t*, \
|
||||
mozilla::ipc::PBackgroundChild*) override; \
|
||||
\
|
||||
virtual void Serialize(mozilla::ipc::InputStreamParams&, \
|
||||
FileDescriptorArray&, bool, uint32_t, uint32_t*, \
|
||||
mozilla::dom::ContentParent*) override; \
|
||||
\
|
||||
virtual void Serialize(mozilla::ipc::InputStreamParams&, \
|
||||
FileDescriptorArray&, bool, uint32_t, uint32_t*, \
|
||||
mozilla::ipc::PBackgroundParent*) override; \
|
||||
\
|
||||
virtual bool Deserialize(const mozilla::ipc::InputStreamParams&, \
|
||||
#define NS_DECL_NSIIPCSERIALIZABLEINPUTSTREAM \
|
||||
virtual void Serialize( \
|
||||
mozilla::ipc::InputStreamParams&, FileDescriptorArray&, bool, uint32_t, \
|
||||
uint32_t*, mozilla::ipc::ParentToChildStreamActorManager*) override; \
|
||||
\
|
||||
virtual void Serialize( \
|
||||
mozilla::ipc::InputStreamParams&, FileDescriptorArray&, bool, uint32_t, \
|
||||
uint32_t*, mozilla::ipc::ChildToParentStreamActorManager*) override; \
|
||||
\
|
||||
virtual bool Deserialize(const mozilla::ipc::InputStreamParams&, \
|
||||
const FileDescriptorArray&) override;
|
||||
|
||||
#define NS_FORWARD_NSIIPCSERIALIZABLEINPUTSTREAM(_to) \
|
||||
virtual void Serialize(mozilla::ipc::InputStreamParams& aParams, \
|
||||
FileDescriptorArray& aFileDescriptors, \
|
||||
bool aDelayedStart, uint32_t aMaxSize, \
|
||||
uint32_t* aSizeUsed, \
|
||||
mozilla::dom::ContentChild* aManager) override { \
|
||||
_to Serialize(aParams, aFileDescriptors, aDelayedStart, aMaxSize, \
|
||||
aSizeUsed, aManager); \
|
||||
} \
|
||||
\
|
||||
virtual void Serialize(mozilla::ipc::InputStreamParams& aParams, \
|
||||
FileDescriptorArray& aFileDescriptors, \
|
||||
bool aDelayedStart, uint32_t aMaxSize, \
|
||||
uint32_t* aSizeUsed, \
|
||||
mozilla::ipc::PBackgroundChild* aManager) override { \
|
||||
_to Serialize(aParams, aFileDescriptors, aDelayedStart, aMaxSize, \
|
||||
aSizeUsed, aManager); \
|
||||
} \
|
||||
\
|
||||
virtual void Serialize(mozilla::ipc::InputStreamParams& aParams, \
|
||||
FileDescriptorArray& aFileDescriptors, \
|
||||
bool aDelayedStart, uint32_t aMaxSize, \
|
||||
uint32_t* aSizeUsed, \
|
||||
mozilla::dom::ContentParent* aManager) override { \
|
||||
_to Serialize(aParams, aFileDescriptors, aDelayedStart, aMaxSize, \
|
||||
aSizeUsed, aManager); \
|
||||
} \
|
||||
\
|
||||
virtual void Serialize(mozilla::ipc::InputStreamParams& aParams, \
|
||||
FileDescriptorArray& aFileDescriptors, \
|
||||
bool aDelayedStart, uint32_t aMaxSize, \
|
||||
uint32_t* aSizeUsed, \
|
||||
mozilla::ipc::PBackgroundParent* aManager) override { \
|
||||
_to Serialize(aParams, aFileDescriptors, aDelayedStart, aMaxSize, \
|
||||
aSizeUsed, aManager); \
|
||||
} \
|
||||
\
|
||||
virtual bool Deserialize(const mozilla::ipc::InputStreamParams& aParams, \
|
||||
const FileDescriptorArray& aFileDescriptors) \
|
||||
override { \
|
||||
return _to Deserialize(aParams, aFileDescriptors); \
|
||||
#define NS_FORWARD_NSIIPCSERIALIZABLEINPUTSTREAM(_to) \
|
||||
virtual void Serialize( \
|
||||
mozilla::ipc::InputStreamParams& aParams, \
|
||||
FileDescriptorArray& aFileDescriptors, bool aDelayedStart, \
|
||||
uint32_t aMaxSize, uint32_t* aSizeUsed, \
|
||||
mozilla::ipc::ParentToChildStreamActorManager* aManager) override { \
|
||||
_to Serialize(aParams, aFileDescriptors, aDelayedStart, aMaxSize, \
|
||||
aSizeUsed, aManager); \
|
||||
} \
|
||||
\
|
||||
virtual void Serialize( \
|
||||
mozilla::ipc::InputStreamParams& aParams, \
|
||||
FileDescriptorArray& aFileDescriptors, bool aDelayedStart, \
|
||||
uint32_t aMaxSize, uint32_t* aSizeUsed, \
|
||||
mozilla::ipc::ChildToParentStreamActorManager* aManager) override { \
|
||||
_to Serialize(aParams, aFileDescriptors, aDelayedStart, aMaxSize, \
|
||||
aSizeUsed, aManager); \
|
||||
} \
|
||||
\
|
||||
virtual bool Deserialize(const mozilla::ipc::InputStreamParams& aParams, \
|
||||
const FileDescriptorArray& aFileDescriptors) \
|
||||
override { \
|
||||
return _to Deserialize(aParams, aFileDescriptors); \
|
||||
}
|
||||
|
||||
#define NS_FORWARD_SAFE_NSIIPCSERIALIZABLEINPUTSTREAM(_to) \
|
||||
virtual void Serialize(mozilla::ipc::InputStreamParams& aParams, \
|
||||
FileDescriptorArray& aFileDescriptors, \
|
||||
bool aDelayedStart, uint32_t aMaxSize, \
|
||||
uint32_t* aSizeUsed, \
|
||||
mozilla::dom::ContentChild* aManager) override { \
|
||||
if (_to) { \
|
||||
_to->Serialize(aParams, aFileDescriptors, aDelayedStart, aMaxSize, \
|
||||
aSizeUsed, aManager); \
|
||||
} \
|
||||
} \
|
||||
\
|
||||
virtual void Serialize(mozilla::ipc::InputStreamParams& aParams, \
|
||||
FileDescriptorArray& aFileDescriptors, \
|
||||
bool aDelayedStart, uint32_t aMaxSize, \
|
||||
uint32_t* aSizeUsed, \
|
||||
mozilla::ipc::PBackgroundChild* aManager) override { \
|
||||
if (_to) { \
|
||||
_to->Serialize(aParams, aFileDescriptors, aDelayedStart, aMaxSize, \
|
||||
aSizeUsed, aManager); \
|
||||
} \
|
||||
} \
|
||||
\
|
||||
virtual void Serialize(mozilla::ipc::InputStreamParams& aParams, \
|
||||
FileDescriptorArray& aFileDescriptors, \
|
||||
bool aDelayedStart, uint32_t aMaxSize, \
|
||||
uint32_t* aSizeUsed, \
|
||||
mozilla::dom::ContentParent* aManager) override { \
|
||||
if (_to) { \
|
||||
_to->Serialize(aParams, aFileDescriptors, aDelayedStart, aMaxSize, \
|
||||
aSizeUsed, aManager); \
|
||||
} \
|
||||
} \
|
||||
\
|
||||
virtual void Serialize(mozilla::ipc::InputStreamParams& aParams, \
|
||||
FileDescriptorArray& aFileDescriptors, \
|
||||
bool aDelayedStart, uint32_t aMaxSize, \
|
||||
uint32_t* aSizeUsed, \
|
||||
mozilla::ipc::PBackgroundParent* aManager) override { \
|
||||
if (_to) { \
|
||||
_to->Serialize(aParams, aFileDescriptors, aDelayedStart, aMaxSize, \
|
||||
aSizeUsed, aManager); \
|
||||
} \
|
||||
} \
|
||||
\
|
||||
virtual bool Deserialize(const mozilla::ipc::InputStreamParams& aParams, \
|
||||
const FileDescriptorArray& aFileDescriptors) \
|
||||
override { \
|
||||
return _to ? _to->Deserialize(aParams, aFileDescriptors) : false; \
|
||||
#define NS_FORWARD_SAFE_NSIIPCSERIALIZABLEINPUTSTREAM(_to) \
|
||||
virtual void Serialize( \
|
||||
mozilla::ipc::InputStreamParams& aParams, \
|
||||
FileDescriptorArray& aFileDescriptors, bool aDelayedStart, \
|
||||
uint32_t aMaxSize, uint32_t* aSizeUsed, \
|
||||
mozilla::ipc::ParentToChildStreamActorManager* aManager) override { \
|
||||
if (_to) { \
|
||||
_to->Serialize(aParams, aFileDescriptors, aDelayedStart, aMaxSize, \
|
||||
aSizeUsed, aManager); \
|
||||
} \
|
||||
} \
|
||||
\
|
||||
virtual void Serialize( \
|
||||
mozilla::ipc::InputStreamParams& aParams, \
|
||||
FileDescriptorArray& aFileDescriptors, bool aDelayedStart, \
|
||||
uint32_t aMaxSize, uint32_t* aSizeUsed, \
|
||||
mozilla::ipc::ChildToParentStreamActorManager* aManager) override { \
|
||||
if (_to) { \
|
||||
_to->Serialize(aParams, aFileDescriptors, aDelayedStart, aMaxSize, \
|
||||
aSizeUsed, aManager); \
|
||||
} \
|
||||
} \
|
||||
\
|
||||
virtual bool Deserialize(const mozilla::ipc::InputStreamParams& aParams, \
|
||||
const FileDescriptorArray& aFileDescriptors) \
|
||||
override { \
|
||||
return _to ? _to->Deserialize(aParams, aFileDescriptors) : false; \
|
||||
}
|
||||
|
||||
#endif // mozilla_ipc_nsIIPCSerializableInputStream_h
|
||||
|
@ -282,7 +282,7 @@ void PartiallySeekableInputStream::Serialize(
|
||||
mozilla::ipc::InputStreamParams& aParams,
|
||||
FileDescriptorArray& aFileDescriptors, bool aDelayedStart,
|
||||
uint32_t aMaxSize, uint32_t* aSizeUsed,
|
||||
mozilla::dom::ContentChild* aManager) {
|
||||
mozilla::ipc::ParentToChildStreamActorManager* aManager) {
|
||||
SerializeInternal(aParams, aFileDescriptors, aDelayedStart, aMaxSize,
|
||||
aSizeUsed, aManager);
|
||||
}
|
||||
@ -291,25 +291,7 @@ void PartiallySeekableInputStream::Serialize(
|
||||
mozilla::ipc::InputStreamParams& aParams,
|
||||
FileDescriptorArray& aFileDescriptors, bool aDelayedStart,
|
||||
uint32_t aMaxSize, uint32_t* aSizeUsed,
|
||||
mozilla::ipc::PBackgroundChild* aManager) {
|
||||
SerializeInternal(aParams, aFileDescriptors, aDelayedStart, aMaxSize,
|
||||
aSizeUsed, aManager);
|
||||
}
|
||||
|
||||
void PartiallySeekableInputStream::Serialize(
|
||||
mozilla::ipc::InputStreamParams& aParams,
|
||||
FileDescriptorArray& aFileDescriptors, bool aDelayedStart,
|
||||
uint32_t aMaxSize, uint32_t* aSizeUsed,
|
||||
mozilla::dom::ContentParent* aManager) {
|
||||
SerializeInternal(aParams, aFileDescriptors, aDelayedStart, aMaxSize,
|
||||
aSizeUsed, aManager);
|
||||
}
|
||||
|
||||
void PartiallySeekableInputStream::Serialize(
|
||||
mozilla::ipc::InputStreamParams& aParams,
|
||||
FileDescriptorArray& aFileDescriptors, bool aDelayedStart,
|
||||
uint32_t aMaxSize, uint32_t* aSizeUsed,
|
||||
mozilla::ipc::PBackgroundParent* aManager) {
|
||||
mozilla::ipc::ChildToParentStreamActorManager* aManager) {
|
||||
SerializeInternal(aParams, aFileDescriptors, aDelayedStart, aMaxSize,
|
||||
aSizeUsed, aManager);
|
||||
}
|
||||
|
@ -590,38 +590,18 @@ nsBufferedInputStream::GetUnbufferedStream(nsISupports** aStream) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void nsBufferedInputStream::Serialize(InputStreamParams& aParams,
|
||||
FileDescriptorArray& aFileDescriptors,
|
||||
bool aDelayedStart, uint32_t aMaxSize,
|
||||
uint32_t* aSizeUsed,
|
||||
mozilla::dom::ContentChild* aManager) {
|
||||
void nsBufferedInputStream::Serialize(
|
||||
InputStreamParams& aParams, FileDescriptorArray& aFileDescriptors,
|
||||
bool aDelayedStart, uint32_t aMaxSize, uint32_t* aSizeUsed,
|
||||
mozilla::ipc::ParentToChildStreamActorManager* aManager) {
|
||||
SerializeInternal(aParams, aFileDescriptors, aDelayedStart, aMaxSize,
|
||||
aSizeUsed, aManager);
|
||||
}
|
||||
|
||||
void nsBufferedInputStream::Serialize(InputStreamParams& aParams,
|
||||
FileDescriptorArray& aFileDescriptors,
|
||||
bool aDelayedStart, uint32_t aMaxSize,
|
||||
uint32_t* aSizeUsed,
|
||||
PBackgroundChild* aManager) {
|
||||
SerializeInternal(aParams, aFileDescriptors, aDelayedStart, aMaxSize,
|
||||
aSizeUsed, aManager);
|
||||
}
|
||||
|
||||
void nsBufferedInputStream::Serialize(InputStreamParams& aParams,
|
||||
FileDescriptorArray& aFileDescriptors,
|
||||
bool aDelayedStart, uint32_t aMaxSize,
|
||||
uint32_t* aSizeUsed,
|
||||
mozilla::dom::ContentParent* aManager) {
|
||||
SerializeInternal(aParams, aFileDescriptors, aDelayedStart, aMaxSize,
|
||||
aSizeUsed, aManager);
|
||||
}
|
||||
|
||||
void nsBufferedInputStream::Serialize(InputStreamParams& aParams,
|
||||
FileDescriptorArray& aFileDescriptors,
|
||||
bool aDelayedStart, uint32_t aMaxSize,
|
||||
uint32_t* aSizeUsed,
|
||||
PBackgroundParent* aManager) {
|
||||
void nsBufferedInputStream::Serialize(
|
||||
InputStreamParams& aParams, FileDescriptorArray& aFileDescriptors,
|
||||
bool aDelayedStart, uint32_t aMaxSize, uint32_t* aSizeUsed,
|
||||
mozilla::ipc::ChildToParentStreamActorManager* aManager) {
|
||||
SerializeInternal(aParams, aFileDescriptors, aDelayedStart, aMaxSize,
|
||||
aSizeUsed, aManager);
|
||||
}
|
||||
|
@ -544,7 +544,7 @@ void nsFileInputStream::Serialize(InputStreamParams& aParams,
|
||||
FileDescriptorArray& aFileDescriptors,
|
||||
bool aDelayedStart, uint32_t aMaxSize,
|
||||
uint32_t* aSizeUsed,
|
||||
mozilla::dom::ContentChild* aManager) {
|
||||
ParentToChildStreamActorManager* aManager) {
|
||||
MOZ_ASSERT(aSizeUsed);
|
||||
*aSizeUsed = 0;
|
||||
|
||||
@ -555,29 +555,7 @@ void nsFileInputStream::Serialize(InputStreamParams& aParams,
|
||||
FileDescriptorArray& aFileDescriptors,
|
||||
bool aDelayedStart, uint32_t aMaxSize,
|
||||
uint32_t* aSizeUsed,
|
||||
PBackgroundChild* aManager) {
|
||||
MOZ_ASSERT(aSizeUsed);
|
||||
*aSizeUsed = 0;
|
||||
|
||||
SerializeInternal(aParams, aFileDescriptors);
|
||||
}
|
||||
|
||||
void nsFileInputStream::Serialize(InputStreamParams& aParams,
|
||||
FileDescriptorArray& aFileDescriptors,
|
||||
bool aDelayedStart, uint32_t aMaxSize,
|
||||
uint32_t* aSizeUsed,
|
||||
mozilla::dom::ContentParent* aManager) {
|
||||
MOZ_ASSERT(aSizeUsed);
|
||||
*aSizeUsed = 0;
|
||||
|
||||
SerializeInternal(aParams, aFileDescriptors);
|
||||
}
|
||||
|
||||
void nsFileInputStream::Serialize(InputStreamParams& aParams,
|
||||
FileDescriptorArray& aFileDescriptors,
|
||||
bool aDelayedStart, uint32_t aMaxSize,
|
||||
uint32_t* aSizeUsed,
|
||||
PBackgroundParent* aManager) {
|
||||
ChildToParentStreamActorManager* aManager) {
|
||||
MOZ_ASSERT(aSizeUsed);
|
||||
*aSizeUsed = 0;
|
||||
|
||||
|
@ -336,38 +336,18 @@ nsresult nsMIMEInputStreamConstructor(nsISupports* outer, REFNSIID iid,
|
||||
return inst->QueryInterface(iid, result);
|
||||
}
|
||||
|
||||
void nsMIMEInputStream::Serialize(InputStreamParams& aParams,
|
||||
FileDescriptorArray& aFileDescriptors,
|
||||
bool aDelayedStart, uint32_t aMaxSize,
|
||||
uint32_t* aSizeUsed,
|
||||
mozilla::dom::ContentChild* aManager) {
|
||||
void nsMIMEInputStream::Serialize(
|
||||
InputStreamParams& aParams, FileDescriptorArray& aFileDescriptors,
|
||||
bool aDelayedStart, uint32_t aMaxSize, uint32_t* aSizeUsed,
|
||||
mozilla::ipc::ParentToChildStreamActorManager* aManager) {
|
||||
SerializeInternal(aParams, aFileDescriptors, aDelayedStart, aMaxSize,
|
||||
aSizeUsed, aManager);
|
||||
}
|
||||
|
||||
void nsMIMEInputStream::Serialize(InputStreamParams& aParams,
|
||||
FileDescriptorArray& aFileDescriptors,
|
||||
bool aDelayedStart, uint32_t aMaxSize,
|
||||
uint32_t* aSizeUsed,
|
||||
PBackgroundChild* aManager) {
|
||||
SerializeInternal(aParams, aFileDescriptors, aDelayedStart, aMaxSize,
|
||||
aSizeUsed, aManager);
|
||||
}
|
||||
|
||||
void nsMIMEInputStream::Serialize(InputStreamParams& aParams,
|
||||
FileDescriptorArray& aFileDescriptors,
|
||||
bool aDelayedStart, uint32_t aMaxSize,
|
||||
uint32_t* aSizeUsed,
|
||||
mozilla::dom::ContentParent* aManager) {
|
||||
SerializeInternal(aParams, aFileDescriptors, aDelayedStart, aMaxSize,
|
||||
aSizeUsed, aManager);
|
||||
}
|
||||
|
||||
void nsMIMEInputStream::Serialize(InputStreamParams& aParams,
|
||||
FileDescriptorArray& aFileDescriptors,
|
||||
bool aDelayedStart, uint32_t aMaxSize,
|
||||
uint32_t* aSizeUsed,
|
||||
PBackgroundParent* aManager) {
|
||||
void nsMIMEInputStream::Serialize(
|
||||
InputStreamParams& aParams, FileDescriptorArray& aFileDescriptors,
|
||||
bool aDelayedStart, uint32_t aMaxSize, uint32_t* aSizeUsed,
|
||||
mozilla::ipc::ChildToParentStreamActorManager* aManager) {
|
||||
SerializeInternal(aParams, aFileDescriptors, aDelayedStart, aMaxSize,
|
||||
aSizeUsed, aManager);
|
||||
}
|
||||
|
@ -7,6 +7,9 @@ include protocol PDNSRequest;
|
||||
include protocol PSocketProcessBridge;
|
||||
include protocol PProfiler;
|
||||
include protocol PWebrtcTCPSocket;
|
||||
include protocol PFileDescriptorSet;
|
||||
include protocol PChildToParentStream;
|
||||
include protocol PParentToChildStream;
|
||||
|
||||
include MemoryReportTypes;
|
||||
include PBrowserOrId;
|
||||
@ -29,6 +32,9 @@ protocol PSocketProcess
|
||||
{
|
||||
manages PDNSRequest;
|
||||
manages PWebrtcTCPSocket;
|
||||
manages PFileDescriptorSet;
|
||||
manages PChildToParentStream;
|
||||
manages PParentToChildStream;
|
||||
|
||||
parent:
|
||||
async InitCrashReporter(Shmem shmem, NativeThreadId threadId);
|
||||
@ -46,6 +52,7 @@ parent:
|
||||
async PWebrtcTCPSocket(TabId? tabId);
|
||||
async PDNSRequest(nsCString hostName, OriginAttributes originAttributes,
|
||||
uint32_t flags);
|
||||
async PChildToParentStream();
|
||||
|
||||
child:
|
||||
async PreferenceUpdate(Pref pref);
|
||||
@ -58,6 +65,10 @@ child:
|
||||
async InitProfiler(Endpoint<PProfilerChild> aEndpoint);
|
||||
// test-only
|
||||
async SocketProcessTelemetryPing();
|
||||
async PParentToChildStream();
|
||||
|
||||
both:
|
||||
async PFileDescriptorSet(FileDescriptor fd);
|
||||
};
|
||||
|
||||
} // namespace net
|
||||
|
@ -10,8 +10,12 @@
|
||||
#include "mozilla/Assertions.h"
|
||||
#include "mozilla/dom/MemoryReportRequest.h"
|
||||
#include "mozilla/ipc/CrashReporterClient.h"
|
||||
#include "mozilla/ipc/FileDescriptorSetChild.h"
|
||||
#include "mozilla/ipc/IPCStreamAlloc.h"
|
||||
#include "mozilla/ipc/ProcessChild.h"
|
||||
#include "mozilla/net/DNSRequestChild.h"
|
||||
#include "mozilla/ipc/PChildToParentStreamChild.h"
|
||||
#include "mozilla/ipc/PParentToChildStreamChild.h"
|
||||
#include "mozilla/Preferences.h"
|
||||
#include "nsDebugImpl.h"
|
||||
#include "nsThreadManager.h"
|
||||
@ -212,5 +216,51 @@ bool SocketProcessChild::DeallocPWebrtcTCPSocketChild(
|
||||
return true;
|
||||
}
|
||||
|
||||
PFileDescriptorSetChild* SocketProcessChild::AllocPFileDescriptorSetChild(
|
||||
const FileDescriptor& aFD) {
|
||||
return new FileDescriptorSetChild(aFD);
|
||||
}
|
||||
|
||||
bool SocketProcessChild::DeallocPFileDescriptorSetChild(
|
||||
PFileDescriptorSetChild* aActor) {
|
||||
delete aActor;
|
||||
return true;
|
||||
}
|
||||
|
||||
PChildToParentStreamChild*
|
||||
SocketProcessChild::AllocPChildToParentStreamChild() {
|
||||
MOZ_CRASH("PChildToParentStreamChild actors should be manually constructed!");
|
||||
}
|
||||
|
||||
bool SocketProcessChild::DeallocPChildToParentStreamChild(
|
||||
PChildToParentStreamChild* aActor) {
|
||||
delete aActor;
|
||||
return true;
|
||||
}
|
||||
|
||||
PParentToChildStreamChild*
|
||||
SocketProcessChild::AllocPParentToChildStreamChild() {
|
||||
return mozilla::ipc::AllocPParentToChildStreamChild();
|
||||
}
|
||||
|
||||
bool SocketProcessChild::DeallocPParentToChildStreamChild(
|
||||
PParentToChildStreamChild* aActor) {
|
||||
delete aActor;
|
||||
return true;
|
||||
}
|
||||
|
||||
PChildToParentStreamChild*
|
||||
SocketProcessChild::SendPChildToParentStreamConstructor(
|
||||
PChildToParentStreamChild* aActor) {
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
return PSocketProcessChild::SendPChildToParentStreamConstructor(aActor);
|
||||
}
|
||||
|
||||
PFileDescriptorSetChild* SocketProcessChild::SendPFileDescriptorSetConstructor(
|
||||
const FileDescriptor& aFD) {
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
return PSocketProcessChild::SendPFileDescriptorSetConstructor(aFD);
|
||||
}
|
||||
|
||||
} // namespace net
|
||||
} // namespace mozilla
|
||||
|
@ -7,6 +7,7 @@
|
||||
#define mozilla_net_SocketProcessChild_h
|
||||
|
||||
#include "mozilla/net/PSocketProcessChild.h"
|
||||
#include "mozilla/ipc/InputStreamUtils.h"
|
||||
#include "nsRefPtrHashtable.h"
|
||||
|
||||
namespace mozilla {
|
||||
@ -20,7 +21,9 @@ class SocketProcessBridgeParent;
|
||||
|
||||
// The IPC actor implements PSocketProcessChild in child process.
|
||||
// This is allocated and kept alive by SocketProcessImpl.
|
||||
class SocketProcessChild final : public PSocketProcessChild {
|
||||
class SocketProcessChild final
|
||||
: public PSocketProcessChild,
|
||||
public mozilla::ipc::ChildToParentStreamActorManager {
|
||||
public:
|
||||
SocketProcessChild();
|
||||
~SocketProcessChild();
|
||||
@ -48,9 +51,23 @@ class SocketProcessChild final : public PSocketProcessChild {
|
||||
PWebrtcTCPSocketChild* AllocPWebrtcTCPSocketChild(const Maybe<TabId>& tabId);
|
||||
bool DeallocPWebrtcTCPSocketChild(PWebrtcTCPSocketChild* aActor);
|
||||
|
||||
PFileDescriptorSetChild* AllocPFileDescriptorSetChild(
|
||||
const FileDescriptor& fd);
|
||||
bool DeallocPFileDescriptorSetChild(PFileDescriptorSetChild* aActor);
|
||||
|
||||
PChildToParentStreamChild* AllocPChildToParentStreamChild();
|
||||
bool DeallocPChildToParentStreamChild(PChildToParentStreamChild* aActor);
|
||||
PParentToChildStreamChild* AllocPParentToChildStreamChild();
|
||||
bool DeallocPParentToChildStreamChild(PParentToChildStreamChild* aActor);
|
||||
|
||||
void CleanUp();
|
||||
void DestroySocketProcessBridgeParent(ProcessId aId);
|
||||
|
||||
PChildToParentStreamChild* SendPChildToParentStreamConstructor(
|
||||
PChildToParentStreamChild* aActor) override;
|
||||
PFileDescriptorSetChild* SendPFileDescriptorSetConstructor(
|
||||
const FileDescriptor& aFD) override;
|
||||
|
||||
private:
|
||||
// Mapping of content process id and the SocketProcessBridgeParent.
|
||||
// This table keeps SocketProcessBridgeParent alive in socket process.
|
||||
|
@ -6,6 +6,7 @@
|
||||
#include "SocketProcessParent.h"
|
||||
|
||||
#include "SocketProcessHost.h"
|
||||
#include "mozilla/ipc/FileDescriptorSetParent.h"
|
||||
#include "mozilla/net/DNSRequestParent.h"
|
||||
#include "mozilla/Telemetry.h"
|
||||
#include "mozilla/TelemetryIPC.h"
|
||||
@ -156,6 +157,53 @@ mozilla::ipc::IPCResult SocketProcessParent::RecvPDNSRequestConstructor(
|
||||
return IPC_OK();
|
||||
}
|
||||
|
||||
PFileDescriptorSetParent* SocketProcessParent::AllocPFileDescriptorSetParent(
|
||||
const FileDescriptor& aFD) {
|
||||
return new FileDescriptorSetParent(aFD);
|
||||
}
|
||||
|
||||
bool SocketProcessParent::DeallocPFileDescriptorSetParent(
|
||||
PFileDescriptorSetParent* aActor) {
|
||||
delete static_cast<FileDescriptorSetParent*>(aActor);
|
||||
return true;
|
||||
}
|
||||
|
||||
PChildToParentStreamParent*
|
||||
SocketProcessParent::AllocPChildToParentStreamParent() {
|
||||
return mozilla::ipc::AllocPChildToParentStreamParent();
|
||||
}
|
||||
|
||||
bool SocketProcessParent::DeallocPChildToParentStreamParent(
|
||||
PChildToParentStreamParent* aActor) {
|
||||
delete aActor;
|
||||
return true;
|
||||
}
|
||||
|
||||
PParentToChildStreamParent*
|
||||
SocketProcessParent::AllocPParentToChildStreamParent() {
|
||||
MOZ_CRASH("PParentToChildStreamChild actors should be manually constructed!");
|
||||
}
|
||||
|
||||
bool SocketProcessParent::DeallocPParentToChildStreamParent(
|
||||
PParentToChildStreamParent* aActor) {
|
||||
delete aActor;
|
||||
return true;
|
||||
}
|
||||
|
||||
PParentToChildStreamParent*
|
||||
SocketProcessParent::SendPParentToChildStreamConstructor(
|
||||
PParentToChildStreamParent* aActor) {
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
return PSocketProcessParent::SendPParentToChildStreamConstructor(aActor);
|
||||
}
|
||||
|
||||
PFileDescriptorSetParent*
|
||||
SocketProcessParent::SendPFileDescriptorSetConstructor(
|
||||
const FileDescriptor& aFD) {
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
return PSocketProcessParent::SendPFileDescriptorSetConstructor(aFD);
|
||||
}
|
||||
|
||||
// To ensure that IPDL is finished before SocketParent gets deleted.
|
||||
class DeferredDeleteSocketProcessParent : public Runnable {
|
||||
public:
|
||||
|
@ -8,6 +8,7 @@
|
||||
|
||||
#include "mozilla/UniquePtr.h"
|
||||
#include "mozilla/ipc/CrashReporterHelper.h"
|
||||
#include "mozilla/ipc/InputStreamUtils.h"
|
||||
#include "mozilla/net/PSocketProcessParent.h"
|
||||
|
||||
namespace mozilla {
|
||||
@ -29,7 +30,8 @@ class SocketProcessHost;
|
||||
// by SocketProcessHost.
|
||||
class SocketProcessParent final
|
||||
: public PSocketProcessParent,
|
||||
public ipc::CrashReporterHelper<GeckoProcessType_Socket> {
|
||||
public ipc::CrashReporterHelper<GeckoProcessType_Socket>,
|
||||
public ipc::ParentToChildStreamActorManager {
|
||||
public:
|
||||
friend class SocketProcessHost;
|
||||
|
||||
@ -70,6 +72,20 @@ class SocketProcessParent final
|
||||
const bool& aMinimizeMemoryUsage,
|
||||
const Maybe<ipc::FileDescriptor>& aDMDFile);
|
||||
|
||||
PFileDescriptorSetParent* AllocPFileDescriptorSetParent(
|
||||
const FileDescriptor& fd);
|
||||
bool DeallocPFileDescriptorSetParent(PFileDescriptorSetParent* aActor);
|
||||
|
||||
PChildToParentStreamParent* AllocPChildToParentStreamParent();
|
||||
bool DeallocPChildToParentStreamParent(PChildToParentStreamParent* aActor);
|
||||
PParentToChildStreamParent* AllocPParentToChildStreamParent();
|
||||
bool DeallocPParentToChildStreamParent(PParentToChildStreamParent* aActor);
|
||||
|
||||
PParentToChildStreamParent* SendPParentToChildStreamConstructor(
|
||||
PParentToChildStreamParent* aActor) override;
|
||||
PFileDescriptorSetParent* SendPFileDescriptorSetConstructor(
|
||||
const FileDescriptor& aFD) override;
|
||||
|
||||
private:
|
||||
SocketProcessHost* mHost;
|
||||
UniquePtr<dom::MemoryReportRequestHost> mMemoryReportRequest;
|
||||
|
@ -260,7 +260,7 @@ void InputStreamLengthWrapper::Serialize(
|
||||
mozilla::ipc::InputStreamParams& aParams,
|
||||
FileDescriptorArray& aFileDescriptors, bool aDelayedStart,
|
||||
uint32_t aMaxSize, uint32_t* aSizeUsed,
|
||||
mozilla::dom::ContentChild* aManager) {
|
||||
mozilla::ipc::ParentToChildStreamActorManager* aManager) {
|
||||
SerializeInternal(aParams, aFileDescriptors, aDelayedStart, aMaxSize,
|
||||
aSizeUsed, aManager);
|
||||
}
|
||||
@ -269,25 +269,7 @@ void InputStreamLengthWrapper::Serialize(
|
||||
mozilla::ipc::InputStreamParams& aParams,
|
||||
FileDescriptorArray& aFileDescriptors, bool aDelayedStart,
|
||||
uint32_t aMaxSize, uint32_t* aSizeUsed,
|
||||
mozilla::ipc::PBackgroundChild* aManager) {
|
||||
SerializeInternal(aParams, aFileDescriptors, aDelayedStart, aMaxSize,
|
||||
aSizeUsed, aManager);
|
||||
}
|
||||
|
||||
void InputStreamLengthWrapper::Serialize(
|
||||
mozilla::ipc::InputStreamParams& aParams,
|
||||
FileDescriptorArray& aFileDescriptors, bool aDelayedStart,
|
||||
uint32_t aMaxSize, uint32_t* aSizeUsed,
|
||||
mozilla::dom::ContentParent* aManager) {
|
||||
SerializeInternal(aParams, aFileDescriptors, aDelayedStart, aMaxSize,
|
||||
aSizeUsed, aManager);
|
||||
}
|
||||
|
||||
void InputStreamLengthWrapper::Serialize(
|
||||
mozilla::ipc::InputStreamParams& aParams,
|
||||
FileDescriptorArray& aFileDescriptors, bool aDelayedStart,
|
||||
uint32_t aMaxSize, uint32_t* aSizeUsed,
|
||||
mozilla::ipc::PBackgroundParent* aManager) {
|
||||
mozilla::ipc::ChildToParentStreamActorManager* aManager) {
|
||||
SerializeInternal(aParams, aFileDescriptors, aDelayedStart, aMaxSize,
|
||||
aSizeUsed, aManager);
|
||||
}
|
||||
|
@ -321,7 +321,7 @@ void NonBlockingAsyncInputStream::Serialize(
|
||||
mozilla::ipc::InputStreamParams& aParams,
|
||||
FileDescriptorArray& aFileDescriptors, bool aDelayedStart,
|
||||
uint32_t aMaxSize, uint32_t* aSizeUsed,
|
||||
mozilla::dom::ContentChild* aManager) {
|
||||
mozilla::ipc::ParentToChildStreamActorManager* aManager) {
|
||||
SerializeInternal(aParams, aFileDescriptors, aDelayedStart, aMaxSize,
|
||||
aSizeUsed, aManager);
|
||||
}
|
||||
@ -330,25 +330,7 @@ void NonBlockingAsyncInputStream::Serialize(
|
||||
mozilla::ipc::InputStreamParams& aParams,
|
||||
FileDescriptorArray& aFileDescriptors, bool aDelayedStart,
|
||||
uint32_t aMaxSize, uint32_t* aSizeUsed,
|
||||
mozilla::ipc::PBackgroundChild* aManager) {
|
||||
SerializeInternal(aParams, aFileDescriptors, aDelayedStart, aMaxSize,
|
||||
aSizeUsed, aManager);
|
||||
}
|
||||
|
||||
void NonBlockingAsyncInputStream::Serialize(
|
||||
mozilla::ipc::InputStreamParams& aParams,
|
||||
FileDescriptorArray& aFileDescriptors, bool aDelayedStart,
|
||||
uint32_t aMaxSize, uint32_t* aSizeUsed,
|
||||
mozilla::dom::ContentParent* aManager) {
|
||||
SerializeInternal(aParams, aFileDescriptors, aDelayedStart, aMaxSize,
|
||||
aSizeUsed, aManager);
|
||||
}
|
||||
|
||||
void NonBlockingAsyncInputStream::Serialize(
|
||||
mozilla::ipc::InputStreamParams& aParams,
|
||||
FileDescriptorArray& aFileDescriptors, bool aDelayedStart,
|
||||
uint32_t aMaxSize, uint32_t* aSizeUsed,
|
||||
mozilla::ipc::PBackgroundParent* aManager) {
|
||||
mozilla::ipc::ChildToParentStreamActorManager* aManager) {
|
||||
SerializeInternal(aParams, aFileDescriptors, aDelayedStart, aMaxSize,
|
||||
aSizeUsed, aManager);
|
||||
}
|
||||
|
@ -420,38 +420,20 @@ SlicedInputStream::OnInputStreamReady(nsIAsyncInputStream* aStream) {
|
||||
|
||||
// nsIIPCSerializableInputStream
|
||||
|
||||
void SlicedInputStream::Serialize(mozilla::ipc::InputStreamParams& aParams,
|
||||
FileDescriptorArray& aFileDescriptors,
|
||||
bool aDelayedStart, uint32_t aMaxSize,
|
||||
uint32_t* aSizeUsed,
|
||||
mozilla::dom::ContentChild* aManager) {
|
||||
void SlicedInputStream::Serialize(
|
||||
mozilla::ipc::InputStreamParams& aParams,
|
||||
FileDescriptorArray& aFileDescriptors, bool aDelayedStart,
|
||||
uint32_t aMaxSize, uint32_t* aSizeUsed,
|
||||
mozilla::ipc::ParentToChildStreamActorManager* aManager) {
|
||||
SerializeInternal(aParams, aFileDescriptors, aDelayedStart, aMaxSize,
|
||||
aSizeUsed, aManager);
|
||||
}
|
||||
|
||||
void SlicedInputStream::Serialize(mozilla::ipc::InputStreamParams& aParams,
|
||||
FileDescriptorArray& aFileDescriptors,
|
||||
bool aDelayedStart, uint32_t aMaxSize,
|
||||
uint32_t* aSizeUsed,
|
||||
mozilla::ipc::PBackgroundChild* aManager) {
|
||||
SerializeInternal(aParams, aFileDescriptors, aDelayedStart, aMaxSize,
|
||||
aSizeUsed, aManager);
|
||||
}
|
||||
|
||||
void SlicedInputStream::Serialize(mozilla::ipc::InputStreamParams& aParams,
|
||||
FileDescriptorArray& aFileDescriptors,
|
||||
bool aDelayedStart, uint32_t aMaxSize,
|
||||
uint32_t* aSizeUsed,
|
||||
mozilla::dom::ContentParent* aManager) {
|
||||
SerializeInternal(aParams, aFileDescriptors, aDelayedStart, aMaxSize,
|
||||
aSizeUsed, aManager);
|
||||
}
|
||||
|
||||
void SlicedInputStream::Serialize(mozilla::ipc::InputStreamParams& aParams,
|
||||
FileDescriptorArray& aFileDescriptors,
|
||||
bool aDelayedStart, uint32_t aMaxSize,
|
||||
uint32_t* aSizeUsed,
|
||||
mozilla::ipc::PBackgroundParent* aManager) {
|
||||
void SlicedInputStream::Serialize(
|
||||
mozilla::ipc::InputStreamParams& aParams,
|
||||
FileDescriptorArray& aFileDescriptors, bool aDelayedStart,
|
||||
uint32_t aMaxSize, uint32_t* aSizeUsed,
|
||||
mozilla::ipc::ChildToParentStreamActorManager* aManager) {
|
||||
SerializeInternal(aParams, aFileDescriptors, aDelayedStart, aMaxSize,
|
||||
aSizeUsed, aManager);
|
||||
}
|
||||
|
@ -990,38 +990,18 @@ nsresult nsMultiplexInputStreamConstructor(nsISupports* aOuter, REFNSIID aIID,
|
||||
return inst->QueryInterface(aIID, aResult);
|
||||
}
|
||||
|
||||
void nsMultiplexInputStream::Serialize(InputStreamParams& aParams,
|
||||
FileDescriptorArray& aFileDescriptors,
|
||||
bool aDelayedStart, uint32_t aMaxSize,
|
||||
uint32_t* aSizeUsed,
|
||||
mozilla::dom::ContentChild* aManager) {
|
||||
void nsMultiplexInputStream::Serialize(
|
||||
InputStreamParams& aParams, FileDescriptorArray& aFileDescriptors,
|
||||
bool aDelayedStart, uint32_t aMaxSize, uint32_t* aSizeUsed,
|
||||
mozilla::ipc::ParentToChildStreamActorManager* aManager) {
|
||||
SerializeInternal(aParams, aFileDescriptors, aDelayedStart, aMaxSize,
|
||||
aSizeUsed, aManager);
|
||||
}
|
||||
|
||||
void nsMultiplexInputStream::Serialize(InputStreamParams& aParams,
|
||||
FileDescriptorArray& aFileDescriptors,
|
||||
bool aDelayedStart, uint32_t aMaxSize,
|
||||
uint32_t* aSizeUsed,
|
||||
PBackgroundChild* aManager) {
|
||||
SerializeInternal(aParams, aFileDescriptors, aDelayedStart, aMaxSize,
|
||||
aSizeUsed, aManager);
|
||||
}
|
||||
|
||||
void nsMultiplexInputStream::Serialize(InputStreamParams& aParams,
|
||||
FileDescriptorArray& aFileDescriptors,
|
||||
bool aDelayedStart, uint32_t aMaxSize,
|
||||
uint32_t* aSizeUsed,
|
||||
mozilla::dom::ContentParent* aManager) {
|
||||
SerializeInternal(aParams, aFileDescriptors, aDelayedStart, aMaxSize,
|
||||
aSizeUsed, aManager);
|
||||
}
|
||||
|
||||
void nsMultiplexInputStream::Serialize(InputStreamParams& aParams,
|
||||
FileDescriptorArray& aFileDescriptors,
|
||||
bool aDelayedStart, uint32_t aMaxSize,
|
||||
uint32_t* aSizeUsed,
|
||||
PBackgroundParent* aManager) {
|
||||
void nsMultiplexInputStream::Serialize(
|
||||
InputStreamParams& aParams, FileDescriptorArray& aFileDescriptors,
|
||||
bool aDelayedStart, uint32_t aMaxSize, uint32_t* aSizeUsed,
|
||||
mozilla::ipc::ChildToParentStreamActorManager* aManager) {
|
||||
SerializeInternal(aParams, aFileDescriptors, aDelayedStart, aMaxSize,
|
||||
aSizeUsed, aManager);
|
||||
}
|
||||
|
@ -550,31 +550,17 @@ nsresult nsStorageInputStream::Seek(uint32_t aPosition) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void nsStorageInputStream::Serialize(InputStreamParams& aParams,
|
||||
FileDescriptorArray&, bool aDelayedStart,
|
||||
uint32_t aMaxSize, uint32_t* aSizeUsed,
|
||||
mozilla::dom::ContentChild* aManager) {
|
||||
SerializeInternal(aParams, aDelayedStart, aMaxSize, aSizeUsed, aManager);
|
||||
}
|
||||
|
||||
void nsStorageInputStream::Serialize(InputStreamParams& aParams,
|
||||
FileDescriptorArray&, bool aDelayedStart,
|
||||
uint32_t aMaxSize, uint32_t* aSizeUsed,
|
||||
mozilla::ipc::PBackgroundChild* aManager) {
|
||||
SerializeInternal(aParams, aDelayedStart, aMaxSize, aSizeUsed, aManager);
|
||||
}
|
||||
|
||||
void nsStorageInputStream::Serialize(InputStreamParams& aParams,
|
||||
FileDescriptorArray&, bool aDelayedStart,
|
||||
uint32_t aMaxSize, uint32_t* aSizeUsed,
|
||||
mozilla::dom::ContentParent* aManager) {
|
||||
void nsStorageInputStream::Serialize(
|
||||
InputStreamParams& aParams, FileDescriptorArray&, bool aDelayedStart,
|
||||
uint32_t aMaxSize, uint32_t* aSizeUsed,
|
||||
mozilla::ipc::ParentToChildStreamActorManager* aManager) {
|
||||
SerializeInternal(aParams, aDelayedStart, aMaxSize, aSizeUsed, aManager);
|
||||
}
|
||||
|
||||
void nsStorageInputStream::Serialize(
|
||||
InputStreamParams& aParams, FileDescriptorArray&, bool aDelayedStart,
|
||||
uint32_t aMaxSize, uint32_t* aSizeUsed,
|
||||
mozilla::ipc::PBackgroundParent* aManager) {
|
||||
mozilla::ipc::ChildToParentStreamActorManager* aManager) {
|
||||
SerializeInternal(aParams, aDelayedStart, aMaxSize, aSizeUsed, aManager);
|
||||
}
|
||||
|
||||
|
@ -389,35 +389,17 @@ nsStringInputStream::Tell(int64_t* aOutWhere) {
|
||||
// nsIIPCSerializableInputStream implementation
|
||||
/////////
|
||||
|
||||
void nsStringInputStream::Serialize(InputStreamParams& aParams,
|
||||
FileDescriptorArray& /* aFDs */,
|
||||
bool aDelayedStart, uint32_t aMaxSize,
|
||||
uint32_t* aSizeUsed,
|
||||
mozilla::dom::ContentChild* aManager) {
|
||||
void nsStringInputStream::Serialize(
|
||||
InputStreamParams& aParams, FileDescriptorArray& /* aFDs */,
|
||||
bool aDelayedStart, uint32_t aMaxSize, uint32_t* aSizeUsed,
|
||||
mozilla::ipc::ParentToChildStreamActorManager* aManager) {
|
||||
SerializeInternal(aParams, aDelayedStart, aMaxSize, aSizeUsed, aManager);
|
||||
}
|
||||
|
||||
void nsStringInputStream::Serialize(InputStreamParams& aParams,
|
||||
FileDescriptorArray& /* aFDs */,
|
||||
bool aDelayedStart, uint32_t aMaxSize,
|
||||
uint32_t* aSizeUsed,
|
||||
PBackgroundChild* aManager) {
|
||||
SerializeInternal(aParams, aDelayedStart, aMaxSize, aSizeUsed, aManager);
|
||||
}
|
||||
|
||||
void nsStringInputStream::Serialize(InputStreamParams& aParams,
|
||||
FileDescriptorArray& /* aFDs */,
|
||||
bool aDelayedStart, uint32_t aMaxSize,
|
||||
uint32_t* aSizeUsed,
|
||||
mozilla::dom::ContentParent* aManager) {
|
||||
SerializeInternal(aParams, aDelayedStart, aMaxSize, aSizeUsed, aManager);
|
||||
}
|
||||
|
||||
void nsStringInputStream::Serialize(InputStreamParams& aParams,
|
||||
FileDescriptorArray& /* aFDs */,
|
||||
bool aDelayedStart, uint32_t aMaxSize,
|
||||
uint32_t* aSizeUsed,
|
||||
PBackgroundParent* aManager) {
|
||||
void nsStringInputStream::Serialize(
|
||||
InputStreamParams& aParams, FileDescriptorArray& /* aFDs */,
|
||||
bool aDelayedStart, uint32_t aMaxSize, uint32_t* aSizeUsed,
|
||||
mozilla::ipc::ChildToParentStreamActorManager* aManager) {
|
||||
SerializeInternal(aParams, aDelayedStart, aMaxSize, aSizeUsed, aManager);
|
||||
}
|
||||
|
||||
|
@ -274,15 +274,11 @@ class QIInputStream final : public nsIInputStream,
|
||||
|
||||
// nsIIPCSerializableInputStream
|
||||
void Serialize(mozilla::ipc::InputStreamParams&, FileDescriptorArray&, bool,
|
||||
uint32_t, uint32_t*, mozilla::dom::ContentChild*) override {}
|
||||
uint32_t, uint32_t*,
|
||||
mozilla::ipc::ParentToChildStreamActorManager*) override {}
|
||||
void Serialize(mozilla::ipc::InputStreamParams&, FileDescriptorArray&, bool,
|
||||
uint32_t, uint32_t*,
|
||||
mozilla::ipc::PBackgroundChild*) override {}
|
||||
void Serialize(mozilla::ipc::InputStreamParams&, FileDescriptorArray&, bool,
|
||||
uint32_t, uint32_t*, mozilla::dom::ContentParent*) override {}
|
||||
void Serialize(mozilla::ipc::InputStreamParams&, FileDescriptorArray&, bool,
|
||||
uint32_t, uint32_t*,
|
||||
mozilla::ipc::PBackgroundParent*) override {}
|
||||
mozilla::ipc::ChildToParentStreamActorManager*) override {}
|
||||
bool Deserialize(const mozilla::ipc::InputStreamParams&,
|
||||
const FileDescriptorArray&) override {
|
||||
return false;
|
||||
|
Loading…
Reference in New Issue
Block a user