LCOV - code coverage report
Current view: top level - dom/ipc - ContentBridgeChild.cpp (source / functions) Hit Total Coverage
Test: output.info Lines: 0 74 0.0 %
Date: 2017-07-14 16:53:18 Functions: 0 32 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
       2             : /* vim: set ts=8 sts=2 et sw=2 tw=80: */
       3             : /* This Source Code Form is subject to the terms of the Mozilla Public
       4             :  * License, v. 2.0. If a copy of the MPL was not distributed with this file,
       5             :  * You can obtain one at http://mozilla.org/MPL/2.0/. */
       6             : 
       7             : #include "mozilla/dom/ContentBridgeChild.h"
       8             : #include "mozilla/dom/ContentChild.h"
       9             : #include "mozilla/dom/File.h"
      10             : #include "mozilla/dom/TabChild.h"
      11             : #include "mozilla/dom/TabGroup.h"
      12             : #include "mozilla/jsipc/CrossProcessObjectWrappers.h"
      13             : #include "mozilla/ipc/InputStreamUtils.h"
      14             : #include "base/task.h"
      15             : 
      16             : using namespace mozilla::ipc;
      17             : using namespace mozilla::jsipc;
      18             : 
      19             : namespace mozilla {
      20             : namespace dom {
      21             : 
      22           0 : NS_IMPL_ISUPPORTS(ContentBridgeChild,
      23             :                   nsIContentChild)
      24             : 
      25           0 : ContentBridgeChild::ContentBridgeChild()
      26           0 : {}
      27             : 
      28           0 : ContentBridgeChild::~ContentBridgeChild()
      29             : {
      30           0 : }
      31             : 
      32             : void
      33           0 : ContentBridgeChild::ActorDestroy(ActorDestroyReason aWhy)
      34             : {
      35           0 :   MessageLoop::current()->PostTask(
      36           0 :     NewRunnableMethod("dom::ContentBridgeChild::DeferredDestroy",
      37             :                       this,
      38           0 :                       &ContentBridgeChild::DeferredDestroy));
      39           0 : }
      40             : 
      41             : /*static*/ void
      42           0 : ContentBridgeChild::Create(Endpoint<PContentBridgeChild>&& aEndpoint)
      43             : {
      44           0 :   RefPtr<ContentBridgeChild> bridge = new ContentBridgeChild();
      45           0 :   bridge->mSelfRef = bridge;
      46             : 
      47           0 :   DebugOnly<bool> ok = aEndpoint.Bind(bridge);
      48           0 :   MOZ_ASSERT(ok);
      49           0 : }
      50             : 
      51             : void
      52           0 : ContentBridgeChild::DeferredDestroy()
      53             : {
      54           0 :   mSelfRef = nullptr;
      55             :   // |this| was just destroyed, hands off
      56           0 : }
      57             : 
      58             : mozilla::ipc::IPCResult
      59           0 : ContentBridgeChild::RecvAsyncMessage(const nsString& aMsg,
      60             :                                      InfallibleTArray<jsipc::CpowEntry>&& aCpows,
      61             :                                      const IPC::Principal& aPrincipal,
      62             :                                      const ClonedMessageData& aData)
      63             : {
      64           0 :   return nsIContentChild::RecvAsyncMessage(aMsg, Move(aCpows), aPrincipal, aData);
      65             : }
      66             : 
      67             : bool
      68           0 : ContentBridgeChild::SendPBrowserConstructor(PBrowserChild* aActor,
      69             :                                             const TabId& aTabId,
      70             :                                             const TabId& aSameTabGroupAs,
      71             :                                             const IPCTabContext& aContext,
      72             :                                             const uint32_t& aChromeFlags,
      73             :                                             const ContentParentId& aCpID,
      74             :                                             const bool& aIsForBrowser)
      75             : {
      76           0 :   return PContentBridgeChild::SendPBrowserConstructor(aActor,
      77             :                                                       aTabId,
      78             :                                                       aSameTabGroupAs,
      79             :                                                       aContext,
      80             :                                                       aChromeFlags,
      81             :                                                       aCpID,
      82           0 :                                                       aIsForBrowser);
      83             : }
      84             : 
      85             : PFileDescriptorSetChild*
      86           0 : ContentBridgeChild::SendPFileDescriptorSetConstructor(const FileDescriptor& aFD)
      87             : {
      88           0 :   return PContentBridgeChild::SendPFileDescriptorSetConstructor(aFD);
      89             : }
      90             : 
      91             : PChildToParentStreamChild*
      92           0 : ContentBridgeChild::SendPChildToParentStreamConstructor(PChildToParentStreamChild* aActor)
      93             : {
      94           0 :   return PContentBridgeChild::SendPChildToParentStreamConstructor(aActor);
      95             : }
      96             : 
      97             : // This implementation is identical to ContentChild::GetCPOWManager but we can't
      98             : // move it to nsIContentChild because it calls ManagedPJavaScriptChild() which
      99             : // only exists in PContentChild and PContentBridgeChild.
     100             : jsipc::CPOWManager*
     101           0 : ContentBridgeChild::GetCPOWManager()
     102             : {
     103           0 :   if (PJavaScriptChild* c = LoneManagedOrNullAsserts(ManagedPJavaScriptChild())) {
     104           0 :     return CPOWManagerFor(c);
     105             :   }
     106           0 :   return CPOWManagerFor(SendPJavaScriptConstructor());
     107             : }
     108             : 
     109             : mozilla::jsipc::PJavaScriptChild *
     110           0 : ContentBridgeChild::AllocPJavaScriptChild()
     111             : {
     112           0 :   return nsIContentChild::AllocPJavaScriptChild();
     113             : }
     114             : 
     115             : bool
     116           0 : ContentBridgeChild::DeallocPJavaScriptChild(PJavaScriptChild *child)
     117             : {
     118           0 :   return nsIContentChild::DeallocPJavaScriptChild(child);
     119             : }
     120             : 
     121             : PBrowserChild*
     122           0 : ContentBridgeChild::AllocPBrowserChild(const TabId& aTabId,
     123             :                                        const TabId& aSameTabGroupAs,
     124             :                                        const IPCTabContext &aContext,
     125             :                                        const uint32_t& aChromeFlags,
     126             :                                        const ContentParentId& aCpID,
     127             :                                        const bool& aIsForBrowser)
     128             : {
     129           0 :   return nsIContentChild::AllocPBrowserChild(aTabId,
     130             :                                              aSameTabGroupAs,
     131             :                                              aContext,
     132             :                                              aChromeFlags,
     133             :                                              aCpID,
     134           0 :                                              aIsForBrowser);
     135             : }
     136             : 
     137             : bool
     138           0 : ContentBridgeChild::DeallocPBrowserChild(PBrowserChild* aChild)
     139             : {
     140           0 :   return nsIContentChild::DeallocPBrowserChild(aChild);
     141             : }
     142             : 
     143             : mozilla::ipc::IPCResult
     144           0 : ContentBridgeChild::RecvPBrowserConstructor(PBrowserChild* aActor,
     145             :                                             const TabId& aTabId,
     146             :                                             const TabId& aSameTabGroupAs,
     147             :                                             const IPCTabContext& aContext,
     148             :                                             const uint32_t& aChromeFlags,
     149             :                                             const ContentParentId& aCpID,
     150             :                                             const bool& aIsForBrowser)
     151             : {
     152             :   return nsIContentChild::RecvPBrowserConstructor(aActor,
     153             :                                                   aTabId,
     154             :                                                   aSameTabGroupAs,
     155             :                                                   aContext,
     156             :                                                   aChromeFlags,
     157             :                                                   aCpID,
     158           0 :                                                   aIsForBrowser);
     159             : }
     160             : 
     161             : PIPCBlobInputStreamChild*
     162           0 : ContentBridgeChild::AllocPIPCBlobInputStreamChild(const nsID& aID,
     163             :                                                   const uint64_t& aSize)
     164             : {
     165           0 :   return nsIContentChild::AllocPIPCBlobInputStreamChild(aID, aSize);
     166             : }
     167             : 
     168             : bool
     169           0 : ContentBridgeChild::DeallocPIPCBlobInputStreamChild(PIPCBlobInputStreamChild* aActor)
     170             : {
     171           0 :   return nsIContentChild::DeallocPIPCBlobInputStreamChild(aActor);
     172             : }
     173             : 
     174             : PChildToParentStreamChild*
     175           0 : ContentBridgeChild::AllocPChildToParentStreamChild()
     176             : {
     177           0 :   return nsIContentChild::AllocPChildToParentStreamChild();
     178             : }
     179             : 
     180             : bool
     181           0 : ContentBridgeChild::DeallocPChildToParentStreamChild(PChildToParentStreamChild* aActor)
     182             : {
     183           0 :   return nsIContentChild::DeallocPChildToParentStreamChild(aActor);
     184             : }
     185             : 
     186             : PParentToChildStreamChild*
     187           0 : ContentBridgeChild::AllocPParentToChildStreamChild()
     188             : {
     189           0 :   return nsIContentChild::AllocPParentToChildStreamChild();
     190             : }
     191             : 
     192             : bool
     193           0 : ContentBridgeChild::DeallocPParentToChildStreamChild(PParentToChildStreamChild* aActor)
     194             : {
     195           0 :   return nsIContentChild::DeallocPParentToChildStreamChild(aActor);
     196             : }
     197             : 
     198             : PFileDescriptorSetChild*
     199           0 : ContentBridgeChild::AllocPFileDescriptorSetChild(const FileDescriptor& aFD)
     200             : {
     201           0 :   return nsIContentChild::AllocPFileDescriptorSetChild(aFD);
     202             : }
     203             : 
     204             : bool
     205           0 : ContentBridgeChild::DeallocPFileDescriptorSetChild(PFileDescriptorSetChild* aActor)
     206             : {
     207           0 :   return nsIContentChild::DeallocPFileDescriptorSetChild(aActor);
     208             : }
     209             : 
     210             : mozilla::ipc::IPCResult
     211           0 : ContentBridgeChild::RecvActivate(PBrowserChild* aTab)
     212             : {
     213           0 :   TabChild* tab = static_cast<TabChild*>(aTab);
     214           0 :   return tab->RecvActivate();
     215             : }
     216             : 
     217             : mozilla::ipc::IPCResult
     218           0 : ContentBridgeChild::RecvDeactivate(PBrowserChild* aTab)
     219             : {
     220           0 :   TabChild* tab = static_cast<TabChild*>(aTab);
     221           0 :   return tab->RecvDeactivate();
     222             : }
     223             : 
     224             : mozilla::ipc::IPCResult
     225           0 : ContentBridgeChild::RecvParentActivated(PBrowserChild* aTab, const bool& aActivated)
     226             : {
     227           0 :   TabChild* tab = static_cast<TabChild*>(aTab);
     228           0 :   return tab->RecvParentActivated(aActivated);
     229             : }
     230             : 
     231             : already_AddRefed<nsIEventTarget>
     232           0 : ContentBridgeChild::GetConstructedEventTarget(const Message& aMsg)
     233             : {
     234             :   // Currently we only set targets for PBrowser.
     235           0 :   if (aMsg.type() != PContentBridge::Msg_PBrowserConstructor__ID) {
     236           0 :     return nullptr;
     237             :   }
     238             : 
     239           0 :   return nsIContentChild::GetConstructedEventTarget(aMsg);
     240             : }
     241             : 
     242             : already_AddRefed<nsIEventTarget>
     243           0 : ContentBridgeChild::GetEventTargetFor(TabChild* aTabChild)
     244             : {
     245           0 :   return IToplevelProtocol::GetActorEventTarget(aTabChild);
     246             : }
     247             : 
     248             : } // namespace dom
     249             : } // namespace mozilla

Generated by: LCOV version 1.13