1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/dom/ipc/ContentParent.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,625 @@ 1.4 +/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ 1.5 +/* vim: set sw=4 ts=8 et tw=80 : */ 1.6 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.7 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.8 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.9 + 1.10 +#ifndef mozilla_dom_ContentParent_h 1.11 +#define mozilla_dom_ContentParent_h 1.12 + 1.13 +#include "mozilla/dom/PContentParent.h" 1.14 +#include "mozilla/ipc/GeckoChildProcessHost.h" 1.15 +#include "mozilla/dom/ipc/Blob.h" 1.16 +#include "mozilla/Attributes.h" 1.17 +#include "mozilla/FileUtils.h" 1.18 +#include "mozilla/HalTypes.h" 1.19 +#include "mozilla/LinkedList.h" 1.20 +#include "mozilla/StaticPtr.h" 1.21 + 1.22 +#include "nsDataHashtable.h" 1.23 +#include "nsFrameMessageManager.h" 1.24 +#include "nsHashKeys.h" 1.25 +#include "nsIObserver.h" 1.26 +#include "nsIThreadInternal.h" 1.27 +#include "nsIDOMGeoPositionCallback.h" 1.28 +#include "PermissionMessageUtils.h" 1.29 + 1.30 +#define CHILD_PROCESS_SHUTDOWN_MESSAGE NS_LITERAL_STRING("child-process-shutdown") 1.31 + 1.32 +class mozIApplication; 1.33 +class nsConsoleService; 1.34 +class nsIDOMBlob; 1.35 +class nsIMemoryReporter; 1.36 +class ParentIdleListener; 1.37 + 1.38 +namespace mozilla { 1.39 + 1.40 +namespace ipc { 1.41 +class OptionalURIParams; 1.42 +class URIParams; 1.43 +class TestShellParent; 1.44 +} // namespace ipc 1.45 + 1.46 +namespace jsipc { 1.47 +class JavaScriptParent; 1.48 +class PJavaScriptParent; 1.49 +} 1.50 + 1.51 +namespace layers { 1.52 +class PCompositorParent; 1.53 +} // namespace layers 1.54 + 1.55 +namespace dom { 1.56 + 1.57 +class Element; 1.58 +class TabParent; 1.59 +class PStorageParent; 1.60 +class ClonedMessageData; 1.61 +class MemoryReport; 1.62 +class TabContext; 1.63 +class PFileDescriptorSetParent; 1.64 + 1.65 +class ContentParent : public PContentParent 1.66 + , public nsIObserver 1.67 + , public nsIDOMGeoPositionCallback 1.68 + , public mozilla::dom::ipc::MessageManagerCallback 1.69 + , public mozilla::LinkedListElement<ContentParent> 1.70 +{ 1.71 + typedef mozilla::ipc::GeckoChildProcessHost GeckoChildProcessHost; 1.72 + typedef mozilla::ipc::OptionalURIParams OptionalURIParams; 1.73 + typedef mozilla::ipc::TestShellParent TestShellParent; 1.74 + typedef mozilla::ipc::URIParams URIParams; 1.75 + typedef mozilla::dom::ClonedMessageData ClonedMessageData; 1.76 + 1.77 +public: 1.78 + /** 1.79 + * Start up the content-process machinery. This might include 1.80 + * scheduling pre-launch tasks. 1.81 + */ 1.82 + static void StartUp(); 1.83 + /** Shut down the content-process machinery. */ 1.84 + static void ShutDown(); 1.85 + /** 1.86 + * Ensure that all subprocesses are terminated and their OS 1.87 + * resources have been reaped. This is synchronous and can be 1.88 + * very expensive in general. It also bypasses the normal 1.89 + * shutdown process. 1.90 + */ 1.91 + static void JoinAllSubprocesses(); 1.92 + 1.93 + static bool PreallocatedProcessReady(); 1.94 + static void RunAfterPreallocatedProcessReady(nsIRunnable* aRequest); 1.95 + 1.96 + static already_AddRefed<ContentParent> 1.97 + GetNewOrUsed(bool aForBrowserElement = false); 1.98 + 1.99 + /** 1.100 + * Create a subprocess suitable for use as a preallocated app process. 1.101 + */ 1.102 + static already_AddRefed<ContentParent> PreallocateAppProcess(); 1.103 + 1.104 + static already_AddRefed<ContentParent> RunNuwaProcess(); 1.105 + 1.106 + /** 1.107 + * Get or create a content process for the given TabContext. aFrameElement 1.108 + * should be the frame/iframe element with which this process will 1.109 + * associated. 1.110 + */ 1.111 + static TabParent* 1.112 + CreateBrowserOrApp(const TabContext& aContext, 1.113 + Element* aFrameElement); 1.114 + 1.115 + static void GetAll(nsTArray<ContentParent*>& aArray); 1.116 + static void GetAllEvenIfDead(nsTArray<ContentParent*>& aArray); 1.117 + 1.118 + NS_DECL_CYCLE_COLLECTION_CLASS_AMBIGUOUS(ContentParent, nsIObserver) 1.119 + 1.120 + NS_DECL_CYCLE_COLLECTING_ISUPPORTS 1.121 + NS_DECL_NSIOBSERVER 1.122 + NS_DECL_NSIDOMGEOPOSITIONCALLBACK 1.123 + 1.124 + /** 1.125 + * MessageManagerCallback methods that we override. 1.126 + */ 1.127 + virtual bool DoSendAsyncMessage(JSContext* aCx, 1.128 + const nsAString& aMessage, 1.129 + const mozilla::dom::StructuredCloneData& aData, 1.130 + JS::Handle<JSObject *> aCpows, 1.131 + nsIPrincipal* aPrincipal) MOZ_OVERRIDE; 1.132 + virtual bool CheckPermission(const nsAString& aPermission) MOZ_OVERRIDE; 1.133 + virtual bool CheckManifestURL(const nsAString& aManifestURL) MOZ_OVERRIDE; 1.134 + virtual bool CheckAppHasPermission(const nsAString& aPermission) MOZ_OVERRIDE; 1.135 + virtual bool CheckAppHasStatus(unsigned short aStatus) MOZ_OVERRIDE; 1.136 + 1.137 + /** Notify that a tab is beginning its destruction sequence. */ 1.138 + void NotifyTabDestroying(PBrowserParent* aTab); 1.139 + /** Notify that a tab was destroyed during normal operation. */ 1.140 + void NotifyTabDestroyed(PBrowserParent* aTab, 1.141 + bool aNotifiedDestroying); 1.142 + 1.143 + TestShellParent* CreateTestShell(); 1.144 + bool DestroyTestShell(TestShellParent* aTestShell); 1.145 + TestShellParent* GetTestShellSingleton(); 1.146 + jsipc::JavaScriptParent *GetCPOWManager(); 1.147 + 1.148 + void ReportChildAlreadyBlocked(); 1.149 + bool RequestRunToCompletion(); 1.150 + 1.151 + bool IsAlive(); 1.152 + bool IsForApp(); 1.153 +#ifdef MOZ_NUWA_PROCESS 1.154 + bool IsNuwaProcess(); 1.155 +#endif 1.156 + 1.157 + GeckoChildProcessHost* Process() { 1.158 + return mSubprocess; 1.159 + } 1.160 + 1.161 + int32_t Pid(); 1.162 + 1.163 + bool NeedsPermissionsUpdate() { 1.164 + return mSendPermissionUpdates; 1.165 + } 1.166 + 1.167 + BlobParent* GetOrCreateActorForBlob(nsIDOMBlob* aBlob); 1.168 + 1.169 + /** 1.170 + * Kill our subprocess and make sure it dies. Should only be used 1.171 + * in emergency situations since it bypasses the normal shutdown 1.172 + * process. 1.173 + */ 1.174 + void KillHard(); 1.175 + 1.176 + uint64_t ChildID() { return mChildID; } 1.177 + const nsString& AppManifestURL() const { return mAppManifestURL; } 1.178 + 1.179 + bool IsPreallocated(); 1.180 + 1.181 + /** 1.182 + * Get a user-friendly name for this ContentParent. We make no guarantees 1.183 + * about this name: It might not be unique, apps can spoof special names, 1.184 + * etc. So please don't use this name to make any decisions about the 1.185 + * ContentParent based on the value returned here. 1.186 + */ 1.187 + void FriendlyName(nsAString& aName); 1.188 + 1.189 + virtual void OnChannelError() MOZ_OVERRIDE; 1.190 + 1.191 + virtual PIndexedDBParent* AllocPIndexedDBParent() MOZ_OVERRIDE; 1.192 + virtual bool 1.193 + RecvPIndexedDBConstructor(PIndexedDBParent* aActor) MOZ_OVERRIDE; 1.194 + 1.195 + virtual PCrashReporterParent* 1.196 + AllocPCrashReporterParent(const NativeThreadId& tid, 1.197 + const uint32_t& processType) MOZ_OVERRIDE; 1.198 + virtual bool 1.199 + RecvPCrashReporterConstructor(PCrashReporterParent* actor, 1.200 + const NativeThreadId& tid, 1.201 + const uint32_t& processType) MOZ_OVERRIDE; 1.202 + 1.203 + virtual PNeckoParent* AllocPNeckoParent() MOZ_OVERRIDE; 1.204 + virtual bool RecvPNeckoConstructor(PNeckoParent* aActor) MOZ_OVERRIDE { 1.205 + return PContentParent::RecvPNeckoConstructor(aActor); 1.206 + } 1.207 + 1.208 + virtual PHalParent* AllocPHalParent() MOZ_OVERRIDE; 1.209 + virtual bool RecvPHalConstructor(PHalParent* aActor) MOZ_OVERRIDE { 1.210 + return PContentParent::RecvPHalConstructor(aActor); 1.211 + } 1.212 + 1.213 + virtual PStorageParent* AllocPStorageParent() MOZ_OVERRIDE; 1.214 + virtual bool RecvPStorageConstructor(PStorageParent* aActor) MOZ_OVERRIDE { 1.215 + return PContentParent::RecvPStorageConstructor(aActor); 1.216 + } 1.217 + 1.218 + virtual PJavaScriptParent* 1.219 + AllocPJavaScriptParent() MOZ_OVERRIDE; 1.220 + virtual bool 1.221 + RecvPJavaScriptConstructor(PJavaScriptParent* aActor) MOZ_OVERRIDE { 1.222 + return PContentParent::RecvPJavaScriptConstructor(aActor); 1.223 + } 1.224 + 1.225 + virtual bool RecvRecordingDeviceEvents(const nsString& aRecordingStatus, 1.226 + const nsString& aPageURL, 1.227 + const bool& aIsAudio, 1.228 + const bool& aIsVideo) MOZ_OVERRIDE; 1.229 +protected: 1.230 + void OnChannelConnected(int32_t pid) MOZ_OVERRIDE; 1.231 + virtual void ActorDestroy(ActorDestroyReason why) MOZ_OVERRIDE; 1.232 + void OnNuwaForkTimeout(); 1.233 + 1.234 + bool ShouldContinueFromReplyTimeout() MOZ_OVERRIDE; 1.235 + bool ShouldSandboxContentProcesses(); 1.236 + 1.237 +private: 1.238 + static nsDataHashtable<nsStringHashKey, ContentParent*> *sAppContentParents; 1.239 + static nsTArray<ContentParent*>* sNonAppContentParents; 1.240 + static nsTArray<ContentParent*>* sPrivateContent; 1.241 + static StaticAutoPtr<LinkedList<ContentParent> > sContentParents; 1.242 + 1.243 + static void JoinProcessesIOThread(const nsTArray<ContentParent*>* aProcesses, 1.244 + Monitor* aMonitor, bool* aDone); 1.245 + 1.246 + // Take the preallocated process and transform it into a "real" app process, 1.247 + // for the specified manifest URL. If there is no preallocated process (or 1.248 + // if it's dead), this returns false. 1.249 + static already_AddRefed<ContentParent> 1.250 + MaybeTakePreallocatedAppProcess(const nsAString& aAppManifestURL, 1.251 + hal::ProcessPriority aInitialPriority); 1.252 + 1.253 + static hal::ProcessPriority GetInitialProcessPriority(Element* aFrameElement); 1.254 + 1.255 + // Hide the raw constructor methods since we don't want client code 1.256 + // using them. 1.257 + using PContentParent::SendPBrowserConstructor; 1.258 + using PContentParent::SendPTestShellConstructor; 1.259 + 1.260 + // No more than one of !!aApp, aIsForBrowser, and aIsForPreallocated may be 1.261 + // true. 1.262 + ContentParent(mozIApplication* aApp, 1.263 + bool aIsForBrowser, 1.264 + bool aIsForPreallocated, 1.265 + hal::ProcessPriority aInitialPriority = hal::PROCESS_PRIORITY_FOREGROUND, 1.266 + bool aIsNuwaProcess = false); 1.267 + 1.268 +#ifdef MOZ_NUWA_PROCESS 1.269 + ContentParent(ContentParent* aTemplate, 1.270 + const nsAString& aAppManifestURL, 1.271 + base::ProcessHandle aPid, 1.272 + const nsTArray<ProtocolFdMapping>& aFds); 1.273 +#endif 1.274 + 1.275 + // The common initialization for the constructors. 1.276 + void InitializeMembers(); 1.277 + 1.278 + // The common initialization logic shared by all constuctors. 1.279 + void InitInternal(ProcessPriority aPriority, 1.280 + bool aSetupOffMainThreadCompositing, 1.281 + bool aSendRegisteredChrome); 1.282 + 1.283 + virtual ~ContentParent(); 1.284 + 1.285 + void Init(); 1.286 + 1.287 + // If the frame element indicates that the child process is "critical" and 1.288 + // has a pending system message, this function acquires the CPU wake lock on 1.289 + // behalf of the child. We'll release the lock when the system message is 1.290 + // handled or after a timeout, whichever comes first. 1.291 + void MaybeTakeCPUWakeLock(Element* aFrameElement); 1.292 + 1.293 + // Set the child process's priority and then check whether the child is 1.294 + // still alive. Returns true if the process is still alive, and false 1.295 + // otherwise. If you pass a FOREGROUND* priority here, it's (hopefully) 1.296 + // unlikely that the process will be killed after this point. 1.297 + bool SetPriorityAndCheckIsAlive(hal::ProcessPriority aPriority); 1.298 + 1.299 + // Transform a pre-allocated app process into a "real" app 1.300 + // process, for the specified manifest URL. 1.301 + void TransformPreallocatedIntoApp(const nsAString& aAppManifestURL); 1.302 + 1.303 + // Transform a pre-allocated app process into a browser process. If this 1.304 + // returns false, the child process has died. 1.305 + void TransformPreallocatedIntoBrowser(); 1.306 + 1.307 + /** 1.308 + * Mark this ContentParent as dead for the purposes of Get*(). 1.309 + * This method is idempotent. 1.310 + */ 1.311 + void MarkAsDead(); 1.312 + 1.313 + /** 1.314 + * Exit the subprocess and vamoose. After this call IsAlive() 1.315 + * will return false and this ContentParent will not be returned 1.316 + * by the Get*() funtions. However, the shutdown sequence itself 1.317 + * may be asynchronous. 1.318 + * 1.319 + * If aCloseWithError is true and this is the first call to 1.320 + * ShutDownProcess, then we'll close our channel using CloseWithError() 1.321 + * rather than vanilla Close(). CloseWithError() indicates to IPC that this 1.322 + * is an abnormal shutdown (e.g. a crash). 1.323 + */ 1.324 + void ShutDownProcess(bool aCloseWithError); 1.325 + 1.326 + PCompositorParent* 1.327 + AllocPCompositorParent(mozilla::ipc::Transport* aTransport, 1.328 + base::ProcessId aOtherProcess) MOZ_OVERRIDE; 1.329 + PImageBridgeParent* 1.330 + AllocPImageBridgeParent(mozilla::ipc::Transport* aTransport, 1.331 + base::ProcessId aOtherProcess) MOZ_OVERRIDE; 1.332 + 1.333 + PBackgroundParent* 1.334 + AllocPBackgroundParent(Transport* aTransport, ProcessId aOtherProcess) 1.335 + MOZ_OVERRIDE; 1.336 + 1.337 + virtual bool RecvGetProcessAttributes(uint64_t* aId, 1.338 + bool* aIsForApp, 1.339 + bool* aIsForBrowser) MOZ_OVERRIDE; 1.340 + virtual bool RecvGetXPCOMProcessAttributes(bool* aIsOffline) MOZ_OVERRIDE; 1.341 + 1.342 + virtual bool DeallocPJavaScriptParent(mozilla::jsipc::PJavaScriptParent*) MOZ_OVERRIDE; 1.343 + 1.344 + virtual PBrowserParent* AllocPBrowserParent(const IPCTabContext& aContext, 1.345 + const uint32_t& aChromeFlags) MOZ_OVERRIDE; 1.346 + virtual bool DeallocPBrowserParent(PBrowserParent* frame) MOZ_OVERRIDE; 1.347 + 1.348 + virtual PDeviceStorageRequestParent* 1.349 + AllocPDeviceStorageRequestParent(const DeviceStorageParams&) MOZ_OVERRIDE; 1.350 + virtual bool DeallocPDeviceStorageRequestParent(PDeviceStorageRequestParent*) MOZ_OVERRIDE; 1.351 + 1.352 + virtual PFileSystemRequestParent* 1.353 + AllocPFileSystemRequestParent(const FileSystemParams&) MOZ_OVERRIDE; 1.354 + 1.355 + virtual bool 1.356 + DeallocPFileSystemRequestParent(PFileSystemRequestParent*) MOZ_OVERRIDE; 1.357 + 1.358 + virtual PBlobParent* AllocPBlobParent(const BlobConstructorParams& aParams) MOZ_OVERRIDE; 1.359 + virtual bool DeallocPBlobParent(PBlobParent*) MOZ_OVERRIDE; 1.360 + 1.361 + virtual bool DeallocPCrashReporterParent(PCrashReporterParent* crashreporter) MOZ_OVERRIDE; 1.362 + 1.363 + virtual bool RecvGetRandomValues(const uint32_t& length, 1.364 + InfallibleTArray<uint8_t>* randomValues) MOZ_OVERRIDE; 1.365 + 1.366 + virtual bool DeallocPHalParent(PHalParent*) MOZ_OVERRIDE; 1.367 + 1.368 + virtual bool DeallocPIndexedDBParent(PIndexedDBParent* aActor) MOZ_OVERRIDE; 1.369 + 1.370 + virtual PMemoryReportRequestParent* 1.371 + AllocPMemoryReportRequestParent(const uint32_t& generation, 1.372 + const bool &minimizeMemoryUsage, 1.373 + const nsString &aDMDDumpIdent) MOZ_OVERRIDE; 1.374 + virtual bool DeallocPMemoryReportRequestParent(PMemoryReportRequestParent* actor) MOZ_OVERRIDE; 1.375 + 1.376 + virtual PTestShellParent* AllocPTestShellParent() MOZ_OVERRIDE; 1.377 + virtual bool DeallocPTestShellParent(PTestShellParent* shell) MOZ_OVERRIDE; 1.378 + 1.379 + virtual bool DeallocPNeckoParent(PNeckoParent* necko) MOZ_OVERRIDE; 1.380 + 1.381 + virtual PExternalHelperAppParent* AllocPExternalHelperAppParent( 1.382 + const OptionalURIParams& aUri, 1.383 + const nsCString& aMimeContentType, 1.384 + const nsCString& aContentDisposition, 1.385 + const uint32_t& aContentDispositionHint, 1.386 + const nsString& aContentDispositionFilename, 1.387 + const bool& aForceSave, 1.388 + const int64_t& aContentLength, 1.389 + const OptionalURIParams& aReferrer, 1.390 + PBrowserParent* aBrowser) MOZ_OVERRIDE; 1.391 + virtual bool DeallocPExternalHelperAppParent(PExternalHelperAppParent* aService) MOZ_OVERRIDE; 1.392 + 1.393 + virtual PSmsParent* AllocPSmsParent() MOZ_OVERRIDE; 1.394 + virtual bool DeallocPSmsParent(PSmsParent*) MOZ_OVERRIDE; 1.395 + 1.396 + virtual PTelephonyParent* AllocPTelephonyParent() MOZ_OVERRIDE; 1.397 + virtual bool DeallocPTelephonyParent(PTelephonyParent*) MOZ_OVERRIDE; 1.398 + 1.399 + virtual bool DeallocPStorageParent(PStorageParent* aActor) MOZ_OVERRIDE; 1.400 + 1.401 + virtual PBluetoothParent* AllocPBluetoothParent() MOZ_OVERRIDE; 1.402 + virtual bool DeallocPBluetoothParent(PBluetoothParent* aActor) MOZ_OVERRIDE; 1.403 + virtual bool RecvPBluetoothConstructor(PBluetoothParent* aActor) MOZ_OVERRIDE; 1.404 + 1.405 + virtual PFMRadioParent* AllocPFMRadioParent() MOZ_OVERRIDE; 1.406 + virtual bool DeallocPFMRadioParent(PFMRadioParent* aActor) MOZ_OVERRIDE; 1.407 + 1.408 + virtual PAsmJSCacheEntryParent* AllocPAsmJSCacheEntryParent( 1.409 + const asmjscache::OpenMode& aOpenMode, 1.410 + const asmjscache::WriteParams& aWriteParams, 1.411 + const IPC::Principal& aPrincipal) MOZ_OVERRIDE; 1.412 + virtual bool DeallocPAsmJSCacheEntryParent( 1.413 + PAsmJSCacheEntryParent* aActor) MOZ_OVERRIDE; 1.414 + 1.415 + virtual PSpeechSynthesisParent* AllocPSpeechSynthesisParent() MOZ_OVERRIDE; 1.416 + virtual bool DeallocPSpeechSynthesisParent(PSpeechSynthesisParent* aActor) MOZ_OVERRIDE; 1.417 + virtual bool RecvPSpeechSynthesisConstructor(PSpeechSynthesisParent* aActor) MOZ_OVERRIDE; 1.418 + 1.419 + virtual bool RecvReadPrefsArray(InfallibleTArray<PrefSetting>* aPrefs) MOZ_OVERRIDE; 1.420 + virtual bool RecvReadFontList(InfallibleTArray<FontListEntry>* retValue) MOZ_OVERRIDE; 1.421 + 1.422 + virtual bool RecvReadPermissions(InfallibleTArray<IPC::Permission>* aPermissions) MOZ_OVERRIDE; 1.423 + 1.424 + virtual bool RecvSetClipboardText(const nsString& text, 1.425 + const bool& isPrivateData, 1.426 + const int32_t& whichClipboard) MOZ_OVERRIDE; 1.427 + virtual bool RecvGetClipboardText(const int32_t& whichClipboard, nsString* text) MOZ_OVERRIDE; 1.428 + virtual bool RecvEmptyClipboard(const int32_t& whichClipboard) MOZ_OVERRIDE; 1.429 + virtual bool RecvClipboardHasText(const int32_t& whichClipboard, bool* hasText) MOZ_OVERRIDE; 1.430 + 1.431 + virtual bool RecvGetSystemColors(const uint32_t& colorsCount, 1.432 + InfallibleTArray<uint32_t>* colors) MOZ_OVERRIDE; 1.433 + virtual bool RecvGetIconForExtension(const nsCString& aFileExt, 1.434 + const uint32_t& aIconSize, 1.435 + InfallibleTArray<uint8_t>* bits) MOZ_OVERRIDE; 1.436 + virtual bool RecvGetShowPasswordSetting(bool* showPassword) MOZ_OVERRIDE; 1.437 + 1.438 + virtual bool RecvStartVisitedQuery(const URIParams& uri) MOZ_OVERRIDE; 1.439 + 1.440 + virtual bool RecvVisitURI(const URIParams& uri, 1.441 + const OptionalURIParams& referrer, 1.442 + const uint32_t& flags) MOZ_OVERRIDE; 1.443 + 1.444 + virtual bool RecvSetURITitle(const URIParams& uri, 1.445 + const nsString& title) MOZ_OVERRIDE; 1.446 + 1.447 + virtual bool RecvShowAlertNotification(const nsString& aImageUrl, const nsString& aTitle, 1.448 + const nsString& aText, const bool& aTextClickable, 1.449 + const nsString& aCookie, const nsString& aName, 1.450 + const nsString& aBidi, const nsString& aLang, 1.451 + const IPC::Principal& aPrincipal) MOZ_OVERRIDE; 1.452 + 1.453 + virtual bool RecvCloseAlert(const nsString& aName, 1.454 + const IPC::Principal& aPrincipal) MOZ_OVERRIDE; 1.455 + 1.456 + virtual bool RecvLoadURIExternal(const URIParams& uri) MOZ_OVERRIDE; 1.457 + 1.458 + virtual bool RecvSyncMessage(const nsString& aMsg, 1.459 + const ClonedMessageData& aData, 1.460 + const InfallibleTArray<CpowEntry>& aCpows, 1.461 + const IPC::Principal& aPrincipal, 1.462 + InfallibleTArray<nsString>* aRetvals) MOZ_OVERRIDE; 1.463 + virtual bool AnswerRpcMessage(const nsString& aMsg, 1.464 + const ClonedMessageData& aData, 1.465 + const InfallibleTArray<CpowEntry>& aCpows, 1.466 + const IPC::Principal& aPrincipal, 1.467 + InfallibleTArray<nsString>* aRetvals) MOZ_OVERRIDE; 1.468 + virtual bool RecvAsyncMessage(const nsString& aMsg, 1.469 + const ClonedMessageData& aData, 1.470 + const InfallibleTArray<CpowEntry>& aCpows, 1.471 + const IPC::Principal& aPrincipal) MOZ_OVERRIDE; 1.472 + 1.473 + virtual bool RecvFilePathUpdateNotify(const nsString& aType, 1.474 + const nsString& aStorageName, 1.475 + const nsString& aFilePath, 1.476 + const nsCString& aReason) MOZ_OVERRIDE; 1.477 + 1.478 + virtual bool RecvAddGeolocationListener(const IPC::Principal& aPrincipal, 1.479 + const bool& aHighAccuracy) MOZ_OVERRIDE; 1.480 + virtual bool RecvRemoveGeolocationListener() MOZ_OVERRIDE; 1.481 + virtual bool RecvSetGeolocationHigherAccuracy(const bool& aEnable) MOZ_OVERRIDE; 1.482 + 1.483 + virtual bool RecvConsoleMessage(const nsString& aMessage) MOZ_OVERRIDE; 1.484 + virtual bool RecvScriptError(const nsString& aMessage, 1.485 + const nsString& aSourceName, 1.486 + const nsString& aSourceLine, 1.487 + const uint32_t& aLineNumber, 1.488 + const uint32_t& aColNumber, 1.489 + const uint32_t& aFlags, 1.490 + const nsCString& aCategory) MOZ_OVERRIDE; 1.491 + 1.492 + virtual bool RecvPrivateDocShellsExist(const bool& aExist) MOZ_OVERRIDE; 1.493 + 1.494 + virtual bool RecvFirstIdle() MOZ_OVERRIDE; 1.495 + 1.496 + virtual bool RecvAudioChannelGetState(const AudioChannel& aChannel, 1.497 + const bool& aElementHidden, 1.498 + const bool& aElementWasHidden, 1.499 + AudioChannelState* aValue) MOZ_OVERRIDE; 1.500 + 1.501 + virtual bool RecvAudioChannelRegisterType(const AudioChannel& aChannel, 1.502 + const bool& aWithVideo) MOZ_OVERRIDE; 1.503 + virtual bool RecvAudioChannelUnregisterType(const AudioChannel& aChannel, 1.504 + const bool& aElementHidden, 1.505 + const bool& aWithVideo) MOZ_OVERRIDE; 1.506 + 1.507 + virtual bool RecvAudioChannelChangedNotification() MOZ_OVERRIDE; 1.508 + 1.509 + virtual bool RecvAudioChannelChangeDefVolChannel(const int32_t& aChannel, 1.510 + const bool& aHidden) MOZ_OVERRIDE; 1.511 + 1.512 + virtual bool RecvBroadcastVolume(const nsString& aVolumeName) MOZ_OVERRIDE; 1.513 + 1.514 + virtual bool RecvSpeakerManagerGetSpeakerStatus(bool* aValue) MOZ_OVERRIDE; 1.515 + 1.516 + virtual bool RecvSpeakerManagerForceSpeaker(const bool& aEnable) MOZ_OVERRIDE; 1.517 + 1.518 + virtual bool RecvSystemMessageHandled() MOZ_OVERRIDE; 1.519 + 1.520 + virtual bool RecvNuwaReady() MOZ_OVERRIDE; 1.521 + 1.522 + virtual bool RecvAddNewProcess(const uint32_t& aPid, 1.523 + const InfallibleTArray<ProtocolFdMapping>& aFds) MOZ_OVERRIDE; 1.524 + 1.525 + virtual bool RecvCreateFakeVolume(const nsString& fsName, const nsString& mountPoint) MOZ_OVERRIDE; 1.526 + 1.527 + virtual bool RecvSetFakeVolumeState(const nsString& fsName, const int32_t& fsState) MOZ_OVERRIDE; 1.528 + 1.529 + virtual bool RecvKeywordToURI(const nsCString& aKeyword, OptionalInputStreamParams* aPostData, 1.530 + OptionalURIParams* aURI) MOZ_OVERRIDE; 1.531 + 1.532 + virtual void ProcessingError(Result what) MOZ_OVERRIDE; 1.533 + 1.534 + virtual bool RecvGetGraphicsFeatureStatus(const int32_t& aFeature, 1.535 + int32_t* aStatus, 1.536 + bool* aSuccess) MOZ_OVERRIDE; 1.537 + 1.538 + virtual bool RecvAddIdleObserver(const uint64_t& observerId, 1.539 + const uint32_t& aIdleTimeInS) MOZ_OVERRIDE; 1.540 + virtual bool RecvRemoveIdleObserver(const uint64_t& observerId, 1.541 + const uint32_t& aIdleTimeInS) MOZ_OVERRIDE; 1.542 + 1.543 + virtual bool 1.544 + RecvBackUpXResources(const FileDescriptor& aXSocketFd) MOZ_OVERRIDE; 1.545 + 1.546 + virtual PFileDescriptorSetParent* 1.547 + AllocPFileDescriptorSetParent(const mozilla::ipc::FileDescriptor&) MOZ_OVERRIDE; 1.548 + 1.549 + virtual bool 1.550 + DeallocPFileDescriptorSetParent(PFileDescriptorSetParent*) MOZ_OVERRIDE; 1.551 + 1.552 + // If you add strong pointers to cycle collected objects here, be sure to 1.553 + // release these objects in ShutDownProcess. See the comment there for more 1.554 + // details. 1.555 + 1.556 + GeckoChildProcessHost* mSubprocess; 1.557 + 1.558 + uint64_t mChildID; 1.559 + int32_t mGeolocationWatchID; 1.560 + 1.561 + nsString mAppManifestURL; 1.562 + 1.563 + /** 1.564 + * We cache mAppName instead of looking it up using mAppManifestURL when we 1.565 + * need it because it turns out that getting an app from the apps service is 1.566 + * expensive. 1.567 + */ 1.568 + nsString mAppName; 1.569 + 1.570 + nsRefPtr<nsFrameMessageManager> mMessageManager; 1.571 + 1.572 + // After we initiate shutdown, we also start a timer to ensure 1.573 + // that even content processes that are 100% blocked (say from 1.574 + // SIGSTOP), are still killed eventually. This task enforces that 1.575 + // timer. 1.576 + CancelableTask* mForceKillTask; 1.577 + // How many tabs we're waiting to finish their destruction 1.578 + // sequence. Precisely, how many TabParents have called 1.579 + // NotifyTabDestroying() but not called NotifyTabDestroyed(). 1.580 + int32_t mNumDestroyingTabs; 1.581 + // True only while this is ready to be used to host remote tabs. 1.582 + // This must not be used for new purposes after mIsAlive goes to 1.583 + // false, but some previously scheduled IPC traffic may still pass 1.584 + // through. 1.585 + bool mIsAlive; 1.586 + 1.587 + bool mSendPermissionUpdates; 1.588 + bool mIsForBrowser; 1.589 + bool mIsNuwaProcess; 1.590 + 1.591 + // These variables track whether we've called Close(), CloseWithError() 1.592 + // and KillHard() on our channel. 1.593 + bool mCalledClose; 1.594 + bool mCalledCloseWithError; 1.595 + bool mCalledKillHard; 1.596 + 1.597 + friend class CrashReporterParent; 1.598 + 1.599 + nsRefPtr<nsConsoleService> mConsoleService; 1.600 + nsConsoleService* GetConsoleService(); 1.601 + 1.602 + nsDataHashtable<nsUint64HashKey, nsRefPtr<ParentIdleListener> > mIdleListeners; 1.603 + 1.604 +#ifdef MOZ_X11 1.605 + // Dup of child's X socket, used to scope its resources to this 1.606 + // object instead of the child process's lifetime. 1.607 + ScopedClose mChildXSocketFdDup; 1.608 +#endif 1.609 +}; 1.610 + 1.611 +} // namespace dom 1.612 +} // namespace mozilla 1.613 + 1.614 +class ParentIdleListener : public nsIObserver { 1.615 +public: 1.616 + NS_DECL_ISUPPORTS 1.617 + NS_DECL_NSIOBSERVER 1.618 + 1.619 + ParentIdleListener(mozilla::dom::ContentParent* aParent, uint64_t aObserver) 1.620 + : mParent(aParent), mObserver(aObserver) 1.621 + {} 1.622 + virtual ~ParentIdleListener() {} 1.623 +private: 1.624 + nsRefPtr<mozilla::dom::ContentParent> mParent; 1.625 + uint64_t mObserver; 1.626 +}; 1.627 + 1.628 +#endif