2014-06-11 05:44:13 +00:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
2015-05-03 19:32:37 +00:00
|
|
|
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
2014-06-11 05:44:13 +00:00
|
|
|
/* 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_ContentBridgeChild_h
|
|
|
|
#define mozilla_dom_ContentBridgeChild_h
|
|
|
|
|
|
|
|
#include "mozilla/dom/PContentBridgeChild.h"
|
|
|
|
#include "mozilla/dom/nsIContentChild.h"
|
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
namespace dom {
|
|
|
|
|
2015-03-21 16:28:04 +00:00
|
|
|
class ContentBridgeChild final : public PContentBridgeChild
|
2015-03-27 18:52:19 +00:00
|
|
|
, public nsIContentChild
|
2014-06-11 05:44:13 +00:00
|
|
|
{
|
|
|
|
public:
|
2017-01-26 23:05:36 +00:00
|
|
|
explicit ContentBridgeChild();
|
2014-06-11 05:44:13 +00:00
|
|
|
|
|
|
|
NS_DECL_ISUPPORTS
|
|
|
|
|
2017-01-26 22:40:17 +00:00
|
|
|
static void
|
|
|
|
Create(Endpoint<PContentBridgeChild>&& aEndpoint);
|
2014-06-11 05:44:13 +00:00
|
|
|
|
2015-03-21 16:28:04 +00:00
|
|
|
virtual void ActorDestroy(ActorDestroyReason aWhy) override;
|
2014-06-11 05:44:13 +00:00
|
|
|
void DeferredDestroy();
|
|
|
|
|
2016-11-15 03:26:00 +00:00
|
|
|
virtual mozilla::ipc::IPCResult RecvAsyncMessage(const nsString& aMsg,
|
|
|
|
InfallibleTArray<jsipc::CpowEntry>&& aCpows,
|
|
|
|
const IPC::Principal& aPrincipal,
|
|
|
|
const ClonedMessageData& aData) override;
|
2014-06-11 05:44:13 +00:00
|
|
|
|
2015-03-21 16:28:04 +00:00
|
|
|
jsipc::CPOWManager* GetCPOWManager() override;
|
2014-06-11 05:44:13 +00:00
|
|
|
|
|
|
|
virtual bool SendPBrowserConstructor(PBrowserChild* aActor,
|
2014-10-29 18:11:00 +00:00
|
|
|
const TabId& aTabId,
|
2017-04-06 23:46:18 +00:00
|
|
|
const TabId& aSameTabGroupAs,
|
2014-06-11 05:44:13 +00:00
|
|
|
const IPCTabContext& aContext,
|
|
|
|
const uint32_t& aChromeFlags,
|
2014-10-24 00:28:00 +00:00
|
|
|
const ContentParentId& aCpID,
|
2015-03-21 16:28:04 +00:00
|
|
|
const bool& aIsForBrowser) override;
|
2014-06-11 05:44:13 +00:00
|
|
|
|
2016-09-21 10:27:26 +00:00
|
|
|
virtual mozilla::ipc::PFileDescriptorSetChild*
|
|
|
|
SendPFileDescriptorSetConstructor(const mozilla::ipc::FileDescriptor&) override;
|
|
|
|
|
2017-03-14 11:28:58 +00:00
|
|
|
virtual mozilla::ipc::PChildToParentStreamChild*
|
|
|
|
SendPChildToParentStreamConstructor(mozilla::ipc::PChildToParentStreamChild*) override;
|
2016-09-21 10:27:26 +00:00
|
|
|
|
2017-03-15 01:00:00 +00:00
|
|
|
virtual mozilla::ipc::IPCResult RecvActivate(PBrowserChild* aTab) override;
|
|
|
|
|
|
|
|
virtual mozilla::ipc::IPCResult RecvDeactivate(PBrowserChild* aTab) override;
|
|
|
|
|
2017-05-02 09:57:51 +00:00
|
|
|
virtual already_AddRefed<nsIEventTarget> GetEventTargetFor(TabChild* aTabChild) override;
|
|
|
|
|
2016-06-15 16:57:46 +00:00
|
|
|
FORWARD_SHMEM_ALLOCATOR_TO(PContentBridgeChild)
|
|
|
|
|
2014-06-11 05:44:13 +00:00
|
|
|
protected:
|
2014-06-23 19:56:07 +00:00
|
|
|
virtual ~ContentBridgeChild();
|
|
|
|
|
2014-10-29 18:11:00 +00:00
|
|
|
virtual PBrowserChild* AllocPBrowserChild(const TabId& aTabId,
|
2017-04-06 23:46:18 +00:00
|
|
|
const TabId& aSameTabGroupAs,
|
2014-10-29 18:11:00 +00:00
|
|
|
const IPCTabContext& aContext,
|
2014-06-11 05:44:13 +00:00
|
|
|
const uint32_t& aChromeFlags,
|
2014-10-24 00:28:00 +00:00
|
|
|
const ContentParentId& aCpID,
|
2015-03-21 16:28:04 +00:00
|
|
|
const bool& aIsForBrowser) override;
|
|
|
|
virtual bool DeallocPBrowserChild(PBrowserChild*) override;
|
2016-11-15 03:26:00 +00:00
|
|
|
virtual mozilla::ipc::IPCResult RecvPBrowserConstructor(PBrowserChild* aCctor,
|
|
|
|
const TabId& aTabId,
|
2017-04-06 23:46:18 +00:00
|
|
|
const TabId& aSameTabGroupAs,
|
2016-11-15 03:26:00 +00:00
|
|
|
const IPCTabContext& aContext,
|
|
|
|
const uint32_t& aChromeFlags,
|
|
|
|
const ContentParentId& aCpID,
|
|
|
|
const bool& aIsForBrowser) override;
|
2014-06-11 05:44:13 +00:00
|
|
|
|
2015-03-21 16:28:04 +00:00
|
|
|
virtual mozilla::jsipc::PJavaScriptChild* AllocPJavaScriptChild() override;
|
|
|
|
virtual bool DeallocPJavaScriptChild(mozilla::jsipc::PJavaScriptChild*) override;
|
2014-06-11 05:44:13 +00:00
|
|
|
|
Bug 1353629 - PBlob refactoring - part 4 - IPCBlobInputStream, r=smaug
IPCBlobInputStream is a new type of nsIInputStream that is used only in content
process when a Blob is sent from parent to child. This inputStream is for now,
just cloneable.
When the parent process sends a Blob to a content process, it has the Blob and
its inputStream. With its inputStream it creates a IPCBlobInputStreamParent
actor. This actor keeps the inputStream alive for following uses (not part of
this patch).
On the child side we will have, of course, a IPCBlobInputStreamChild actor.
This actor is able to create a IPCBlobInputStream when CreateStream() is
called. This means that 1 IPCBlobInputStreamChild can manage multiple
IPCBlobInputStreams each time one of them is cloned. When the last one of this
stream is released, the child actor sends a __delete__ request to the parent
side; the parent will be deleted, and the original inputStream, on the parent
side, will be released as well.
IPCBlobInputStream is a special inputStream because each method, except for
Available() fails. Basically, this inputStream cannot be used on the content
process for nothing else than knowing the size of the original stream.
In the following patches, I'll introduce an async way to use it.
2017-04-24 10:09:40 +00:00
|
|
|
virtual PIPCBlobInputStreamChild*
|
|
|
|
AllocPIPCBlobInputStreamChild(const nsID& aID,
|
|
|
|
const uint64_t& aSize) override;
|
|
|
|
|
|
|
|
virtual bool
|
|
|
|
DeallocPIPCBlobInputStreamChild(PIPCBlobInputStreamChild*) override;
|
|
|
|
|
2017-03-14 11:28:58 +00:00
|
|
|
virtual mozilla::ipc::PChildToParentStreamChild*
|
|
|
|
AllocPChildToParentStreamChild() override;
|
2016-09-21 10:27:26 +00:00
|
|
|
|
|
|
|
virtual bool
|
2017-03-14 11:28:58 +00:00
|
|
|
DeallocPChildToParentStreamChild(mozilla::ipc::PChildToParentStreamChild* aActor) override;
|
2016-09-21 10:27:26 +00:00
|
|
|
|
2017-03-14 11:29:43 +00:00
|
|
|
virtual PParentToChildStreamChild* AllocPParentToChildStreamChild() override;
|
|
|
|
|
|
|
|
virtual bool
|
|
|
|
DeallocPParentToChildStreamChild(PParentToChildStreamChild* aActor) override;
|
|
|
|
|
2016-09-21 10:27:26 +00:00
|
|
|
virtual PFileDescriptorSetChild*
|
|
|
|
AllocPFileDescriptorSetChild(const mozilla::ipc::FileDescriptor& aFD) override;
|
|
|
|
|
|
|
|
virtual bool
|
|
|
|
DeallocPFileDescriptorSetChild(mozilla::ipc::PFileDescriptorSetChild* aActor) override;
|
|
|
|
|
2014-06-11 05:44:13 +00:00
|
|
|
DISALLOW_EVIL_CONSTRUCTORS(ContentBridgeChild);
|
|
|
|
|
2017-05-02 09:57:51 +00:00
|
|
|
private:
|
|
|
|
virtual already_AddRefed<nsIEventTarget>
|
|
|
|
GetConstructedEventTarget(const Message& aMsg) override;
|
|
|
|
|
2014-06-11 05:44:13 +00:00
|
|
|
protected: // members
|
2015-10-18 05:24:48 +00:00
|
|
|
RefPtr<ContentBridgeChild> mSelfRef;
|
2014-06-11 05:44:13 +00:00
|
|
|
};
|
|
|
|
|
2015-07-13 15:25:42 +00:00
|
|
|
} // namespace dom
|
|
|
|
} // namespace mozilla
|
2014-06-11 05:44:13 +00:00
|
|
|
|
|
|
|
#endif // mozilla_dom_ContentBridgeChild_h
|