LCOV - code coverage report
Current view: top level - dom/ipc - ContentChild.h (source / functions) Hit Total Coverage
Test: output.info Lines: 11 13 84.6 %
Date: 2017-07-14 16:53:18 Functions: 7 12 58.3 %
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
       5             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
       6             : 
       7             : #ifndef mozilla_dom_ContentChild_h
       8             : #define mozilla_dom_ContentChild_h
       9             : 
      10             : #include "mozilla/Attributes.h"
      11             : #include "mozilla/dom/ContentBridgeParent.h"
      12             : #include "mozilla/dom/nsIContentChild.h"
      13             : #include "mozilla/dom/PBrowserOrId.h"
      14             : #include "mozilla/dom/PContentChild.h"
      15             : #include "nsAutoPtr.h"
      16             : #include "nsHashKeys.h"
      17             : #include "nsIObserver.h"
      18             : #include "nsTHashtable.h"
      19             : #include "nsRefPtrHashtable.h"
      20             : 
      21             : #include "nsWeakPtr.h"
      22             : #include "nsIWindowProvider.h"
      23             : 
      24             : #if defined(XP_MACOSX) && defined(MOZ_CONTENT_SANDBOX)
      25             : #include "nsIFile.h"
      26             : #endif
      27             : 
      28             : struct ChromePackage;
      29             : class nsIObserver;
      30             : struct SubstitutionMapping;
      31             : struct OverrideMapping;
      32             : class nsIDomainPolicy;
      33             : class nsIURIClassifierCallback;
      34             : struct LookAndFeelInt;
      35             : 
      36             : namespace mozilla {
      37             : class RemoteSpellcheckEngineChild;
      38             : class ChildProfilerController;
      39             : 
      40             : using mozilla::loader::PScriptCacheChild;
      41             : 
      42             : namespace ipc {
      43             : class OptionalURIParams;
      44             : class URIParams;
      45             : }// namespace ipc
      46             : 
      47             : namespace dom {
      48             : 
      49             : class AlertObserver;
      50             : class ConsoleListener;
      51             : class PStorageChild;
      52             : class ClonedMessageData;
      53             : class TabChild;
      54             : class GetFilesHelperChild;
      55             : class FileCreatorHelper;
      56             : 
      57             : class ContentChild final : public PContentChild
      58             :                          , public nsIWindowProvider
      59             :                          , public nsIContentChild
      60             : {
      61             :   typedef mozilla::dom::ClonedMessageData ClonedMessageData;
      62             :   typedef mozilla::ipc::FileDescriptor FileDescriptor;
      63             :   typedef mozilla::ipc::OptionalURIParams OptionalURIParams;
      64             :   typedef mozilla::ipc::PFileDescriptorSetChild PFileDescriptorSetChild;
      65             :   typedef mozilla::ipc::URIParams URIParams;
      66             : 
      67             : public:
      68             :   NS_DECL_NSIWINDOWPROVIDER
      69             : 
      70             :   ContentChild();
      71             :   virtual ~ContentChild();
      72             :   NS_IMETHOD QueryInterface(REFNSIID aIID, void** aInstancePtr) override;
      73           1 :   NS_IMETHOD_(MozExternalRefCountType) AddRef(void) override { return 1; }
      74           0 :   NS_IMETHOD_(MozExternalRefCountType) Release(void) override { return 1; }
      75             : 
      76           2 :   struct AppInfo
      77             :   {
      78             :     nsCString version;
      79             :     nsCString buildID;
      80             :     nsCString name;
      81             :     nsCString UAName;
      82             :     nsCString ID;
      83             :     nsCString vendor;
      84             :   };
      85             : 
      86             :   nsresult
      87             :   ProvideWindowCommon(TabChild* aTabOpener,
      88             :                       mozIDOMWindowProxy* aOpener,
      89             :                       bool aIframeMoz,
      90             :                       uint32_t aChromeFlags,
      91             :                       bool aCalledFromJS,
      92             :                       bool aPositionSpecified,
      93             :                       bool aSizeSpecified,
      94             :                       nsIURI* aURI,
      95             :                       const nsAString& aName,
      96             :                       const nsACString& aFeatures,
      97             :                       bool aForceNoOpener,
      98             :                       bool* aWindowIsNew,
      99             :                       mozIDOMWindowProxy** aReturn);
     100             : 
     101             :   bool Init(MessageLoop* aIOLoop,
     102             :             base::ProcessId aParentPid,
     103             :             IPC::Channel* aChannel,
     104             :             uint64_t aChildID,
     105             :             bool aIsForBrowser);
     106             : 
     107             :   void InitXPCOM(const XPCOMInitData& aXPCOMInit,
     108             :                  const mozilla::dom::ipc::StructuredCloneData& aInitialData);
     109             : 
     110             :   void InitGraphicsDeviceData(const ContentDeviceData& aData);
     111             : 
     112         472 :   static ContentChild* GetSingleton()
     113             :   {
     114         472 :     return sSingleton;
     115             :   }
     116             : 
     117         396 :   const AppInfo& GetAppInfo()
     118             :   {
     119         396 :     return mAppInfo;
     120             :   }
     121             : 
     122             :   void SetProcessName(const nsAString& aName, bool aDontOverride = false);
     123             : 
     124             :   void GetProcessName(nsAString& aName) const;
     125             : 
     126             :   void GetProcessName(nsACString& aName) const;
     127             : 
     128             : #if defined(XP_MACOSX) && defined(MOZ_CONTENT_SANDBOX)
     129             :   void GetProfileDir(nsIFile** aProfileDir) const
     130             :   {
     131             :     *aProfileDir = mProfileDir;
     132             :     NS_IF_ADDREF(*aProfileDir);
     133             :   }
     134             : 
     135             :   void SetProfileDir(nsIFile* aProfileDir)
     136             :   {
     137             :     mProfileDir = aProfileDir;
     138             :   }
     139             : #endif
     140             : 
     141             :   bool IsAlive() const;
     142             : 
     143             :   bool IsShuttingDown() const;
     144             : 
     145             :   static void AppendProcessId(nsACString& aName);
     146             : 
     147             :   mozilla::ipc::IPCResult
     148             :   RecvInitContentBridgeChild(Endpoint<PContentBridgeChild>&& aEndpoint) override;
     149             : 
     150             :   mozilla::ipc::IPCResult
     151             :   RecvInitGMPService(Endpoint<PGMPServiceChild>&& aGMPService) override;
     152             : 
     153             :   mozilla::ipc::IPCResult
     154             :   RecvInitProfiler(Endpoint<PProfilerChild>&& aEndpoint) override;
     155             : 
     156             :   mozilla::ipc::IPCResult
     157             :   RecvGMPsChanged(nsTArray<GMPCapabilityData>&& capabilities) override;
     158             : 
     159             :   mozilla::ipc::IPCResult
     160             :   RecvInitProcessHangMonitor(Endpoint<PProcessHangMonitorChild>&& aHangMonitor) override;
     161             : 
     162             :   mozilla::ipc::IPCResult
     163             :   RecvInitRendering(
     164             :     Endpoint<PCompositorManagerChild>&& aCompositor,
     165             :     Endpoint<PImageBridgeChild>&& aImageBridge,
     166             :     Endpoint<PVRManagerChild>&& aVRBridge,
     167             :     Endpoint<PVideoDecoderManagerChild>&& aVideoManager,
     168             :     nsTArray<uint32_t>&& namespaces) override;
     169             : 
     170             :   mozilla::ipc::IPCResult
     171             :   RecvReinitRendering(
     172             :     Endpoint<PCompositorManagerChild>&& aCompositor,
     173             :     Endpoint<PImageBridgeChild>&& aImageBridge,
     174             :     Endpoint<PVRManagerChild>&& aVRBridge,
     175             :     Endpoint<PVideoDecoderManagerChild>&& aVideoManager,
     176             :     nsTArray<uint32_t>&& namespaces) override;
     177             : 
     178             :   mozilla::ipc::IPCResult RecvReinitRenderingForDeviceReset() override;
     179             : 
     180             :   virtual mozilla::ipc::IPCResult RecvSetProcessSandbox(const MaybeFileDesc& aBroker) override;
     181             : 
     182             :   virtual PBrowserChild* AllocPBrowserChild(const TabId& aTabId,
     183             :                                             const TabId& aSameTabGroupAs,
     184             :                                             const IPCTabContext& aContext,
     185             :                                             const uint32_t& aChromeFlags,
     186             :                                             const ContentParentId& aCpID,
     187             :                                             const bool& aIsForBrowser) override;
     188             : 
     189             :   virtual bool DeallocPBrowserChild(PBrowserChild*) override;
     190             : 
     191             :   virtual PIPCBlobInputStreamChild*
     192             :   AllocPIPCBlobInputStreamChild(const nsID& aID,
     193             :                                 const uint64_t& aSize) override;
     194             : 
     195             :   virtual bool
     196             :   DeallocPIPCBlobInputStreamChild(PIPCBlobInputStreamChild* aActor) override;
     197             : 
     198             :   virtual PHalChild* AllocPHalChild() override;
     199             :   virtual bool DeallocPHalChild(PHalChild*) override;
     200             : 
     201             :   virtual PHeapSnapshotTempFileHelperChild*
     202             :   AllocPHeapSnapshotTempFileHelperChild() override;
     203             : 
     204             :   virtual bool
     205             :   DeallocPHeapSnapshotTempFileHelperChild(PHeapSnapshotTempFileHelperChild*) override;
     206             : 
     207             :   virtual PCycleCollectWithLogsChild*
     208             :   AllocPCycleCollectWithLogsChild(const bool& aDumpAllTraces,
     209             :                                   const FileDescriptor& aGCLog,
     210             :                                   const FileDescriptor& aCCLog) override;
     211             : 
     212             :   virtual bool
     213             :   DeallocPCycleCollectWithLogsChild(PCycleCollectWithLogsChild* aActor) override;
     214             : 
     215             :   virtual mozilla::ipc::IPCResult
     216             :   RecvPCycleCollectWithLogsConstructor(PCycleCollectWithLogsChild* aChild,
     217             :                                        const bool& aDumpAllTraces,
     218             :                                        const FileDescriptor& aGCLog,
     219             :                                        const FileDescriptor& aCCLog) override;
     220             : 
     221             :   virtual PWebBrowserPersistDocumentChild*
     222             :   AllocPWebBrowserPersistDocumentChild(PBrowserChild* aBrowser,
     223             :                                        const uint64_t& aOuterWindowID) override;
     224             : 
     225             :   virtual mozilla::ipc::IPCResult
     226             :   RecvPWebBrowserPersistDocumentConstructor(PWebBrowserPersistDocumentChild *aActor,
     227             :                                             PBrowserChild *aBrowser,
     228             :                                             const uint64_t& aOuterWindowID) override;
     229             : 
     230             :   virtual bool
     231             :   DeallocPWebBrowserPersistDocumentChild(PWebBrowserPersistDocumentChild* aActor) override;
     232             : 
     233             :   virtual PTestShellChild* AllocPTestShellChild() override;
     234             : 
     235             :   virtual bool DeallocPTestShellChild(PTestShellChild*) override;
     236             : 
     237             :   virtual mozilla::ipc::IPCResult RecvPTestShellConstructor(PTestShellChild*) override;
     238             : 
     239             :   virtual PScriptCacheChild*
     240             :   AllocPScriptCacheChild(const FileDescOrError& cacheFile,
     241             :                          const bool& wantCacheData) override;
     242             : 
     243             :   virtual bool DeallocPScriptCacheChild(PScriptCacheChild*) override;
     244             : 
     245             :   virtual mozilla::ipc::IPCResult
     246             :   RecvPScriptCacheConstructor(PScriptCacheChild*,
     247             :                               const FileDescOrError& cacheFile,
     248             :                               const bool& wantCacheData) override;
     249             : 
     250             :   jsipc::CPOWManager* GetCPOWManager() override;
     251             : 
     252             :   virtual PNeckoChild* AllocPNeckoChild() override;
     253             : 
     254             :   virtual bool DeallocPNeckoChild(PNeckoChild*) override;
     255             : 
     256             :   virtual PPrintingChild* AllocPPrintingChild() override;
     257             : 
     258             :   virtual bool DeallocPPrintingChild(PPrintingChild*) override;
     259             : 
     260             :   virtual PChildToParentStreamChild*
     261             :   SendPChildToParentStreamConstructor(PChildToParentStreamChild*) override;
     262             : 
     263             :   virtual PChildToParentStreamChild* AllocPChildToParentStreamChild() override;
     264             :   virtual bool DeallocPChildToParentStreamChild(PChildToParentStreamChild*) override;
     265             : 
     266             :   virtual PParentToChildStreamChild* AllocPParentToChildStreamChild() override;
     267             :   virtual bool DeallocPParentToChildStreamChild(PParentToChildStreamChild*) override;
     268             : 
     269             :   virtual PPSMContentDownloaderChild*
     270             :   AllocPPSMContentDownloaderChild( const uint32_t& aCertType) override;
     271             : 
     272             :   virtual bool
     273             :   DeallocPPSMContentDownloaderChild(PPSMContentDownloaderChild* aDownloader) override;
     274             : 
     275             :   virtual PExternalHelperAppChild*
     276             :   AllocPExternalHelperAppChild(const OptionalURIParams& uri,
     277             :                                const nsCString& aMimeContentType,
     278             :                                const nsCString& aContentDisposition,
     279             :                                const uint32_t& aContentDispositionHint,
     280             :                                const nsString& aContentDispositionFilename,
     281             :                                const bool& aForceSave,
     282             :                                const int64_t& aContentLength,
     283             :                                const bool& aWasFileChannel,
     284             :                                const OptionalURIParams& aReferrer,
     285             :                                PBrowserChild* aBrowser) override;
     286             : 
     287             :   virtual bool
     288             :   DeallocPExternalHelperAppChild(PExternalHelperAppChild *aService) override;
     289             : 
     290             :   virtual PHandlerServiceChild* AllocPHandlerServiceChild() override;
     291             : 
     292             :   virtual bool DeallocPHandlerServiceChild(PHandlerServiceChild*) override;
     293             : 
     294             :   virtual PMediaChild* AllocPMediaChild() override;
     295             : 
     296             :   virtual bool DeallocPMediaChild(PMediaChild* aActor) override;
     297             : 
     298             :   virtual PStorageChild* AllocPStorageChild() override;
     299             : 
     300             :   virtual bool DeallocPStorageChild(PStorageChild* aActor) override;
     301             : 
     302             :   virtual PPresentationChild* AllocPPresentationChild() override;
     303             : 
     304             :   virtual bool DeallocPPresentationChild(PPresentationChild* aActor) override;
     305             : 
     306             :   virtual PFlyWebPublishedServerChild*
     307             :     AllocPFlyWebPublishedServerChild(const nsString& name,
     308             :                                      const FlyWebPublishOptions& params) override;
     309             : 
     310             :   virtual bool DeallocPFlyWebPublishedServerChild(PFlyWebPublishedServerChild* aActor) override;
     311             : 
     312             :   virtual mozilla::ipc::IPCResult
     313             :   RecvNotifyPresentationReceiverLaunched(PBrowserChild* aIframe,
     314             :                                          const nsString& aSessionId) override;
     315             : 
     316             :   virtual mozilla::ipc::IPCResult
     317             :   RecvNotifyPresentationReceiverCleanUp(const nsString& aSessionId) override;
     318             : 
     319             :   virtual mozilla::ipc::IPCResult RecvNotifyEmptyHTTPCache() override;
     320             : 
     321             :   virtual PSpeechSynthesisChild* AllocPSpeechSynthesisChild() override;
     322             : 
     323             :   virtual bool DeallocPSpeechSynthesisChild(PSpeechSynthesisChild* aActor) override;
     324             : 
     325             :   virtual mozilla::ipc::IPCResult RecvRegisterChrome(InfallibleTArray<ChromePackage>&& packages,
     326             :                                                      InfallibleTArray<SubstitutionMapping>&& resources,
     327             :                                                      InfallibleTArray<OverrideMapping>&& overrides,
     328             :                                                      const nsCString& locale,
     329             :                                                      const bool& reset) override;
     330             :   virtual mozilla::ipc::IPCResult RecvRegisterChromeItem(const ChromeRegistryItem& item) override;
     331             : 
     332             :   virtual mozilla::ipc::IPCResult RecvClearImageCache(const bool& privateLoader,
     333             :                                                       const bool& chrome) override;
     334             : 
     335             :   virtual mozilla::jsipc::PJavaScriptChild* AllocPJavaScriptChild() override;
     336             : 
     337             :   virtual bool DeallocPJavaScriptChild(mozilla::jsipc::PJavaScriptChild*) override;
     338             : 
     339             :   virtual PRemoteSpellcheckEngineChild* AllocPRemoteSpellcheckEngineChild() override;
     340             : 
     341             :   virtual bool DeallocPRemoteSpellcheckEngineChild(PRemoteSpellcheckEngineChild*) override;
     342             : 
     343             :   virtual mozilla::ipc::IPCResult RecvSetOffline(const bool& offline) override;
     344             : 
     345             :   virtual mozilla::ipc::IPCResult RecvSetConnectivity(const bool& connectivity) override;
     346             :   virtual mozilla::ipc::IPCResult RecvSetCaptivePortalState(const int32_t& state) override;
     347             : 
     348             :   virtual mozilla::ipc::IPCResult RecvBidiKeyboardNotify(const bool& isLangRTL,
     349             :                                                          const bool& haveBidiKeyboards) override;
     350             : 
     351             :   virtual mozilla::ipc::IPCResult RecvNotifyVisited(const URIParams& aURI) override;
     352             : 
     353             :   // auto remove when alertfinished is received.
     354             :   nsresult AddRemoteAlertObserver(const nsString& aData, nsIObserver* aObserver);
     355             : 
     356             :   virtual mozilla::ipc::IPCResult RecvPreferenceUpdate(const PrefSetting& aPref) override;
     357             :   virtual mozilla::ipc::IPCResult RecvVarUpdate(const GfxVarUpdate& pref) override;
     358             : 
     359             :   virtual mozilla::ipc::IPCResult RecvDataStoragePut(const nsString& aFilename,
     360             :                                                      const DataStorageItem& aItem) override;
     361             : 
     362             :   virtual mozilla::ipc::IPCResult RecvDataStorageRemove(const nsString& aFilename,
     363             :                                                         const nsCString& aKey,
     364             :                                                         const DataStorageType& aType) override;
     365             : 
     366             :   virtual mozilla::ipc::IPCResult RecvDataStorageClear(const nsString& aFilename) override;
     367             : 
     368             :   virtual mozilla::ipc::IPCResult RecvNotifyAlertsObserver(const nsCString& aType,
     369             :                                                            const nsString& aData) override;
     370             : 
     371             :   virtual mozilla::ipc::IPCResult RecvLoadProcessScript(const nsString& aURL) override;
     372             : 
     373             :   virtual mozilla::ipc::IPCResult RecvAsyncMessage(const nsString& aMsg,
     374             :                                                    InfallibleTArray<CpowEntry>&& aCpows,
     375             :                                                    const IPC::Principal& aPrincipal,
     376             :                                                    const ClonedMessageData& aData) override;
     377             : 
     378             :   virtual mozilla::ipc::IPCResult RecvGeolocationUpdate(const GeoPosition& somewhere) override;
     379             : 
     380             :   virtual mozilla::ipc::IPCResult RecvGeolocationError(const uint16_t& errorCode) override;
     381             : 
     382             :   virtual mozilla::ipc::IPCResult RecvUpdateDictionaryList(InfallibleTArray<nsString>&& aDictionaries) override;
     383             : 
     384             :   virtual mozilla::ipc::IPCResult RecvUpdateAppLocales(nsTArray<nsCString>&& aAppLocales) override;
     385             :   virtual mozilla::ipc::IPCResult RecvUpdateRequestedLocales(nsTArray<nsCString>&& aRequestedLocales) override;
     386             : 
     387             :   virtual mozilla::ipc::IPCResult RecvAddPermission(const IPC::Permission& permission) override;
     388             : 
     389             :   virtual mozilla::ipc::IPCResult RecvFlushMemory(const nsString& reason) override;
     390             : 
     391             :   virtual mozilla::ipc::IPCResult RecvActivateA11y(const uint32_t& aMainChromeTid,
     392             :                                                    const uint32_t& aMsaaID) override;
     393             :   virtual mozilla::ipc::IPCResult RecvShutdownA11y() override;
     394             : 
     395             :   virtual mozilla::ipc::IPCResult RecvGarbageCollect() override;
     396             :   virtual mozilla::ipc::IPCResult RecvCycleCollect() override;
     397             : 
     398             :   virtual mozilla::ipc::IPCResult RecvAppInfo(const nsCString& version, const nsCString& buildID,
     399             :                                               const nsCString& name, const nsCString& UAName,
     400             :                                               const nsCString& ID, const nsCString& vendor) override;
     401             : 
     402             :   virtual mozilla::ipc::IPCResult RecvRemoteType(const nsString& aRemoteType) override;
     403             : 
     404             :   const nsAString& GetRemoteType() const;
     405             : 
     406             :   virtual mozilla::ipc::IPCResult
     407             :   RecvInitServiceWorkers(const ServiceWorkerConfiguration& aConfig) override;
     408             : 
     409             :   virtual mozilla::ipc::IPCResult
     410             :   RecvInitBlobURLs(nsTArray<BlobURLRegistrationData>&& aRegistations) override;
     411             : 
     412             :   virtual mozilla::ipc::IPCResult
     413             :   RecvDispatchLocalStorageChange(const nsString& aDocumentURI,
     414             :                                  const nsString& aKey,
     415             :                                  const nsString& aOldValue,
     416             :                                  const nsString& aNewValue,
     417             :                                  const IPC::Principal& aPrincipal,
     418             :                                  const bool& aIsPrivate) override;
     419             : 
     420             :   virtual mozilla::ipc::IPCResult RecvLastPrivateDocShellDestroyed() override;
     421             : 
     422             :   virtual mozilla::ipc::IPCResult
     423             :   RecvNotifyProcessPriorityChanged(const hal::ProcessPriority& aPriority) override;
     424             : 
     425             :   virtual mozilla::ipc::IPCResult RecvMinimizeMemoryUsage() override;
     426             : 
     427             :   virtual mozilla::ipc::IPCResult RecvLoadAndRegisterSheet(const URIParams& aURI,
     428             :                                                            const uint32_t& aType) override;
     429             : 
     430             :   virtual mozilla::ipc::IPCResult RecvUnregisterSheet(const URIParams& aURI,
     431             :                                                       const uint32_t& aType) override;
     432             : 
     433             :   void AddIdleObserver(nsIObserver* aObserver, uint32_t aIdleTimeInS);
     434             : 
     435             :   void RemoveIdleObserver(nsIObserver* aObserver, uint32_t aIdleTimeInS);
     436             : 
     437             :   virtual mozilla::ipc::IPCResult RecvNotifyIdleObserver(const uint64_t& aObserver,
     438             :                                                          const nsCString& aTopic,
     439             :                                                          const nsString& aData) override;
     440             : 
     441             :   virtual mozilla::ipc::IPCResult RecvUpdateWindow(const uintptr_t& aChildId) override;
     442             : 
     443             :   virtual mozilla::ipc::IPCResult RecvDomainSetChanged(const uint32_t& aSetType,
     444             :                                                        const uint32_t& aChangeType,
     445             :                                                        const OptionalURIParams& aDomain) override;
     446             : 
     447             :   virtual mozilla::ipc::IPCResult RecvShutdown() override;
     448             : 
     449             :   virtual mozilla::ipc::IPCResult
     450             :   RecvInvokeDragSession(nsTArray<IPCDataTransfer>&& aTransfers,
     451             :                         const uint32_t& aAction) override;
     452             : 
     453             :   virtual mozilla::ipc::IPCResult RecvEndDragSession(const bool& aDoneDrag,
     454             :                                                      const bool& aUserCancelled,
     455             :                                                      const mozilla::LayoutDeviceIntPoint& aEndDragPoint,
     456             :                                                      const uint32_t& aKeyModifiers) override;
     457             : 
     458             :   virtual mozilla::ipc::IPCResult
     459             :   RecvPush(const nsCString& aScope,
     460             :            const IPC::Principal& aPrincipal,
     461             :            const nsString& aMessageId) override;
     462             : 
     463             :   virtual mozilla::ipc::IPCResult
     464             :   RecvPushWithData(const nsCString& aScope,
     465             :                    const IPC::Principal& aPrincipal,
     466             :                    const nsString& aMessageId,
     467             :                    InfallibleTArray<uint8_t>&& aData) override;
     468             : 
     469             :   virtual mozilla::ipc::IPCResult
     470             :   RecvPushSubscriptionChange(const nsCString& aScope,
     471             :                              const IPC::Principal& aPrincipal) override;
     472             : 
     473             :   virtual mozilla::ipc::IPCResult
     474             :   RecvPushError(const nsCString& aScope, const IPC::Principal& aPrincipal,
     475             :                 const nsString& aMessage, const uint32_t& aFlags) override;
     476             : 
     477             :   virtual mozilla::ipc::IPCResult
     478             :   RecvNotifyPushSubscriptionModifiedObservers(const nsCString& aScope,
     479             :                                               const IPC::Principal& aPrincipal) override;
     480             : 
     481             :   virtual mozilla::ipc::IPCResult RecvActivate(PBrowserChild* aTab) override;
     482             : 
     483             :   virtual mozilla::ipc::IPCResult RecvDeactivate(PBrowserChild* aTab) override;
     484             : 
     485             :   virtual mozilla::ipc::IPCResult RecvParentActivated(PBrowserChild* aTab, const bool& aActivated) override;
     486             : 
     487             :   mozilla::ipc::IPCResult
     488             :   RecvRefreshScreens(nsTArray<ScreenDetails>&& aScreens) override;
     489             : 
     490             :   // Get the directory for IndexedDB files. We query the parent for this and
     491             :   // cache the value
     492             :   nsString &GetIndexedDBPath();
     493             : 
     494           5 :   ContentParentId GetID() const { return mID; }
     495             : 
     496             : #if defined(XP_WIN) && defined(ACCESSIBILITY)
     497             :   uint32_t GetChromeMainThreadId() const { return mMainChromeTid; }
     498             : 
     499             :   uint32_t GetMsaaID() const { return mMsaaID; }
     500             : #endif
     501             : 
     502           0 :   bool IsForBrowser() const { return mIsForBrowser; }
     503             : 
     504             :   virtual PFileDescriptorSetChild*
     505             :   SendPFileDescriptorSetConstructor(const FileDescriptor&) override;
     506             : 
     507             :   virtual PFileDescriptorSetChild*
     508             :   AllocPFileDescriptorSetChild(const FileDescriptor&) override;
     509             : 
     510             :   virtual bool
     511             :   DeallocPFileDescriptorSetChild(PFileDescriptorSetChild*) override;
     512             : 
     513             :   virtual bool SendPBrowserConstructor(PBrowserChild* actor,
     514             :                                        const TabId& aTabId,
     515             :                                        const TabId& aSameTabGroupAs,
     516             :                                        const IPCTabContext& context,
     517             :                                        const uint32_t& chromeFlags,
     518             :                                        const ContentParentId& aCpID,
     519             :                                        const bool& aIsForBrowser) override;
     520             : 
     521             :   virtual mozilla::ipc::IPCResult RecvPBrowserConstructor(PBrowserChild* aCctor,
     522             :                                                           const TabId& aTabId,
     523             :                                                           const TabId& aSameTabGroupAs,
     524             :                                                           const IPCTabContext& aContext,
     525             :                                                           const uint32_t& aChromeFlags,
     526             :                                                           const ContentParentId& aCpID,
     527             :                                                           const bool& aIsForBrowser) override;
     528             : 
     529           2 :   FORWARD_SHMEM_ALLOCATOR_TO(PContentChild)
     530             : 
     531             :   void GetAvailableDictionaries(InfallibleTArray<nsString>& aDictionaries);
     532             : 
     533             :   PBrowserOrId
     534             :   GetBrowserOrId(TabChild* aTabChild);
     535             : 
     536             :   virtual POfflineCacheUpdateChild*
     537             :   AllocPOfflineCacheUpdateChild(const URIParams& manifestURI,
     538             :                                 const URIParams& documentURI,
     539             :                                 const PrincipalInfo& aLoadingPrincipalInfo,
     540             :                                 const bool& stickDocument) override;
     541             : 
     542             :   virtual bool
     543             :   DeallocPOfflineCacheUpdateChild(POfflineCacheUpdateChild* offlineCacheUpdate) override;
     544             : 
     545             :   virtual PWebrtcGlobalChild* AllocPWebrtcGlobalChild() override;
     546             : 
     547             :   virtual bool DeallocPWebrtcGlobalChild(PWebrtcGlobalChild *aActor) override;
     548             : 
     549             :   virtual PContentPermissionRequestChild*
     550             :   AllocPContentPermissionRequestChild(const InfallibleTArray<PermissionRequest>& aRequests,
     551             :                                       const IPC::Principal& aPrincipal,
     552             :                                       const TabId& aTabId) override;
     553             :   virtual bool
     554             :   DeallocPContentPermissionRequestChild(PContentPermissionRequestChild* actor) override;
     555             : 
     556             :   // Windows specific - set up audio session
     557             :   virtual mozilla::ipc::IPCResult
     558             :   RecvSetAudioSessionData(const nsID& aId,
     559             :                           const nsString& aDisplayName,
     560             :                           const nsString& aIconPath) override;
     561             : 
     562             : 
     563             :   // GetFiles for WebKit/Blink FileSystem API and Directory API must run on the
     564             :   // parent process.
     565             :   void
     566             :   CreateGetFilesRequest(const nsAString& aDirectoryPath, bool aRecursiveFlag,
     567             :                         nsID& aUUID, GetFilesHelperChild* aChild);
     568             : 
     569             :   void
     570             :   DeleteGetFilesRequest(nsID& aUUID, GetFilesHelperChild* aChild);
     571             : 
     572             :   virtual mozilla::ipc::IPCResult
     573             :   RecvGetFilesResponse(const nsID& aUUID,
     574             :                        const GetFilesResponseResult& aResult) override;
     575             : 
     576             :   virtual mozilla::ipc::IPCResult
     577             :   RecvBlobURLRegistration(const nsCString& aURI, const IPCBlob& aBlob,
     578             :                           const IPC::Principal& aPrincipal) override;
     579             : 
     580             :   virtual mozilla::ipc::IPCResult
     581             :   RecvBlobURLUnregistration(const nsCString& aURI) override;
     582             : 
     583             :   virtual mozilla::ipc::IPCResult
     584             :   RecvFileCreationResponse(const nsID& aUUID,
     585             :                            const FileCreationResult& aResult) override;
     586             : 
     587             :   mozilla::ipc::IPCResult
     588             :   RecvRequestMemoryReport(
     589             :           const uint32_t& generation,
     590             :           const bool& anonymize,
     591             :           const bool& minimizeMemoryUsage,
     592             :           const MaybeFileDesc& DMDFile) override;
     593             : 
     594             :   virtual mozilla::ipc::IPCResult
     595             :   RecvSetXPCOMProcessAttributes(const XPCOMInitData& aXPCOMInit,
     596             :                                 const StructuredCloneData& aInitialData,
     597             :                                 nsTArray<LookAndFeelInt>&& aLookAndFeelIntCache) override;
     598             : 
     599             :   virtual mozilla::ipc::IPCResult
     600             :   RecvProvideAnonymousTemporaryFile(const uint64_t& aID, const FileDescOrError& aFD) override;
     601             : 
     602             :   mozilla::ipc::IPCResult
     603             :   RecvSetPermissionsWithKey(const nsCString& aPermissionKey,
     604             :                             nsTArray<IPC::Permission>&& aPerms) override;
     605             : 
     606             :   virtual mozilla::ipc::IPCResult
     607             :   RecvShareCodeCoverageMutex(const CrossProcessMutexHandle& aHandle) override;
     608             : 
     609             :   virtual mozilla::ipc::IPCResult
     610             :   RecvDumpCodeCoverageCounters() override;
     611             : 
     612             :   virtual mozilla::ipc::IPCResult
     613             :   RecvResetCodeCoverageCounters() override;
     614             : 
     615             : #if defined(XP_WIN) && defined(ACCESSIBILITY)
     616             :   bool
     617             :   SendGetA11yContentId();
     618             : #endif // defined(XP_WIN) && defined(ACCESSIBILITY)
     619             : 
     620             :   // Get a reference to the font family list passed from the chrome process,
     621             :   // for use during gfx initialization.
     622             :   InfallibleTArray<mozilla::dom::FontFamilyListEntry>&
     623             :   SystemFontFamilyList() {
     624             :     return mFontFamilies;
     625             :   }
     626             : 
     627             :   // PURLClassifierChild
     628             :   virtual PURLClassifierChild*
     629             :   AllocPURLClassifierChild(const Principal& aPrincipal,
     630             :                            const bool& aUseTrackingProtection,
     631             :                            bool* aSuccess) override;
     632             :   virtual bool
     633             :   DeallocPURLClassifierChild(PURLClassifierChild* aActor) override;
     634             : 
     635             :   // PURLClassifierLocalChild
     636             :   virtual PURLClassifierLocalChild*
     637             :   AllocPURLClassifierLocalChild(const URIParams& aUri,
     638             :                                 const nsCString& aTables) override;
     639             :   virtual bool
     640             :   DeallocPURLClassifierLocalChild(PURLClassifierLocalChild* aActor) override;
     641             : 
     642             :   nsTArray<LookAndFeelInt>&
     643           2 :   LookAndFeelCache() {
     644           2 :     return mLookAndFeelCache;
     645             :   }
     646             : 
     647             :   /**
     648             :    * Helper function for protocols that use the GPU process when available.
     649             :    * Overrides FatalError to just be a warning when communicating with the
     650             :    * GPU process since we don't want to crash the content process when the
     651             :    * GPU process crashes.
     652             :    */
     653             :   static void FatalErrorIfNotUsingGPUProcess(const char* const aProtocolName,
     654             :                                              const char* const aErrorMsg,
     655             :                                              base::ProcessId aOtherPid);
     656             : 
     657             :   // This method is used by FileCreatorHelper for the creation of a BlobImpl.
     658             :   void
     659             :   FileCreationRequest(nsID& aUUID, FileCreatorHelper* aHelper,
     660             :                       const nsAString& aFullPath, const nsAString& aType,
     661             :                       const nsAString& aName,
     662             :                       const Optional<int64_t>& aLastModified,
     663             :                       bool aExistenceCheck, bool aIsFromNsIFile);
     664             : 
     665             :   typedef std::function<void(PRFileDesc*)> AnonymousTemporaryFileCallback;
     666             :   nsresult AsyncOpenAnonymousTemporaryFile(const AnonymousTemporaryFileCallback& aCallback);
     667             : 
     668             :   virtual already_AddRefed<nsIEventTarget> GetEventTargetFor(TabChild* aTabChild) override;
     669             : 
     670             :   mozilla::ipc::IPCResult
     671             :   RecvSetPluginList(const uint32_t& aPluginEpoch, nsTArray<PluginTag>&& aPluginTags, nsTArray<FakePluginTag>&& aFakePluginTags) override;
     672             : 
     673             : private:
     674             :   static void ForceKillTimerCallback(nsITimer* aTimer, void* aClosure);
     675             :   void StartForceKillTimer();
     676             : 
     677             :   virtual void ActorDestroy(ActorDestroyReason why) override;
     678             : 
     679             :   virtual void ProcessingError(Result aCode, const char* aReason) override;
     680             : 
     681             :   virtual already_AddRefed<nsIEventTarget>
     682             :   GetConstructedEventTarget(const Message& aMsg) override;
     683             : 
     684             :   virtual already_AddRefed<nsIEventTarget>
     685             :   GetSpecificMessageEventTarget(const Message& aMsg) override;
     686             : 
     687             :   InfallibleTArray<nsAutoPtr<AlertObserver> > mAlertObservers;
     688             :   RefPtr<ConsoleListener> mConsoleListener;
     689             : 
     690             :   nsTHashtable<nsPtrHashKey<nsIObserver>> mIdleObservers;
     691             : 
     692             :   InfallibleTArray<nsString> mAvailableDictionaries;
     693             : 
     694             :   // Temporary storage for a list of available font families, passed from the
     695             :   // parent process and used to initialize gfx in the child. Currently used
     696             :   // only on MacOSX.
     697             :   InfallibleTArray<mozilla::dom::FontFamilyListEntry> mFontFamilies;
     698             :   // Temporary storage for nsXPLookAndFeel flags.
     699             :   nsTArray<LookAndFeelInt> mLookAndFeelCache;
     700             : 
     701             :   /**
     702             :    * An ID unique to the process containing our corresponding
     703             :    * content parent.
     704             :    *
     705             :    * We expect our content parent to set this ID immediately after opening a
     706             :    * channel to us.
     707             :    */
     708             :   ContentParentId mID;
     709             : 
     710             : #if defined(XP_WIN) && defined(ACCESSIBILITY)
     711             :   /**
     712             :    * The thread ID of the main thread in the chrome process.
     713             :    */
     714             :   uint32_t mMainChromeTid;
     715             : 
     716             :   /**
     717             :    * This is an a11y-specific unique id for the content process that is
     718             :    * generated by the chrome process.
     719             :    */
     720             :   uint32_t mMsaaID;
     721             : #endif
     722             : 
     723             :   AppInfo mAppInfo;
     724             : 
     725             :   bool mIsForBrowser;
     726           2 :   nsString mRemoteType = NullString();
     727             :   bool mCanOverrideProcessName;
     728             :   bool mIsAlive;
     729             :   nsString mProcessName;
     730             : 
     731             :   static ContentChild* sSingleton;
     732             : 
     733             :   nsCOMPtr<nsIDomainPolicy> mPolicy;
     734             :   nsCOMPtr<nsITimer> mForceKillTimer;
     735             : 
     736             : #ifdef MOZ_GECKO_PROFILER
     737             :   RefPtr<ChildProfilerController> mProfilerController;
     738             : #endif
     739             : 
     740             : #if defined(XP_MACOSX) && defined(MOZ_CONTENT_SANDBOX)
     741             :   nsCOMPtr<nsIFile> mProfileDir;
     742             : #endif
     743             : 
     744             :   // Hashtable to keep track of the pending GetFilesHelper objects.
     745             :   // This GetFilesHelperChild objects are removed when RecvGetFilesResponse is
     746             :   // received.
     747             :   nsRefPtrHashtable<nsIDHashKey, GetFilesHelperChild> mGetFilesPendingRequests;
     748             : 
     749             :   // Hashtable to keep track of the pending file creation.
     750             :   // These items are removed when RecvFileCreationResponse is received.
     751             :   nsRefPtrHashtable<nsIDHashKey, FileCreatorHelper> mFileCreationPending;
     752             : 
     753             : 
     754             :   nsClassHashtable<nsUint64HashKey, AnonymousTemporaryFileCallback> mPendingAnonymousTemporaryFiles;
     755             : 
     756             :   bool mShuttingDown;
     757             : 
     758             :   DISALLOW_EVIL_CONSTRUCTORS(ContentChild);
     759             : };
     760             : 
     761             : uint64_t
     762             : NextWindowID();
     763             : 
     764             : } // namespace dom
     765             : } // namespace mozilla
     766             : 
     767             : #endif // mozilla_dom_ContentChild_h

Generated by: LCOV version 1.13