dom/ipc/ContentParent.h

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

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

mercurial