dom/ipc/ContentParent.h

Wed, 31 Dec 2014 06:55:50 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:55:50 +0100
changeset 2
7e26c7da4463
permissions
-rw-r--r--

Added tag UPSTREAM_283F7C6 for changeset ca08bd8f51b2

     1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
     2 /* vim: set sw=4 ts=8 et 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/. */
     7 #ifndef mozilla_dom_ContentParent_h
     8 #define mozilla_dom_ContentParent_h
    10 #include "mozilla/dom/PContentParent.h"
    11 #include "mozilla/ipc/GeckoChildProcessHost.h"
    12 #include "mozilla/dom/ipc/Blob.h"
    13 #include "mozilla/Attributes.h"
    14 #include "mozilla/FileUtils.h"
    15 #include "mozilla/HalTypes.h"
    16 #include "mozilla/LinkedList.h"
    17 #include "mozilla/StaticPtr.h"
    19 #include "nsDataHashtable.h"
    20 #include "nsFrameMessageManager.h"
    21 #include "nsHashKeys.h"
    22 #include "nsIObserver.h"
    23 #include "nsIThreadInternal.h"
    24 #include "nsIDOMGeoPositionCallback.h"
    25 #include "PermissionMessageUtils.h"
    27 #define CHILD_PROCESS_SHUTDOWN_MESSAGE NS_LITERAL_STRING("child-process-shutdown")
    29 class mozIApplication;
    30 class nsConsoleService;
    31 class nsIDOMBlob;
    32 class nsIMemoryReporter;
    33 class ParentIdleListener;
    35 namespace mozilla {
    37 namespace ipc {
    38 class OptionalURIParams;
    39 class URIParams;
    40 class TestShellParent;
    41 } // namespace ipc
    43 namespace jsipc {
    44 class JavaScriptParent;
    45 class PJavaScriptParent;
    46 }
    48 namespace layers {
    49 class PCompositorParent;
    50 } // namespace layers
    52 namespace dom {
    54 class Element;
    55 class TabParent;
    56 class PStorageParent;
    57 class ClonedMessageData;
    58 class MemoryReport;
    59 class TabContext;
    60 class PFileDescriptorSetParent;
    62 class ContentParent : public PContentParent
    63                     , public nsIObserver
    64                     , public nsIDOMGeoPositionCallback
    65                     , public mozilla::dom::ipc::MessageManagerCallback
    66                     , public mozilla::LinkedListElement<ContentParent>
    67 {
    68     typedef mozilla::ipc::GeckoChildProcessHost GeckoChildProcessHost;
    69     typedef mozilla::ipc::OptionalURIParams OptionalURIParams;
    70     typedef mozilla::ipc::TestShellParent TestShellParent;
    71     typedef mozilla::ipc::URIParams URIParams;
    72     typedef mozilla::dom::ClonedMessageData ClonedMessageData;
    74 public:
    75     /**
    76      * Start up the content-process machinery.  This might include
    77      * scheduling pre-launch tasks.
    78      */
    79     static void StartUp();
    80     /** Shut down the content-process machinery. */
    81     static void ShutDown();
    82     /**
    83      * Ensure that all subprocesses are terminated and their OS
    84      * resources have been reaped.  This is synchronous and can be
    85      * very expensive in general.  It also bypasses the normal
    86      * shutdown process.
    87      */
    88     static void JoinAllSubprocesses();
    90     static bool PreallocatedProcessReady();
    91     static void RunAfterPreallocatedProcessReady(nsIRunnable* aRequest);
    93     static already_AddRefed<ContentParent>
    94     GetNewOrUsed(bool aForBrowserElement = false);
    96     /**
    97      * Create a subprocess suitable for use as a preallocated app process.
    98      */
    99     static already_AddRefed<ContentParent> PreallocateAppProcess();
   101     static already_AddRefed<ContentParent> RunNuwaProcess();
   103     /**
   104      * Get or create a content process for the given TabContext.  aFrameElement
   105      * should be the frame/iframe element with which this process will
   106      * associated.
   107      */
   108     static TabParent*
   109     CreateBrowserOrApp(const TabContext& aContext,
   110                        Element* aFrameElement);
   112     static void GetAll(nsTArray<ContentParent*>& aArray);
   113     static void GetAllEvenIfDead(nsTArray<ContentParent*>& aArray);
   115     NS_DECL_CYCLE_COLLECTION_CLASS_AMBIGUOUS(ContentParent, nsIObserver)
   117     NS_DECL_CYCLE_COLLECTING_ISUPPORTS
   118     NS_DECL_NSIOBSERVER
   119     NS_DECL_NSIDOMGEOPOSITIONCALLBACK
   121     /**
   122      * MessageManagerCallback methods that we override.
   123      */
   124     virtual bool DoSendAsyncMessage(JSContext* aCx,
   125                                     const nsAString& aMessage,
   126                                     const mozilla::dom::StructuredCloneData& aData,
   127                                     JS::Handle<JSObject *> aCpows,
   128                                     nsIPrincipal* aPrincipal) MOZ_OVERRIDE;
   129     virtual bool CheckPermission(const nsAString& aPermission) MOZ_OVERRIDE;
   130     virtual bool CheckManifestURL(const nsAString& aManifestURL) MOZ_OVERRIDE;
   131     virtual bool CheckAppHasPermission(const nsAString& aPermission) MOZ_OVERRIDE;
   132     virtual bool CheckAppHasStatus(unsigned short aStatus) MOZ_OVERRIDE;
   134     /** Notify that a tab is beginning its destruction sequence. */
   135     void NotifyTabDestroying(PBrowserParent* aTab);
   136     /** Notify that a tab was destroyed during normal operation. */
   137     void NotifyTabDestroyed(PBrowserParent* aTab,
   138                             bool aNotifiedDestroying);
   140     TestShellParent* CreateTestShell();
   141     bool DestroyTestShell(TestShellParent* aTestShell);
   142     TestShellParent* GetTestShellSingleton();
   143     jsipc::JavaScriptParent *GetCPOWManager();
   145     void ReportChildAlreadyBlocked();
   146     bool RequestRunToCompletion();
   148     bool IsAlive();
   149     bool IsForApp();
   150 #ifdef MOZ_NUWA_PROCESS
   151     bool IsNuwaProcess();
   152 #endif
   154     GeckoChildProcessHost* Process() {
   155         return mSubprocess;
   156     }
   158     int32_t Pid();
   160     bool NeedsPermissionsUpdate() {
   161         return mSendPermissionUpdates;
   162     }
   164     BlobParent* GetOrCreateActorForBlob(nsIDOMBlob* aBlob);
   166     /**
   167      * Kill our subprocess and make sure it dies.  Should only be used
   168      * in emergency situations since it bypasses the normal shutdown
   169      * process.
   170      */
   171     void KillHard();
   173     uint64_t ChildID() { return mChildID; }
   174     const nsString& AppManifestURL() const { return mAppManifestURL; }
   176     bool IsPreallocated();
   178     /**
   179      * Get a user-friendly name for this ContentParent.  We make no guarantees
   180      * about this name: It might not be unique, apps can spoof special names,
   181      * etc.  So please don't use this name to make any decisions about the
   182      * ContentParent based on the value returned here.
   183      */
   184     void FriendlyName(nsAString& aName);
   186     virtual void OnChannelError() MOZ_OVERRIDE;
   188     virtual PIndexedDBParent* AllocPIndexedDBParent() MOZ_OVERRIDE;
   189     virtual bool
   190     RecvPIndexedDBConstructor(PIndexedDBParent* aActor) MOZ_OVERRIDE;
   192     virtual PCrashReporterParent*
   193     AllocPCrashReporterParent(const NativeThreadId& tid,
   194                               const uint32_t& processType) MOZ_OVERRIDE;
   195     virtual bool
   196     RecvPCrashReporterConstructor(PCrashReporterParent* actor,
   197                                   const NativeThreadId& tid,
   198                                   const uint32_t& processType) MOZ_OVERRIDE;
   200     virtual PNeckoParent* AllocPNeckoParent() MOZ_OVERRIDE;
   201     virtual bool RecvPNeckoConstructor(PNeckoParent* aActor) MOZ_OVERRIDE {
   202         return PContentParent::RecvPNeckoConstructor(aActor);
   203     }
   205     virtual PHalParent* AllocPHalParent() MOZ_OVERRIDE;
   206     virtual bool RecvPHalConstructor(PHalParent* aActor) MOZ_OVERRIDE {
   207         return PContentParent::RecvPHalConstructor(aActor);
   208     }
   210     virtual PStorageParent* AllocPStorageParent() MOZ_OVERRIDE;
   211     virtual bool RecvPStorageConstructor(PStorageParent* aActor) MOZ_OVERRIDE {
   212         return PContentParent::RecvPStorageConstructor(aActor);
   213     }
   215     virtual PJavaScriptParent*
   216     AllocPJavaScriptParent() MOZ_OVERRIDE;
   217     virtual bool
   218     RecvPJavaScriptConstructor(PJavaScriptParent* aActor) MOZ_OVERRIDE {
   219         return PContentParent::RecvPJavaScriptConstructor(aActor);
   220     }
   222     virtual bool RecvRecordingDeviceEvents(const nsString& aRecordingStatus,
   223                                            const nsString& aPageURL,
   224                                            const bool& aIsAudio,
   225                                            const bool& aIsVideo) MOZ_OVERRIDE;
   226 protected:
   227     void OnChannelConnected(int32_t pid) MOZ_OVERRIDE;
   228     virtual void ActorDestroy(ActorDestroyReason why) MOZ_OVERRIDE;
   229     void OnNuwaForkTimeout();
   231     bool ShouldContinueFromReplyTimeout() MOZ_OVERRIDE;
   232     bool ShouldSandboxContentProcesses();
   234 private:
   235     static nsDataHashtable<nsStringHashKey, ContentParent*> *sAppContentParents;
   236     static nsTArray<ContentParent*>* sNonAppContentParents;
   237     static nsTArray<ContentParent*>* sPrivateContent;
   238     static StaticAutoPtr<LinkedList<ContentParent> > sContentParents;
   240     static void JoinProcessesIOThread(const nsTArray<ContentParent*>* aProcesses,
   241                                       Monitor* aMonitor, bool* aDone);
   243     // Take the preallocated process and transform it into a "real" app process,
   244     // for the specified manifest URL.  If there is no preallocated process (or
   245     // if it's dead), this returns false.
   246     static already_AddRefed<ContentParent>
   247     MaybeTakePreallocatedAppProcess(const nsAString& aAppManifestURL,
   248                                     hal::ProcessPriority aInitialPriority);
   250     static hal::ProcessPriority GetInitialProcessPriority(Element* aFrameElement);
   252     // Hide the raw constructor methods since we don't want client code
   253     // using them.
   254     using PContentParent::SendPBrowserConstructor;
   255     using PContentParent::SendPTestShellConstructor;
   257     // No more than one of !!aApp, aIsForBrowser, and aIsForPreallocated may be
   258     // true.
   259     ContentParent(mozIApplication* aApp,
   260                   bool aIsForBrowser,
   261                   bool aIsForPreallocated,
   262                   hal::ProcessPriority aInitialPriority = hal::PROCESS_PRIORITY_FOREGROUND,
   263                   bool aIsNuwaProcess = false);
   265 #ifdef MOZ_NUWA_PROCESS
   266     ContentParent(ContentParent* aTemplate,
   267                   const nsAString& aAppManifestURL,
   268                   base::ProcessHandle aPid,
   269                   const nsTArray<ProtocolFdMapping>& aFds);
   270 #endif
   272     // The common initialization for the constructors.
   273     void InitializeMembers();
   275     // The common initialization logic shared by all constuctors.
   276     void InitInternal(ProcessPriority aPriority,
   277                       bool aSetupOffMainThreadCompositing,
   278                       bool aSendRegisteredChrome);
   280     virtual ~ContentParent();
   282     void Init();
   284     // If the frame element indicates that the child process is "critical" and
   285     // has a pending system message, this function acquires the CPU wake lock on
   286     // behalf of the child.  We'll release the lock when the system message is
   287     // handled or after a timeout, whichever comes first.
   288     void MaybeTakeCPUWakeLock(Element* aFrameElement);
   290     // Set the child process's priority and then check whether the child is
   291     // still alive.  Returns true if the process is still alive, and false
   292     // otherwise.  If you pass a FOREGROUND* priority here, it's (hopefully)
   293     // unlikely that the process will be killed after this point.
   294     bool SetPriorityAndCheckIsAlive(hal::ProcessPriority aPriority);
   296     // Transform a pre-allocated app process into a "real" app
   297     // process, for the specified manifest URL.
   298     void TransformPreallocatedIntoApp(const nsAString& aAppManifestURL);
   300     // Transform a pre-allocated app process into a browser process. If this
   301     // returns false, the child process has died.
   302     void TransformPreallocatedIntoBrowser();
   304     /**
   305      * Mark this ContentParent as dead for the purposes of Get*().
   306      * This method is idempotent.
   307      */
   308     void MarkAsDead();
   310     /**
   311      * Exit the subprocess and vamoose.  After this call IsAlive()
   312      * will return false and this ContentParent will not be returned
   313      * by the Get*() funtions.  However, the shutdown sequence itself
   314      * may be asynchronous.
   315      *
   316      * If aCloseWithError is true and this is the first call to
   317      * ShutDownProcess, then we'll close our channel using CloseWithError()
   318      * rather than vanilla Close().  CloseWithError() indicates to IPC that this
   319      * is an abnormal shutdown (e.g. a crash).
   320      */
   321     void ShutDownProcess(bool aCloseWithError);
   323     PCompositorParent*
   324     AllocPCompositorParent(mozilla::ipc::Transport* aTransport,
   325                            base::ProcessId aOtherProcess) MOZ_OVERRIDE;
   326     PImageBridgeParent*
   327     AllocPImageBridgeParent(mozilla::ipc::Transport* aTransport,
   328                             base::ProcessId aOtherProcess) MOZ_OVERRIDE;
   330     PBackgroundParent*
   331     AllocPBackgroundParent(Transport* aTransport, ProcessId aOtherProcess)
   332                            MOZ_OVERRIDE;
   334     virtual bool RecvGetProcessAttributes(uint64_t* aId,
   335                                           bool* aIsForApp,
   336                                           bool* aIsForBrowser) MOZ_OVERRIDE;
   337     virtual bool RecvGetXPCOMProcessAttributes(bool* aIsOffline) MOZ_OVERRIDE;
   339     virtual bool DeallocPJavaScriptParent(mozilla::jsipc::PJavaScriptParent*) MOZ_OVERRIDE;
   341     virtual PBrowserParent* AllocPBrowserParent(const IPCTabContext& aContext,
   342                                                 const uint32_t& aChromeFlags) MOZ_OVERRIDE;
   343     virtual bool DeallocPBrowserParent(PBrowserParent* frame) MOZ_OVERRIDE;
   345     virtual PDeviceStorageRequestParent*
   346     AllocPDeviceStorageRequestParent(const DeviceStorageParams&) MOZ_OVERRIDE;
   347     virtual bool DeallocPDeviceStorageRequestParent(PDeviceStorageRequestParent*) MOZ_OVERRIDE;
   349     virtual PFileSystemRequestParent*
   350     AllocPFileSystemRequestParent(const FileSystemParams&) MOZ_OVERRIDE;
   352     virtual bool
   353     DeallocPFileSystemRequestParent(PFileSystemRequestParent*) MOZ_OVERRIDE;
   355     virtual PBlobParent* AllocPBlobParent(const BlobConstructorParams& aParams) MOZ_OVERRIDE;
   356     virtual bool DeallocPBlobParent(PBlobParent*) MOZ_OVERRIDE;
   358     virtual bool DeallocPCrashReporterParent(PCrashReporterParent* crashreporter) MOZ_OVERRIDE;
   360     virtual bool RecvGetRandomValues(const uint32_t& length,
   361                                      InfallibleTArray<uint8_t>* randomValues) MOZ_OVERRIDE;
   363     virtual bool DeallocPHalParent(PHalParent*) MOZ_OVERRIDE;
   365     virtual bool DeallocPIndexedDBParent(PIndexedDBParent* aActor) MOZ_OVERRIDE;
   367     virtual PMemoryReportRequestParent*
   368     AllocPMemoryReportRequestParent(const uint32_t& generation,
   369                                     const bool &minimizeMemoryUsage,
   370                                     const nsString &aDMDDumpIdent) MOZ_OVERRIDE;
   371     virtual bool DeallocPMemoryReportRequestParent(PMemoryReportRequestParent* actor) MOZ_OVERRIDE;
   373     virtual PTestShellParent* AllocPTestShellParent() MOZ_OVERRIDE;
   374     virtual bool DeallocPTestShellParent(PTestShellParent* shell) MOZ_OVERRIDE;
   376     virtual bool DeallocPNeckoParent(PNeckoParent* necko) MOZ_OVERRIDE;
   378     virtual PExternalHelperAppParent* AllocPExternalHelperAppParent(
   379             const OptionalURIParams& aUri,
   380             const nsCString& aMimeContentType,
   381             const nsCString& aContentDisposition,
   382             const uint32_t& aContentDispositionHint,
   383             const nsString& aContentDispositionFilename, 
   384             const bool& aForceSave,
   385             const int64_t& aContentLength,
   386             const OptionalURIParams& aReferrer,
   387             PBrowserParent* aBrowser) MOZ_OVERRIDE;
   388     virtual bool DeallocPExternalHelperAppParent(PExternalHelperAppParent* aService) MOZ_OVERRIDE;
   390     virtual PSmsParent* AllocPSmsParent() MOZ_OVERRIDE;
   391     virtual bool DeallocPSmsParent(PSmsParent*) MOZ_OVERRIDE;
   393     virtual PTelephonyParent* AllocPTelephonyParent() MOZ_OVERRIDE;
   394     virtual bool DeallocPTelephonyParent(PTelephonyParent*) MOZ_OVERRIDE;
   396     virtual bool DeallocPStorageParent(PStorageParent* aActor) MOZ_OVERRIDE;
   398     virtual PBluetoothParent* AllocPBluetoothParent() MOZ_OVERRIDE;
   399     virtual bool DeallocPBluetoothParent(PBluetoothParent* aActor) MOZ_OVERRIDE;
   400     virtual bool RecvPBluetoothConstructor(PBluetoothParent* aActor) MOZ_OVERRIDE;
   402     virtual PFMRadioParent* AllocPFMRadioParent() MOZ_OVERRIDE;
   403     virtual bool DeallocPFMRadioParent(PFMRadioParent* aActor) MOZ_OVERRIDE;
   405     virtual PAsmJSCacheEntryParent* AllocPAsmJSCacheEntryParent(
   406                                  const asmjscache::OpenMode& aOpenMode,
   407                                  const asmjscache::WriteParams& aWriteParams,
   408                                  const IPC::Principal& aPrincipal) MOZ_OVERRIDE;
   409     virtual bool DeallocPAsmJSCacheEntryParent(
   410                                    PAsmJSCacheEntryParent* aActor) MOZ_OVERRIDE;
   412     virtual PSpeechSynthesisParent* AllocPSpeechSynthesisParent() MOZ_OVERRIDE;
   413     virtual bool DeallocPSpeechSynthesisParent(PSpeechSynthesisParent* aActor) MOZ_OVERRIDE;
   414     virtual bool RecvPSpeechSynthesisConstructor(PSpeechSynthesisParent* aActor) MOZ_OVERRIDE;
   416     virtual bool RecvReadPrefsArray(InfallibleTArray<PrefSetting>* aPrefs) MOZ_OVERRIDE;
   417     virtual bool RecvReadFontList(InfallibleTArray<FontListEntry>* retValue) MOZ_OVERRIDE;
   419     virtual bool RecvReadPermissions(InfallibleTArray<IPC::Permission>* aPermissions) MOZ_OVERRIDE;
   421     virtual bool RecvSetClipboardText(const nsString& text,
   422                                       const bool& isPrivateData,
   423                                       const int32_t& whichClipboard) MOZ_OVERRIDE;
   424     virtual bool RecvGetClipboardText(const int32_t& whichClipboard, nsString* text) MOZ_OVERRIDE;
   425     virtual bool RecvEmptyClipboard(const int32_t& whichClipboard) MOZ_OVERRIDE;
   426     virtual bool RecvClipboardHasText(const int32_t& whichClipboard, bool* hasText) MOZ_OVERRIDE;
   428     virtual bool RecvGetSystemColors(const uint32_t& colorsCount,
   429                                      InfallibleTArray<uint32_t>* colors) MOZ_OVERRIDE;
   430     virtual bool RecvGetIconForExtension(const nsCString& aFileExt,
   431                                          const uint32_t& aIconSize,
   432                                          InfallibleTArray<uint8_t>* bits) MOZ_OVERRIDE;
   433     virtual bool RecvGetShowPasswordSetting(bool* showPassword) MOZ_OVERRIDE;
   435     virtual bool RecvStartVisitedQuery(const URIParams& uri) MOZ_OVERRIDE;
   437     virtual bool RecvVisitURI(const URIParams& uri,
   438                               const OptionalURIParams& referrer,
   439                               const uint32_t& flags) MOZ_OVERRIDE;
   441     virtual bool RecvSetURITitle(const URIParams& uri,
   442                                  const nsString& title) MOZ_OVERRIDE;
   444     virtual bool RecvShowAlertNotification(const nsString& aImageUrl, const nsString& aTitle,
   445                                            const nsString& aText, const bool& aTextClickable,
   446                                            const nsString& aCookie, const nsString& aName,
   447                                            const nsString& aBidi, const nsString& aLang,
   448                                            const IPC::Principal& aPrincipal) MOZ_OVERRIDE;
   450     virtual bool RecvCloseAlert(const nsString& aName,
   451                                 const IPC::Principal& aPrincipal) MOZ_OVERRIDE;
   453     virtual bool RecvLoadURIExternal(const URIParams& uri) MOZ_OVERRIDE;
   455     virtual bool RecvSyncMessage(const nsString& aMsg,
   456                                  const ClonedMessageData& aData,
   457                                  const InfallibleTArray<CpowEntry>& aCpows,
   458                                  const IPC::Principal& aPrincipal,
   459                                  InfallibleTArray<nsString>* aRetvals) MOZ_OVERRIDE;
   460     virtual bool AnswerRpcMessage(const nsString& aMsg,
   461                                   const ClonedMessageData& aData,
   462                                   const InfallibleTArray<CpowEntry>& aCpows,
   463                                   const IPC::Principal& aPrincipal,
   464                                   InfallibleTArray<nsString>* aRetvals) MOZ_OVERRIDE;
   465     virtual bool RecvAsyncMessage(const nsString& aMsg,
   466                                   const ClonedMessageData& aData,
   467                                   const InfallibleTArray<CpowEntry>& aCpows,
   468                                   const IPC::Principal& aPrincipal) MOZ_OVERRIDE;
   470     virtual bool RecvFilePathUpdateNotify(const nsString& aType,
   471                                           const nsString& aStorageName,
   472                                           const nsString& aFilePath,
   473                                           const nsCString& aReason) MOZ_OVERRIDE;
   475     virtual bool RecvAddGeolocationListener(const IPC::Principal& aPrincipal,
   476                                             const bool& aHighAccuracy) MOZ_OVERRIDE;
   477     virtual bool RecvRemoveGeolocationListener() MOZ_OVERRIDE;
   478     virtual bool RecvSetGeolocationHigherAccuracy(const bool& aEnable) MOZ_OVERRIDE;
   480     virtual bool RecvConsoleMessage(const nsString& aMessage) MOZ_OVERRIDE;
   481     virtual bool RecvScriptError(const nsString& aMessage,
   482                                  const nsString& aSourceName,
   483                                  const nsString& aSourceLine,
   484                                  const uint32_t& aLineNumber,
   485                                  const uint32_t& aColNumber,
   486                                  const uint32_t& aFlags,
   487                                  const nsCString& aCategory) MOZ_OVERRIDE;
   489     virtual bool RecvPrivateDocShellsExist(const bool& aExist) MOZ_OVERRIDE;
   491     virtual bool RecvFirstIdle() MOZ_OVERRIDE;
   493     virtual bool RecvAudioChannelGetState(const AudioChannel& aChannel,
   494                                           const bool& aElementHidden,
   495                                           const bool& aElementWasHidden,
   496                                           AudioChannelState* aValue) MOZ_OVERRIDE;
   498     virtual bool RecvAudioChannelRegisterType(const AudioChannel& aChannel,
   499                                               const bool& aWithVideo) MOZ_OVERRIDE;
   500     virtual bool RecvAudioChannelUnregisterType(const AudioChannel& aChannel,
   501                                                 const bool& aElementHidden,
   502                                                 const bool& aWithVideo) MOZ_OVERRIDE;
   504     virtual bool RecvAudioChannelChangedNotification() MOZ_OVERRIDE;
   506     virtual bool RecvAudioChannelChangeDefVolChannel(const int32_t& aChannel,
   507                                                      const bool& aHidden) MOZ_OVERRIDE;
   509     virtual bool RecvBroadcastVolume(const nsString& aVolumeName) MOZ_OVERRIDE;
   511     virtual bool RecvSpeakerManagerGetSpeakerStatus(bool* aValue) MOZ_OVERRIDE;
   513     virtual bool RecvSpeakerManagerForceSpeaker(const bool& aEnable) MOZ_OVERRIDE;
   515     virtual bool RecvSystemMessageHandled() MOZ_OVERRIDE;
   517     virtual bool RecvNuwaReady() MOZ_OVERRIDE;
   519     virtual bool RecvAddNewProcess(const uint32_t& aPid,
   520                                    const InfallibleTArray<ProtocolFdMapping>& aFds) MOZ_OVERRIDE;
   522     virtual bool RecvCreateFakeVolume(const nsString& fsName, const nsString& mountPoint) MOZ_OVERRIDE;
   524     virtual bool RecvSetFakeVolumeState(const nsString& fsName, const int32_t& fsState) MOZ_OVERRIDE;
   526     virtual bool RecvKeywordToURI(const nsCString& aKeyword, OptionalInputStreamParams* aPostData,
   527                                   OptionalURIParams* aURI) MOZ_OVERRIDE;
   529     virtual void ProcessingError(Result what) MOZ_OVERRIDE;
   531     virtual bool RecvGetGraphicsFeatureStatus(const int32_t& aFeature,
   532                                               int32_t* aStatus,
   533                                               bool* aSuccess) MOZ_OVERRIDE;
   535     virtual bool RecvAddIdleObserver(const uint64_t& observerId,
   536                                      const uint32_t& aIdleTimeInS) MOZ_OVERRIDE;
   537     virtual bool RecvRemoveIdleObserver(const uint64_t& observerId,
   538                                         const uint32_t& aIdleTimeInS) MOZ_OVERRIDE;
   540     virtual bool
   541     RecvBackUpXResources(const FileDescriptor& aXSocketFd) MOZ_OVERRIDE;
   543     virtual PFileDescriptorSetParent*
   544     AllocPFileDescriptorSetParent(const mozilla::ipc::FileDescriptor&) MOZ_OVERRIDE;
   546     virtual bool
   547     DeallocPFileDescriptorSetParent(PFileDescriptorSetParent*) MOZ_OVERRIDE;
   549     // If you add strong pointers to cycle collected objects here, be sure to
   550     // release these objects in ShutDownProcess.  See the comment there for more
   551     // details.
   553     GeckoChildProcessHost* mSubprocess;
   555     uint64_t mChildID;
   556     int32_t mGeolocationWatchID;
   558     nsString mAppManifestURL;
   560     /**
   561      * We cache mAppName instead of looking it up using mAppManifestURL when we
   562      * need it because it turns out that getting an app from the apps service is
   563      * expensive.
   564      */
   565     nsString mAppName;
   567     nsRefPtr<nsFrameMessageManager> mMessageManager;
   569     // After we initiate shutdown, we also start a timer to ensure
   570     // that even content processes that are 100% blocked (say from
   571     // SIGSTOP), are still killed eventually.  This task enforces that
   572     // timer.
   573     CancelableTask* mForceKillTask;
   574     // How many tabs we're waiting to finish their destruction
   575     // sequence.  Precisely, how many TabParents have called
   576     // NotifyTabDestroying() but not called NotifyTabDestroyed().
   577     int32_t mNumDestroyingTabs;
   578     // True only while this is ready to be used to host remote tabs.
   579     // This must not be used for new purposes after mIsAlive goes to
   580     // false, but some previously scheduled IPC traffic may still pass
   581     // through.
   582     bool mIsAlive;
   584     bool mSendPermissionUpdates;
   585     bool mIsForBrowser;
   586     bool mIsNuwaProcess;
   588     // These variables track whether we've called Close(), CloseWithError()
   589     // and KillHard() on our channel.
   590     bool mCalledClose;
   591     bool mCalledCloseWithError;
   592     bool mCalledKillHard;
   594     friend class CrashReporterParent;
   596     nsRefPtr<nsConsoleService>  mConsoleService;
   597     nsConsoleService* GetConsoleService();
   599     nsDataHashtable<nsUint64HashKey, nsRefPtr<ParentIdleListener> > mIdleListeners;
   601 #ifdef MOZ_X11
   602     // Dup of child's X socket, used to scope its resources to this
   603     // object instead of the child process's lifetime.
   604     ScopedClose mChildXSocketFdDup;
   605 #endif
   606 };
   608 } // namespace dom
   609 } // namespace mozilla
   611 class ParentIdleListener : public nsIObserver {
   612 public:
   613   NS_DECL_ISUPPORTS
   614   NS_DECL_NSIOBSERVER
   616   ParentIdleListener(mozilla::dom::ContentParent* aParent, uint64_t aObserver)
   617     : mParent(aParent), mObserver(aObserver)
   618   {}
   619   virtual ~ParentIdleListener() {}
   620 private:
   621   nsRefPtr<mozilla::dom::ContentParent> mParent;
   622   uint64_t mObserver;
   623 };
   625 #endif

mercurial