michael@0: /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ michael@0: /* vim: set sw=4 ts=8 et tw=80 : */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #ifndef mozilla_dom_ContentParent_h michael@0: #define mozilla_dom_ContentParent_h michael@0: michael@0: #include "mozilla/dom/PContentParent.h" michael@0: #include "mozilla/ipc/GeckoChildProcessHost.h" michael@0: #include "mozilla/dom/ipc/Blob.h" michael@0: #include "mozilla/Attributes.h" michael@0: #include "mozilla/FileUtils.h" michael@0: #include "mozilla/HalTypes.h" michael@0: #include "mozilla/LinkedList.h" michael@0: #include "mozilla/StaticPtr.h" michael@0: michael@0: #include "nsDataHashtable.h" michael@0: #include "nsFrameMessageManager.h" michael@0: #include "nsHashKeys.h" michael@0: #include "nsIObserver.h" michael@0: #include "nsIThreadInternal.h" michael@0: #include "nsIDOMGeoPositionCallback.h" michael@0: #include "PermissionMessageUtils.h" michael@0: michael@0: #define CHILD_PROCESS_SHUTDOWN_MESSAGE NS_LITERAL_STRING("child-process-shutdown") michael@0: michael@0: class mozIApplication; michael@0: class nsConsoleService; michael@0: class nsIDOMBlob; michael@0: class nsIMemoryReporter; michael@0: class ParentIdleListener; michael@0: michael@0: namespace mozilla { michael@0: michael@0: namespace ipc { michael@0: class OptionalURIParams; michael@0: class URIParams; michael@0: class TestShellParent; michael@0: } // namespace ipc michael@0: michael@0: namespace jsipc { michael@0: class JavaScriptParent; michael@0: class PJavaScriptParent; michael@0: } michael@0: michael@0: namespace layers { michael@0: class PCompositorParent; michael@0: } // namespace layers michael@0: michael@0: namespace dom { michael@0: michael@0: class Element; michael@0: class TabParent; michael@0: class PStorageParent; michael@0: class ClonedMessageData; michael@0: class MemoryReport; michael@0: class TabContext; michael@0: class PFileDescriptorSetParent; michael@0: michael@0: class ContentParent : public PContentParent michael@0: , public nsIObserver michael@0: , public nsIDOMGeoPositionCallback michael@0: , public mozilla::dom::ipc::MessageManagerCallback michael@0: , public mozilla::LinkedListElement michael@0: { michael@0: typedef mozilla::ipc::GeckoChildProcessHost GeckoChildProcessHost; michael@0: typedef mozilla::ipc::OptionalURIParams OptionalURIParams; michael@0: typedef mozilla::ipc::TestShellParent TestShellParent; michael@0: typedef mozilla::ipc::URIParams URIParams; michael@0: typedef mozilla::dom::ClonedMessageData ClonedMessageData; michael@0: michael@0: public: michael@0: /** michael@0: * Start up the content-process machinery. This might include michael@0: * scheduling pre-launch tasks. michael@0: */ michael@0: static void StartUp(); michael@0: /** Shut down the content-process machinery. */ michael@0: static void ShutDown(); michael@0: /** michael@0: * Ensure that all subprocesses are terminated and their OS michael@0: * resources have been reaped. This is synchronous and can be michael@0: * very expensive in general. It also bypasses the normal michael@0: * shutdown process. michael@0: */ michael@0: static void JoinAllSubprocesses(); michael@0: michael@0: static bool PreallocatedProcessReady(); michael@0: static void RunAfterPreallocatedProcessReady(nsIRunnable* aRequest); michael@0: michael@0: static already_AddRefed michael@0: GetNewOrUsed(bool aForBrowserElement = false); michael@0: michael@0: /** michael@0: * Create a subprocess suitable for use as a preallocated app process. michael@0: */ michael@0: static already_AddRefed PreallocateAppProcess(); michael@0: michael@0: static already_AddRefed RunNuwaProcess(); michael@0: michael@0: /** michael@0: * Get or create a content process for the given TabContext. aFrameElement michael@0: * should be the frame/iframe element with which this process will michael@0: * associated. michael@0: */ michael@0: static TabParent* michael@0: CreateBrowserOrApp(const TabContext& aContext, michael@0: Element* aFrameElement); michael@0: michael@0: static void GetAll(nsTArray& aArray); michael@0: static void GetAllEvenIfDead(nsTArray& aArray); michael@0: michael@0: NS_DECL_CYCLE_COLLECTION_CLASS_AMBIGUOUS(ContentParent, nsIObserver) michael@0: michael@0: NS_DECL_CYCLE_COLLECTING_ISUPPORTS michael@0: NS_DECL_NSIOBSERVER michael@0: NS_DECL_NSIDOMGEOPOSITIONCALLBACK michael@0: michael@0: /** michael@0: * MessageManagerCallback methods that we override. michael@0: */ michael@0: virtual bool DoSendAsyncMessage(JSContext* aCx, michael@0: const nsAString& aMessage, michael@0: const mozilla::dom::StructuredCloneData& aData, michael@0: JS::Handle aCpows, michael@0: nsIPrincipal* aPrincipal) MOZ_OVERRIDE; michael@0: virtual bool CheckPermission(const nsAString& aPermission) MOZ_OVERRIDE; michael@0: virtual bool CheckManifestURL(const nsAString& aManifestURL) MOZ_OVERRIDE; michael@0: virtual bool CheckAppHasPermission(const nsAString& aPermission) MOZ_OVERRIDE; michael@0: virtual bool CheckAppHasStatus(unsigned short aStatus) MOZ_OVERRIDE; michael@0: michael@0: /** Notify that a tab is beginning its destruction sequence. */ michael@0: void NotifyTabDestroying(PBrowserParent* aTab); michael@0: /** Notify that a tab was destroyed during normal operation. */ michael@0: void NotifyTabDestroyed(PBrowserParent* aTab, michael@0: bool aNotifiedDestroying); michael@0: michael@0: TestShellParent* CreateTestShell(); michael@0: bool DestroyTestShell(TestShellParent* aTestShell); michael@0: TestShellParent* GetTestShellSingleton(); michael@0: jsipc::JavaScriptParent *GetCPOWManager(); michael@0: michael@0: void ReportChildAlreadyBlocked(); michael@0: bool RequestRunToCompletion(); michael@0: michael@0: bool IsAlive(); michael@0: bool IsForApp(); michael@0: #ifdef MOZ_NUWA_PROCESS michael@0: bool IsNuwaProcess(); michael@0: #endif michael@0: michael@0: GeckoChildProcessHost* Process() { michael@0: return mSubprocess; michael@0: } michael@0: michael@0: int32_t Pid(); michael@0: michael@0: bool NeedsPermissionsUpdate() { michael@0: return mSendPermissionUpdates; michael@0: } michael@0: michael@0: BlobParent* GetOrCreateActorForBlob(nsIDOMBlob* aBlob); michael@0: michael@0: /** michael@0: * Kill our subprocess and make sure it dies. Should only be used michael@0: * in emergency situations since it bypasses the normal shutdown michael@0: * process. michael@0: */ michael@0: void KillHard(); michael@0: michael@0: uint64_t ChildID() { return mChildID; } michael@0: const nsString& AppManifestURL() const { return mAppManifestURL; } michael@0: michael@0: bool IsPreallocated(); michael@0: michael@0: /** michael@0: * Get a user-friendly name for this ContentParent. We make no guarantees michael@0: * about this name: It might not be unique, apps can spoof special names, michael@0: * etc. So please don't use this name to make any decisions about the michael@0: * ContentParent based on the value returned here. michael@0: */ michael@0: void FriendlyName(nsAString& aName); michael@0: michael@0: virtual void OnChannelError() MOZ_OVERRIDE; michael@0: michael@0: virtual PIndexedDBParent* AllocPIndexedDBParent() MOZ_OVERRIDE; michael@0: virtual bool michael@0: RecvPIndexedDBConstructor(PIndexedDBParent* aActor) MOZ_OVERRIDE; michael@0: michael@0: virtual PCrashReporterParent* michael@0: AllocPCrashReporterParent(const NativeThreadId& tid, michael@0: const uint32_t& processType) MOZ_OVERRIDE; michael@0: virtual bool michael@0: RecvPCrashReporterConstructor(PCrashReporterParent* actor, michael@0: const NativeThreadId& tid, michael@0: const uint32_t& processType) MOZ_OVERRIDE; michael@0: michael@0: virtual PNeckoParent* AllocPNeckoParent() MOZ_OVERRIDE; michael@0: virtual bool RecvPNeckoConstructor(PNeckoParent* aActor) MOZ_OVERRIDE { michael@0: return PContentParent::RecvPNeckoConstructor(aActor); michael@0: } michael@0: michael@0: virtual PHalParent* AllocPHalParent() MOZ_OVERRIDE; michael@0: virtual bool RecvPHalConstructor(PHalParent* aActor) MOZ_OVERRIDE { michael@0: return PContentParent::RecvPHalConstructor(aActor); michael@0: } michael@0: michael@0: virtual PStorageParent* AllocPStorageParent() MOZ_OVERRIDE; michael@0: virtual bool RecvPStorageConstructor(PStorageParent* aActor) MOZ_OVERRIDE { michael@0: return PContentParent::RecvPStorageConstructor(aActor); michael@0: } michael@0: michael@0: virtual PJavaScriptParent* michael@0: AllocPJavaScriptParent() MOZ_OVERRIDE; michael@0: virtual bool michael@0: RecvPJavaScriptConstructor(PJavaScriptParent* aActor) MOZ_OVERRIDE { michael@0: return PContentParent::RecvPJavaScriptConstructor(aActor); michael@0: } michael@0: michael@0: virtual bool RecvRecordingDeviceEvents(const nsString& aRecordingStatus, michael@0: const nsString& aPageURL, michael@0: const bool& aIsAudio, michael@0: const bool& aIsVideo) MOZ_OVERRIDE; michael@0: protected: michael@0: void OnChannelConnected(int32_t pid) MOZ_OVERRIDE; michael@0: virtual void ActorDestroy(ActorDestroyReason why) MOZ_OVERRIDE; michael@0: void OnNuwaForkTimeout(); michael@0: michael@0: bool ShouldContinueFromReplyTimeout() MOZ_OVERRIDE; michael@0: bool ShouldSandboxContentProcesses(); michael@0: michael@0: private: michael@0: static nsDataHashtable *sAppContentParents; michael@0: static nsTArray* sNonAppContentParents; michael@0: static nsTArray* sPrivateContent; michael@0: static StaticAutoPtr > sContentParents; michael@0: michael@0: static void JoinProcessesIOThread(const nsTArray* aProcesses, michael@0: Monitor* aMonitor, bool* aDone); michael@0: michael@0: // Take the preallocated process and transform it into a "real" app process, michael@0: // for the specified manifest URL. If there is no preallocated process (or michael@0: // if it's dead), this returns false. michael@0: static already_AddRefed michael@0: MaybeTakePreallocatedAppProcess(const nsAString& aAppManifestURL, michael@0: hal::ProcessPriority aInitialPriority); michael@0: michael@0: static hal::ProcessPriority GetInitialProcessPriority(Element* aFrameElement); michael@0: michael@0: // Hide the raw constructor methods since we don't want client code michael@0: // using them. michael@0: using PContentParent::SendPBrowserConstructor; michael@0: using PContentParent::SendPTestShellConstructor; michael@0: michael@0: // No more than one of !!aApp, aIsForBrowser, and aIsForPreallocated may be michael@0: // true. michael@0: ContentParent(mozIApplication* aApp, michael@0: bool aIsForBrowser, michael@0: bool aIsForPreallocated, michael@0: hal::ProcessPriority aInitialPriority = hal::PROCESS_PRIORITY_FOREGROUND, michael@0: bool aIsNuwaProcess = false); michael@0: michael@0: #ifdef MOZ_NUWA_PROCESS michael@0: ContentParent(ContentParent* aTemplate, michael@0: const nsAString& aAppManifestURL, michael@0: base::ProcessHandle aPid, michael@0: const nsTArray& aFds); michael@0: #endif michael@0: michael@0: // The common initialization for the constructors. michael@0: void InitializeMembers(); michael@0: michael@0: // The common initialization logic shared by all constuctors. michael@0: void InitInternal(ProcessPriority aPriority, michael@0: bool aSetupOffMainThreadCompositing, michael@0: bool aSendRegisteredChrome); michael@0: michael@0: virtual ~ContentParent(); michael@0: michael@0: void Init(); michael@0: michael@0: // If the frame element indicates that the child process is "critical" and michael@0: // has a pending system message, this function acquires the CPU wake lock on michael@0: // behalf of the child. We'll release the lock when the system message is michael@0: // handled or after a timeout, whichever comes first. michael@0: void MaybeTakeCPUWakeLock(Element* aFrameElement); michael@0: michael@0: // Set the child process's priority and then check whether the child is michael@0: // still alive. Returns true if the process is still alive, and false michael@0: // otherwise. If you pass a FOREGROUND* priority here, it's (hopefully) michael@0: // unlikely that the process will be killed after this point. michael@0: bool SetPriorityAndCheckIsAlive(hal::ProcessPriority aPriority); michael@0: michael@0: // Transform a pre-allocated app process into a "real" app michael@0: // process, for the specified manifest URL. michael@0: void TransformPreallocatedIntoApp(const nsAString& aAppManifestURL); michael@0: michael@0: // Transform a pre-allocated app process into a browser process. If this michael@0: // returns false, the child process has died. michael@0: void TransformPreallocatedIntoBrowser(); michael@0: michael@0: /** michael@0: * Mark this ContentParent as dead for the purposes of Get*(). michael@0: * This method is idempotent. michael@0: */ michael@0: void MarkAsDead(); michael@0: michael@0: /** michael@0: * Exit the subprocess and vamoose. After this call IsAlive() michael@0: * will return false and this ContentParent will not be returned michael@0: * by the Get*() funtions. However, the shutdown sequence itself michael@0: * may be asynchronous. michael@0: * michael@0: * If aCloseWithError is true and this is the first call to michael@0: * ShutDownProcess, then we'll close our channel using CloseWithError() michael@0: * rather than vanilla Close(). CloseWithError() indicates to IPC that this michael@0: * is an abnormal shutdown (e.g. a crash). michael@0: */ michael@0: void ShutDownProcess(bool aCloseWithError); michael@0: michael@0: PCompositorParent* michael@0: AllocPCompositorParent(mozilla::ipc::Transport* aTransport, michael@0: base::ProcessId aOtherProcess) MOZ_OVERRIDE; michael@0: PImageBridgeParent* michael@0: AllocPImageBridgeParent(mozilla::ipc::Transport* aTransport, michael@0: base::ProcessId aOtherProcess) MOZ_OVERRIDE; michael@0: michael@0: PBackgroundParent* michael@0: AllocPBackgroundParent(Transport* aTransport, ProcessId aOtherProcess) michael@0: MOZ_OVERRIDE; michael@0: michael@0: virtual bool RecvGetProcessAttributes(uint64_t* aId, michael@0: bool* aIsForApp, michael@0: bool* aIsForBrowser) MOZ_OVERRIDE; michael@0: virtual bool RecvGetXPCOMProcessAttributes(bool* aIsOffline) MOZ_OVERRIDE; michael@0: michael@0: virtual bool DeallocPJavaScriptParent(mozilla::jsipc::PJavaScriptParent*) MOZ_OVERRIDE; michael@0: michael@0: virtual PBrowserParent* AllocPBrowserParent(const IPCTabContext& aContext, michael@0: const uint32_t& aChromeFlags) MOZ_OVERRIDE; michael@0: virtual bool DeallocPBrowserParent(PBrowserParent* frame) MOZ_OVERRIDE; michael@0: michael@0: virtual PDeviceStorageRequestParent* michael@0: AllocPDeviceStorageRequestParent(const DeviceStorageParams&) MOZ_OVERRIDE; michael@0: virtual bool DeallocPDeviceStorageRequestParent(PDeviceStorageRequestParent*) MOZ_OVERRIDE; michael@0: michael@0: virtual PFileSystemRequestParent* michael@0: AllocPFileSystemRequestParent(const FileSystemParams&) MOZ_OVERRIDE; michael@0: michael@0: virtual bool michael@0: DeallocPFileSystemRequestParent(PFileSystemRequestParent*) MOZ_OVERRIDE; michael@0: michael@0: virtual PBlobParent* AllocPBlobParent(const BlobConstructorParams& aParams) MOZ_OVERRIDE; michael@0: virtual bool DeallocPBlobParent(PBlobParent*) MOZ_OVERRIDE; michael@0: michael@0: virtual bool DeallocPCrashReporterParent(PCrashReporterParent* crashreporter) MOZ_OVERRIDE; michael@0: michael@0: virtual bool RecvGetRandomValues(const uint32_t& length, michael@0: InfallibleTArray* randomValues) MOZ_OVERRIDE; michael@0: michael@0: virtual bool DeallocPHalParent(PHalParent*) MOZ_OVERRIDE; michael@0: michael@0: virtual bool DeallocPIndexedDBParent(PIndexedDBParent* aActor) MOZ_OVERRIDE; michael@0: michael@0: virtual PMemoryReportRequestParent* michael@0: AllocPMemoryReportRequestParent(const uint32_t& generation, michael@0: const bool &minimizeMemoryUsage, michael@0: const nsString &aDMDDumpIdent) MOZ_OVERRIDE; michael@0: virtual bool DeallocPMemoryReportRequestParent(PMemoryReportRequestParent* actor) MOZ_OVERRIDE; michael@0: michael@0: virtual PTestShellParent* AllocPTestShellParent() MOZ_OVERRIDE; michael@0: virtual bool DeallocPTestShellParent(PTestShellParent* shell) MOZ_OVERRIDE; michael@0: michael@0: virtual bool DeallocPNeckoParent(PNeckoParent* necko) MOZ_OVERRIDE; michael@0: michael@0: virtual PExternalHelperAppParent* AllocPExternalHelperAppParent( michael@0: const OptionalURIParams& aUri, michael@0: const nsCString& aMimeContentType, michael@0: const nsCString& aContentDisposition, michael@0: const uint32_t& aContentDispositionHint, michael@0: const nsString& aContentDispositionFilename, michael@0: const bool& aForceSave, michael@0: const int64_t& aContentLength, michael@0: const OptionalURIParams& aReferrer, michael@0: PBrowserParent* aBrowser) MOZ_OVERRIDE; michael@0: virtual bool DeallocPExternalHelperAppParent(PExternalHelperAppParent* aService) MOZ_OVERRIDE; michael@0: michael@0: virtual PSmsParent* AllocPSmsParent() MOZ_OVERRIDE; michael@0: virtual bool DeallocPSmsParent(PSmsParent*) MOZ_OVERRIDE; michael@0: michael@0: virtual PTelephonyParent* AllocPTelephonyParent() MOZ_OVERRIDE; michael@0: virtual bool DeallocPTelephonyParent(PTelephonyParent*) MOZ_OVERRIDE; michael@0: michael@0: virtual bool DeallocPStorageParent(PStorageParent* aActor) MOZ_OVERRIDE; michael@0: michael@0: virtual PBluetoothParent* AllocPBluetoothParent() MOZ_OVERRIDE; michael@0: virtual bool DeallocPBluetoothParent(PBluetoothParent* aActor) MOZ_OVERRIDE; michael@0: virtual bool RecvPBluetoothConstructor(PBluetoothParent* aActor) MOZ_OVERRIDE; michael@0: michael@0: virtual PFMRadioParent* AllocPFMRadioParent() MOZ_OVERRIDE; michael@0: virtual bool DeallocPFMRadioParent(PFMRadioParent* aActor) MOZ_OVERRIDE; michael@0: michael@0: virtual PAsmJSCacheEntryParent* AllocPAsmJSCacheEntryParent( michael@0: const asmjscache::OpenMode& aOpenMode, michael@0: const asmjscache::WriteParams& aWriteParams, michael@0: const IPC::Principal& aPrincipal) MOZ_OVERRIDE; michael@0: virtual bool DeallocPAsmJSCacheEntryParent( michael@0: PAsmJSCacheEntryParent* aActor) MOZ_OVERRIDE; michael@0: michael@0: virtual PSpeechSynthesisParent* AllocPSpeechSynthesisParent() MOZ_OVERRIDE; michael@0: virtual bool DeallocPSpeechSynthesisParent(PSpeechSynthesisParent* aActor) MOZ_OVERRIDE; michael@0: virtual bool RecvPSpeechSynthesisConstructor(PSpeechSynthesisParent* aActor) MOZ_OVERRIDE; michael@0: michael@0: virtual bool RecvReadPrefsArray(InfallibleTArray* aPrefs) MOZ_OVERRIDE; michael@0: virtual bool RecvReadFontList(InfallibleTArray* retValue) MOZ_OVERRIDE; michael@0: michael@0: virtual bool RecvReadPermissions(InfallibleTArray* aPermissions) MOZ_OVERRIDE; michael@0: michael@0: virtual bool RecvSetClipboardText(const nsString& text, michael@0: const bool& isPrivateData, michael@0: const int32_t& whichClipboard) MOZ_OVERRIDE; michael@0: virtual bool RecvGetClipboardText(const int32_t& whichClipboard, nsString* text) MOZ_OVERRIDE; michael@0: virtual bool RecvEmptyClipboard(const int32_t& whichClipboard) MOZ_OVERRIDE; michael@0: virtual bool RecvClipboardHasText(const int32_t& whichClipboard, bool* hasText) MOZ_OVERRIDE; michael@0: michael@0: virtual bool RecvGetSystemColors(const uint32_t& colorsCount, michael@0: InfallibleTArray* colors) MOZ_OVERRIDE; michael@0: virtual bool RecvGetIconForExtension(const nsCString& aFileExt, michael@0: const uint32_t& aIconSize, michael@0: InfallibleTArray* bits) MOZ_OVERRIDE; michael@0: virtual bool RecvGetShowPasswordSetting(bool* showPassword) MOZ_OVERRIDE; michael@0: michael@0: virtual bool RecvStartVisitedQuery(const URIParams& uri) MOZ_OVERRIDE; michael@0: michael@0: virtual bool RecvVisitURI(const URIParams& uri, michael@0: const OptionalURIParams& referrer, michael@0: const uint32_t& flags) MOZ_OVERRIDE; michael@0: michael@0: virtual bool RecvSetURITitle(const URIParams& uri, michael@0: const nsString& title) MOZ_OVERRIDE; michael@0: michael@0: virtual bool RecvShowAlertNotification(const nsString& aImageUrl, const nsString& aTitle, michael@0: const nsString& aText, const bool& aTextClickable, michael@0: const nsString& aCookie, const nsString& aName, michael@0: const nsString& aBidi, const nsString& aLang, michael@0: const IPC::Principal& aPrincipal) MOZ_OVERRIDE; michael@0: michael@0: virtual bool RecvCloseAlert(const nsString& aName, michael@0: const IPC::Principal& aPrincipal) MOZ_OVERRIDE; michael@0: michael@0: virtual bool RecvLoadURIExternal(const URIParams& uri) MOZ_OVERRIDE; michael@0: michael@0: virtual bool RecvSyncMessage(const nsString& aMsg, michael@0: const ClonedMessageData& aData, michael@0: const InfallibleTArray& aCpows, michael@0: const IPC::Principal& aPrincipal, michael@0: InfallibleTArray* aRetvals) MOZ_OVERRIDE; michael@0: virtual bool AnswerRpcMessage(const nsString& aMsg, michael@0: const ClonedMessageData& aData, michael@0: const InfallibleTArray& aCpows, michael@0: const IPC::Principal& aPrincipal, michael@0: InfallibleTArray* aRetvals) MOZ_OVERRIDE; michael@0: virtual bool RecvAsyncMessage(const nsString& aMsg, michael@0: const ClonedMessageData& aData, michael@0: const InfallibleTArray& aCpows, michael@0: const IPC::Principal& aPrincipal) MOZ_OVERRIDE; michael@0: michael@0: virtual bool RecvFilePathUpdateNotify(const nsString& aType, michael@0: const nsString& aStorageName, michael@0: const nsString& aFilePath, michael@0: const nsCString& aReason) MOZ_OVERRIDE; michael@0: michael@0: virtual bool RecvAddGeolocationListener(const IPC::Principal& aPrincipal, michael@0: const bool& aHighAccuracy) MOZ_OVERRIDE; michael@0: virtual bool RecvRemoveGeolocationListener() MOZ_OVERRIDE; michael@0: virtual bool RecvSetGeolocationHigherAccuracy(const bool& aEnable) MOZ_OVERRIDE; michael@0: michael@0: virtual bool RecvConsoleMessage(const nsString& aMessage) MOZ_OVERRIDE; michael@0: virtual bool RecvScriptError(const nsString& aMessage, michael@0: const nsString& aSourceName, michael@0: const nsString& aSourceLine, michael@0: const uint32_t& aLineNumber, michael@0: const uint32_t& aColNumber, michael@0: const uint32_t& aFlags, michael@0: const nsCString& aCategory) MOZ_OVERRIDE; michael@0: michael@0: virtual bool RecvPrivateDocShellsExist(const bool& aExist) MOZ_OVERRIDE; michael@0: michael@0: virtual bool RecvFirstIdle() MOZ_OVERRIDE; michael@0: michael@0: virtual bool RecvAudioChannelGetState(const AudioChannel& aChannel, michael@0: const bool& aElementHidden, michael@0: const bool& aElementWasHidden, michael@0: AudioChannelState* aValue) MOZ_OVERRIDE; michael@0: michael@0: virtual bool RecvAudioChannelRegisterType(const AudioChannel& aChannel, michael@0: const bool& aWithVideo) MOZ_OVERRIDE; michael@0: virtual bool RecvAudioChannelUnregisterType(const AudioChannel& aChannel, michael@0: const bool& aElementHidden, michael@0: const bool& aWithVideo) MOZ_OVERRIDE; michael@0: michael@0: virtual bool RecvAudioChannelChangedNotification() MOZ_OVERRIDE; michael@0: michael@0: virtual bool RecvAudioChannelChangeDefVolChannel(const int32_t& aChannel, michael@0: const bool& aHidden) MOZ_OVERRIDE; michael@0: michael@0: virtual bool RecvBroadcastVolume(const nsString& aVolumeName) MOZ_OVERRIDE; michael@0: michael@0: virtual bool RecvSpeakerManagerGetSpeakerStatus(bool* aValue) MOZ_OVERRIDE; michael@0: michael@0: virtual bool RecvSpeakerManagerForceSpeaker(const bool& aEnable) MOZ_OVERRIDE; michael@0: michael@0: virtual bool RecvSystemMessageHandled() MOZ_OVERRIDE; michael@0: michael@0: virtual bool RecvNuwaReady() MOZ_OVERRIDE; michael@0: michael@0: virtual bool RecvAddNewProcess(const uint32_t& aPid, michael@0: const InfallibleTArray& aFds) MOZ_OVERRIDE; michael@0: michael@0: virtual bool RecvCreateFakeVolume(const nsString& fsName, const nsString& mountPoint) MOZ_OVERRIDE; michael@0: michael@0: virtual bool RecvSetFakeVolumeState(const nsString& fsName, const int32_t& fsState) MOZ_OVERRIDE; michael@0: michael@0: virtual bool RecvKeywordToURI(const nsCString& aKeyword, OptionalInputStreamParams* aPostData, michael@0: OptionalURIParams* aURI) MOZ_OVERRIDE; michael@0: michael@0: virtual void ProcessingError(Result what) MOZ_OVERRIDE; michael@0: michael@0: virtual bool RecvGetGraphicsFeatureStatus(const int32_t& aFeature, michael@0: int32_t* aStatus, michael@0: bool* aSuccess) MOZ_OVERRIDE; michael@0: michael@0: virtual bool RecvAddIdleObserver(const uint64_t& observerId, michael@0: const uint32_t& aIdleTimeInS) MOZ_OVERRIDE; michael@0: virtual bool RecvRemoveIdleObserver(const uint64_t& observerId, michael@0: const uint32_t& aIdleTimeInS) MOZ_OVERRIDE; michael@0: michael@0: virtual bool michael@0: RecvBackUpXResources(const FileDescriptor& aXSocketFd) MOZ_OVERRIDE; michael@0: michael@0: virtual PFileDescriptorSetParent* michael@0: AllocPFileDescriptorSetParent(const mozilla::ipc::FileDescriptor&) MOZ_OVERRIDE; michael@0: michael@0: virtual bool michael@0: DeallocPFileDescriptorSetParent(PFileDescriptorSetParent*) MOZ_OVERRIDE; michael@0: michael@0: // If you add strong pointers to cycle collected objects here, be sure to michael@0: // release these objects in ShutDownProcess. See the comment there for more michael@0: // details. michael@0: michael@0: GeckoChildProcessHost* mSubprocess; michael@0: michael@0: uint64_t mChildID; michael@0: int32_t mGeolocationWatchID; michael@0: michael@0: nsString mAppManifestURL; michael@0: michael@0: /** michael@0: * We cache mAppName instead of looking it up using mAppManifestURL when we michael@0: * need it because it turns out that getting an app from the apps service is michael@0: * expensive. michael@0: */ michael@0: nsString mAppName; michael@0: michael@0: nsRefPtr mMessageManager; michael@0: michael@0: // After we initiate shutdown, we also start a timer to ensure michael@0: // that even content processes that are 100% blocked (say from michael@0: // SIGSTOP), are still killed eventually. This task enforces that michael@0: // timer. michael@0: CancelableTask* mForceKillTask; michael@0: // How many tabs we're waiting to finish their destruction michael@0: // sequence. Precisely, how many TabParents have called michael@0: // NotifyTabDestroying() but not called NotifyTabDestroyed(). michael@0: int32_t mNumDestroyingTabs; michael@0: // True only while this is ready to be used to host remote tabs. michael@0: // This must not be used for new purposes after mIsAlive goes to michael@0: // false, but some previously scheduled IPC traffic may still pass michael@0: // through. michael@0: bool mIsAlive; michael@0: michael@0: bool mSendPermissionUpdates; michael@0: bool mIsForBrowser; michael@0: bool mIsNuwaProcess; michael@0: michael@0: // These variables track whether we've called Close(), CloseWithError() michael@0: // and KillHard() on our channel. michael@0: bool mCalledClose; michael@0: bool mCalledCloseWithError; michael@0: bool mCalledKillHard; michael@0: michael@0: friend class CrashReporterParent; michael@0: michael@0: nsRefPtr mConsoleService; michael@0: nsConsoleService* GetConsoleService(); michael@0: michael@0: nsDataHashtable > mIdleListeners; michael@0: michael@0: #ifdef MOZ_X11 michael@0: // Dup of child's X socket, used to scope its resources to this michael@0: // object instead of the child process's lifetime. michael@0: ScopedClose mChildXSocketFdDup; michael@0: #endif michael@0: }; michael@0: michael@0: } // namespace dom michael@0: } // namespace mozilla michael@0: michael@0: class ParentIdleListener : public nsIObserver { michael@0: public: michael@0: NS_DECL_ISUPPORTS michael@0: NS_DECL_NSIOBSERVER michael@0: michael@0: ParentIdleListener(mozilla::dom::ContentParent* aParent, uint64_t aObserver) michael@0: : mParent(aParent), mObserver(aObserver) michael@0: {} michael@0: virtual ~ParentIdleListener() {} michael@0: private: michael@0: nsRefPtr mParent; michael@0: uint64_t mObserver; michael@0: }; michael@0: michael@0: #endif