2009-08-18 12:05:15 -07:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
|
|
|
/* vim: set sw=4 ts=8 et tw=80 : */
|
2012-05-21 04:12:37 -07:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
2009-08-12 09:18:08 -07:00
|
|
|
|
2010-07-19 11:33:33 -07:00
|
|
|
#ifndef mozilla_dom_ContentParent_h
|
|
|
|
#define mozilla_dom_ContentParent_h
|
2009-08-12 09:18:08 -07:00
|
|
|
|
2010-07-19 11:33:33 -07:00
|
|
|
#include "mozilla/dom/PContentParent.h"
|
2009-08-12 09:18:08 -07:00
|
|
|
#include "mozilla/ipc/GeckoChildProcessHost.h"
|
2012-08-01 23:02:29 -07:00
|
|
|
#include "mozilla/dom/ipc/Blob.h"
|
2012-08-03 12:35:58 -07:00
|
|
|
#include "mozilla/Attributes.h"
|
2013-02-14 12:41:29 -08:00
|
|
|
#include "mozilla/HalTypes.h"
|
2013-04-25 17:53:26 -07:00
|
|
|
#include "mozilla/LinkedList.h"
|
2013-07-17 14:31:10 -07:00
|
|
|
#include "mozilla/StaticPtr.h"
|
2009-08-12 09:18:08 -07:00
|
|
|
|
2012-09-27 22:43:12 -07:00
|
|
|
#include "nsFrameMessageManager.h"
|
2009-09-02 17:18:27 -07:00
|
|
|
#include "nsIObserver.h"
|
2010-02-01 17:53:52 -08:00
|
|
|
#include "nsIThreadInternal.h"
|
2010-09-20 21:16:37 -07:00
|
|
|
#include "nsIDOMGeoPositionCallback.h"
|
2013-01-02 13:21:37 -08:00
|
|
|
#include "PermissionMessageUtils.h"
|
2009-09-02 17:18:27 -07:00
|
|
|
|
2012-09-27 22:43:24 -07:00
|
|
|
#define CHILD_PROCESS_SHUTDOWN_MESSAGE NS_LITERAL_STRING("child-process-shutdown")
|
|
|
|
|
2012-08-08 19:58:06 -07:00
|
|
|
class mozIApplication;
|
2012-11-09 09:52:09 -08:00
|
|
|
class nsConsoleService;
|
2012-08-01 23:02:29 -07:00
|
|
|
class nsIDOMBlob;
|
2013-01-15 21:29:48 -08:00
|
|
|
class nsIMemoryReporter;
|
2013-09-23 14:30:40 -07:00
|
|
|
template<class KeyClass,class DataType> class nsDataHashtable;
|
2012-08-01 23:02:29 -07:00
|
|
|
|
2009-08-12 09:18:08 -07:00
|
|
|
namespace mozilla {
|
2009-09-09 15:00:14 -07:00
|
|
|
|
2009-08-12 11:31:48 -07:00
|
|
|
namespace ipc {
|
2012-08-23 12:33:46 -07:00
|
|
|
class OptionalURIParams;
|
|
|
|
class URIParams;
|
2009-08-12 11:31:48 -07:00
|
|
|
class TestShellParent;
|
2012-08-23 12:33:46 -07:00
|
|
|
} // namespace ipc
|
2009-08-12 11:31:48 -07:00
|
|
|
|
2013-07-03 00:24:32 -07:00
|
|
|
namespace jsipc {
|
|
|
|
class JavaScriptParent;
|
2013-06-03 03:14:37 -07:00
|
|
|
class PJavaScriptParent;
|
2013-07-03 00:24:32 -07:00
|
|
|
}
|
|
|
|
|
2012-07-17 16:59:45 -07:00
|
|
|
namespace layers {
|
|
|
|
class PCompositorParent;
|
2012-08-23 12:33:46 -07:00
|
|
|
} // namespace layers
|
2012-07-17 16:59:45 -07:00
|
|
|
|
2009-08-12 09:18:08 -07:00
|
|
|
namespace dom {
|
|
|
|
|
2013-08-20 12:45:30 -07:00
|
|
|
class Element;
|
2009-08-12 09:18:08 -07:00
|
|
|
class TabParent;
|
2010-11-18 17:15:23 -08:00
|
|
|
class PStorageParent;
|
2012-08-01 23:02:29 -07:00
|
|
|
class ClonedMessageData;
|
2013-09-23 14:30:40 -07:00
|
|
|
class MemoryReport;
|
|
|
|
class TabContext;
|
2009-08-12 09:18:08 -07:00
|
|
|
|
2010-07-19 11:33:33 -07:00
|
|
|
class ContentParent : public PContentParent
|
|
|
|
, public nsIObserver
|
|
|
|
, public nsIThreadObserver
|
2010-09-20 21:16:37 -07:00
|
|
|
, public nsIDOMGeoPositionCallback
|
2012-09-27 22:43:12 -07:00
|
|
|
, public mozilla::dom::ipc::MessageManagerCallback
|
2013-04-25 17:53:26 -07:00
|
|
|
, public mozilla::LinkedListElement<ContentParent>
|
2009-08-12 09:18:08 -07:00
|
|
|
{
|
|
|
|
typedef mozilla::ipc::GeckoChildProcessHost GeckoChildProcessHost;
|
2012-08-23 12:33:46 -07:00
|
|
|
typedef mozilla::ipc::OptionalURIParams OptionalURIParams;
|
2009-11-11 00:34:08 -08:00
|
|
|
typedef mozilla::ipc::TestShellParent TestShellParent;
|
2012-08-23 12:33:46 -07:00
|
|
|
typedef mozilla::ipc::URIParams URIParams;
|
2012-08-01 23:02:29 -07:00
|
|
|
typedef mozilla::dom::ClonedMessageData ClonedMessageData;
|
2009-08-12 09:18:08 -07:00
|
|
|
|
|
|
|
public:
|
2012-08-15 18:46:03 -07:00
|
|
|
/**
|
|
|
|
* Start up the content-process machinery. This might include
|
|
|
|
* scheduling pre-launch tasks.
|
|
|
|
*/
|
|
|
|
static void StartUp();
|
|
|
|
/** Shut down the content-process machinery. */
|
|
|
|
static void ShutDown();
|
2012-12-28 01:45:16 -08:00
|
|
|
/**
|
|
|
|
* Ensure that all subprocesses are terminated and their OS
|
|
|
|
* resources have been reaped. This is synchronous and can be
|
|
|
|
* very expensive in general. It also bypasses the normal
|
|
|
|
* shutdown process.
|
|
|
|
*/
|
|
|
|
static void JoinAllSubprocesses();
|
2012-08-15 18:46:03 -07:00
|
|
|
|
2013-04-02 16:52:51 -07:00
|
|
|
static already_AddRefed<ContentParent>
|
|
|
|
GetNewOrUsed(bool aForBrowserElement = false);
|
2012-07-13 14:10:20 -07:00
|
|
|
|
2013-04-25 17:53:26 -07:00
|
|
|
/**
|
|
|
|
* Create a subprocess suitable for use as a preallocated app process.
|
|
|
|
*/
|
|
|
|
static already_AddRefed<ContentParent> PreallocateAppProcess();
|
|
|
|
|
2013-06-03 03:14:40 -07:00
|
|
|
static void RunNuwaProcess();
|
|
|
|
|
2012-07-13 14:10:20 -07:00
|
|
|
/**
|
2013-02-14 12:41:30 -08:00
|
|
|
* Get or create a content process for the given TabContext. aFrameElement
|
|
|
|
* should be the frame/iframe element with which this process will
|
|
|
|
* associated.
|
2012-07-13 14:10:20 -07:00
|
|
|
*/
|
2013-02-14 12:41:30 -08:00
|
|
|
static TabParent*
|
|
|
|
CreateBrowserOrApp(const TabContext& aContext,
|
2013-07-23 16:39:17 -07:00
|
|
|
Element* aFrameElement);
|
2012-08-08 19:58:06 -07:00
|
|
|
|
2011-08-02 12:35:42 -07:00
|
|
|
static void GetAll(nsTArray<ContentParent*>& aArray);
|
2013-07-17 14:31:10 -07:00
|
|
|
static void GetAllEvenIfDead(nsTArray<ContentParent*>& aArray);
|
2009-08-12 09:18:08 -07:00
|
|
|
|
2013-07-18 19:21:20 -07:00
|
|
|
NS_DECL_THREADSAFE_ISUPPORTS
|
2009-09-02 17:18:27 -07:00
|
|
|
NS_DECL_NSIOBSERVER
|
2010-02-01 17:53:52 -08:00
|
|
|
NS_DECL_NSITHREADOBSERVER
|
2010-09-20 21:16:37 -07:00
|
|
|
NS_DECL_NSIDOMGEOPOSITIONCALLBACK
|
2009-09-02 17:18:27 -07:00
|
|
|
|
2012-09-27 22:43:12 -07:00
|
|
|
/**
|
|
|
|
* MessageManagerCallback methods that we override.
|
|
|
|
*/
|
2013-07-10 15:05:39 -07:00
|
|
|
virtual bool DoSendAsyncMessage(JSContext* aCx,
|
|
|
|
const nsAString& aMessage,
|
|
|
|
const mozilla::dom::StructuredCloneData& aData,
|
|
|
|
JS::Handle<JSObject *> aCpows) MOZ_OVERRIDE;
|
2013-06-05 09:15:48 -07:00
|
|
|
virtual bool CheckPermission(const nsAString& aPermission) MOZ_OVERRIDE;
|
|
|
|
virtual bool CheckManifestURL(const nsAString& aManifestURL) MOZ_OVERRIDE;
|
|
|
|
virtual bool CheckAppHasPermission(const nsAString& aPermission) MOZ_OVERRIDE;
|
2013-06-29 03:52:16 -07:00
|
|
|
virtual bool CheckAppHasStatus(unsigned short aStatus) MOZ_OVERRIDE;
|
2012-09-27 22:43:12 -07:00
|
|
|
|
2013-01-10 05:22:14 -08:00
|
|
|
/** Notify that a tab is beginning its destruction sequence. */
|
|
|
|
void NotifyTabDestroying(PBrowserParent* aTab);
|
2012-07-17 11:27:27 -07:00
|
|
|
/** Notify that a tab was destroyed during normal operation. */
|
2013-01-10 05:22:14 -08:00
|
|
|
void NotifyTabDestroyed(PBrowserParent* aTab,
|
|
|
|
bool aNotifiedDestroying);
|
2009-11-11 00:34:08 -08:00
|
|
|
|
|
|
|
TestShellParent* CreateTestShell();
|
|
|
|
bool DestroyTestShell(TestShellParent* aTestShell);
|
2011-06-23 16:31:58 -07:00
|
|
|
TestShellParent* GetTestShellSingleton();
|
2013-07-03 00:24:32 -07:00
|
|
|
jsipc::JavaScriptParent *GetCPOWManager();
|
2009-08-12 09:18:08 -07:00
|
|
|
|
2010-03-29 13:29:45 -07:00
|
|
|
void ReportChildAlreadyBlocked();
|
2010-02-01 17:53:52 -08:00
|
|
|
bool RequestRunToCompletion();
|
|
|
|
|
2010-04-11 17:24:45 -07:00
|
|
|
bool IsAlive();
|
2012-07-17 11:27:27 -07:00
|
|
|
bool IsForApp();
|
2010-04-11 17:24:45 -07:00
|
|
|
|
2013-08-27 16:24:51 -07:00
|
|
|
void SetChildMemoryReports(const InfallibleTArray<MemoryReport>&
|
|
|
|
childReports);
|
|
|
|
void UnregisterChildMemoryReporter();
|
2011-02-16 10:43:23 -08:00
|
|
|
|
2011-06-08 12:56:31 -07:00
|
|
|
GeckoChildProcessHost* Process() {
|
|
|
|
return mSubprocess;
|
|
|
|
}
|
|
|
|
|
2013-07-17 14:31:10 -07:00
|
|
|
int32_t Pid();
|
2013-04-25 17:53:26 -07:00
|
|
|
|
2011-08-02 12:35:42 -07:00
|
|
|
bool NeedsPermissionsUpdate() {
|
|
|
|
return mSendPermissionUpdates;
|
|
|
|
}
|
|
|
|
|
2012-08-01 23:02:29 -07:00
|
|
|
BlobParent* GetOrCreateActorForBlob(nsIDOMBlob* aBlob);
|
2013-01-17 12:17:33 -08:00
|
|
|
|
2012-09-05 15:18:48 -07:00
|
|
|
/**
|
|
|
|
* Kill our subprocess and make sure it dies. Should only be used
|
|
|
|
* in emergency situations since it bypasses the normal shutdown
|
|
|
|
* process.
|
|
|
|
*/
|
|
|
|
void KillHard();
|
|
|
|
|
2012-12-28 09:57:35 -08:00
|
|
|
uint64_t ChildID() { return mChildID; }
|
2013-04-25 17:53:26 -07:00
|
|
|
bool IsPreallocated();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get a user-friendly name for this ContentParent. We make no guarantees
|
|
|
|
* about this name: It might not be unique, apps can spoof special names,
|
|
|
|
* etc. So please don't use this name to make any decisions about the
|
|
|
|
* ContentParent based on the value returned here.
|
|
|
|
*/
|
|
|
|
void FriendlyName(nsAString& aName);
|
2012-12-28 09:57:35 -08:00
|
|
|
|
2013-06-03 03:14:40 -07:00
|
|
|
virtual void OnChannelError() MOZ_OVERRIDE;
|
|
|
|
|
2013-06-03 03:14:37 -07:00
|
|
|
virtual PIndexedDBParent* AllocPIndexedDBParent() MOZ_OVERRIDE;
|
|
|
|
virtual bool
|
|
|
|
RecvPIndexedDBConstructor(PIndexedDBParent* aActor) MOZ_OVERRIDE;
|
|
|
|
|
|
|
|
virtual PCrashReporterParent*
|
|
|
|
AllocPCrashReporterParent(const NativeThreadId& tid,
|
|
|
|
const uint32_t& processType) MOZ_OVERRIDE;
|
|
|
|
virtual bool
|
|
|
|
RecvPCrashReporterConstructor(PCrashReporterParent* actor,
|
|
|
|
const NativeThreadId& tid,
|
|
|
|
const uint32_t& processType) MOZ_OVERRIDE;
|
|
|
|
|
|
|
|
virtual PNeckoParent* AllocPNeckoParent() MOZ_OVERRIDE;
|
|
|
|
virtual bool RecvPNeckoConstructor(PNeckoParent* aActor) MOZ_OVERRIDE {
|
|
|
|
return PContentParent::RecvPNeckoConstructor(aActor);
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual PHalParent* AllocPHalParent() MOZ_OVERRIDE;
|
|
|
|
virtual bool RecvPHalConstructor(PHalParent* aActor) MOZ_OVERRIDE {
|
|
|
|
return PContentParent::RecvPHalConstructor(aActor);
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual PStorageParent* AllocPStorageParent() MOZ_OVERRIDE;
|
|
|
|
virtual bool RecvPStorageConstructor(PStorageParent* aActor) MOZ_OVERRIDE {
|
|
|
|
return PContentParent::RecvPStorageConstructor(aActor);
|
|
|
|
}
|
2013-06-03 03:14:40 -07:00
|
|
|
|
2013-06-03 03:14:37 -07:00
|
|
|
virtual PJavaScriptParent*
|
|
|
|
AllocPJavaScriptParent() MOZ_OVERRIDE;
|
|
|
|
virtual bool
|
|
|
|
RecvPJavaScriptConstructor(PJavaScriptParent* aActor) MOZ_OVERRIDE {
|
|
|
|
return PContentParent::RecvPJavaScriptConstructor(aActor);
|
|
|
|
}
|
|
|
|
|
2013-06-03 03:14:40 -07:00
|
|
|
virtual bool SendNuwaFork();
|
|
|
|
|
2010-02-01 17:53:52 -08:00
|
|
|
protected:
|
2013-06-05 09:15:48 -07:00
|
|
|
void OnChannelConnected(int32_t pid) MOZ_OVERRIDE;
|
2010-02-01 17:53:52 -08:00
|
|
|
virtual void ActorDestroy(ActorDestroyReason why);
|
2013-06-03 03:14:40 -07:00
|
|
|
void OnNuwaForkTimeout();
|
2010-02-01 17:53:52 -08:00
|
|
|
|
2013-08-26 21:56:57 -07:00
|
|
|
bool ShouldContinueFromReplyTimeout() MOZ_OVERRIDE;
|
|
|
|
|
2009-08-12 09:18:08 -07:00
|
|
|
private:
|
2013-04-25 17:53:26 -07:00
|
|
|
static nsDataHashtable<nsStringHashKey, ContentParent*> *sAppContentParents;
|
|
|
|
static nsTArray<ContentParent*>* sNonAppContentParents;
|
|
|
|
static nsTArray<ContentParent*>* sPrivateContent;
|
2013-07-17 14:31:10 -07:00
|
|
|
static StaticAutoPtr<LinkedList<ContentParent> > sContentParents;
|
2009-08-12 09:18:08 -07:00
|
|
|
|
2012-12-28 01:45:16 -08:00
|
|
|
static void JoinProcessesIOThread(const nsTArray<ContentParent*>* aProcesses,
|
|
|
|
Monitor* aMonitor, bool* aDone);
|
|
|
|
|
2013-02-08 06:32:23 -08:00
|
|
|
// Take the preallocated process and transform it into a "real" app process,
|
|
|
|
// for the specified manifest URL. If there is no preallocated process (or
|
|
|
|
// if it's dead), this returns false.
|
|
|
|
static already_AddRefed<ContentParent>
|
|
|
|
MaybeTakePreallocatedAppProcess(const nsAString& aAppManifestURL,
|
2013-02-14 12:41:30 -08:00
|
|
|
ChildPrivileges aPrivs,
|
|
|
|
hal::ProcessPriority aInitialPriority);
|
|
|
|
|
2013-07-23 16:39:17 -07:00
|
|
|
static hal::ProcessPriority GetInitialProcessPriority(Element* aFrameElement);
|
2013-02-08 06:32:23 -08:00
|
|
|
|
2009-08-12 11:31:48 -07:00
|
|
|
// Hide the raw constructor methods since we don't want client code
|
|
|
|
// using them.
|
2010-07-19 11:33:33 -07:00
|
|
|
using PContentParent::SendPBrowserConstructor;
|
|
|
|
using PContentParent::SendPTestShellConstructor;
|
2009-08-12 09:18:08 -07:00
|
|
|
|
2013-04-25 17:53:26 -07:00
|
|
|
// No more than one of !!aApp, aIsForBrowser, and aIsForPreallocated may be
|
|
|
|
// true.
|
|
|
|
ContentParent(mozIApplication* aApp,
|
|
|
|
bool aIsForBrowser,
|
|
|
|
bool aIsForPreallocated,
|
2013-02-14 12:41:30 -08:00
|
|
|
ChildPrivileges aOSPrivileges = base::PRIVILEGES_DEFAULT,
|
2013-06-03 03:14:40 -07:00
|
|
|
hal::ProcessPriority aInitialPriority = hal::PROCESS_PRIORITY_FOREGROUND,
|
|
|
|
bool aIsNuwaProcess = false);
|
|
|
|
|
|
|
|
#ifdef MOZ_NUWA_PROCESS
|
|
|
|
ContentParent(ContentParent* aTemplate,
|
|
|
|
const nsAString& aAppManifestURL,
|
|
|
|
base::ProcessHandle aPid,
|
|
|
|
const nsTArray<ProtocolFdMapping>& aFds,
|
|
|
|
ChildPrivileges aOSPrivileges = base::PRIVILEGES_DEFAULT);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
// The common initialization for the constructors.
|
|
|
|
void InitializeMembers();
|
2013-04-25 17:53:26 -07:00
|
|
|
|
2010-07-19 11:33:33 -07:00
|
|
|
virtual ~ContentParent();
|
2009-08-12 09:18:08 -07:00
|
|
|
|
2010-12-26 12:03:52 -08:00
|
|
|
void Init();
|
|
|
|
|
2013-02-14 12:41:30 -08:00
|
|
|
// If the frame element indicates that the child process is "critical" and
|
|
|
|
// has a pending system message, this function acquires the CPU wake lock on
|
|
|
|
// behalf of the child. We'll release the lock when the system message is
|
|
|
|
// handled or after a timeout, whichever comes first.
|
2013-07-23 16:39:17 -07:00
|
|
|
void MaybeTakeCPUWakeLock(Element* aFrameElement);
|
2013-02-14 12:41:30 -08:00
|
|
|
|
2013-02-14 12:41:30 -08:00
|
|
|
// Set the child process's priority and then check whether the child is
|
|
|
|
// still alive. Returns true if the process is still alive, and false
|
|
|
|
// otherwise. If you pass a FOREGROUND* priority here, it's (hopefully)
|
|
|
|
// unlikely that the process will be killed after this point.
|
|
|
|
bool SetPriorityAndCheckIsAlive(hal::ProcessPriority aPriority);
|
|
|
|
|
2012-08-15 18:46:03 -07:00
|
|
|
// Transform a pre-allocated app process into a "real" app
|
2013-02-08 06:32:23 -08:00
|
|
|
// process, for the specified manifest URL. If this returns false, the
|
|
|
|
// child process has died.
|
|
|
|
bool TransformPreallocatedIntoApp(const nsAString& aAppManifestURL,
|
2013-02-14 12:41:30 -08:00
|
|
|
ChildPrivileges aPrivs);
|
2012-08-15 18:46:03 -07:00
|
|
|
|
2012-07-17 11:27:27 -07:00
|
|
|
/**
|
|
|
|
* Mark this ContentParent as dead for the purposes of Get*().
|
|
|
|
* This method is idempotent.
|
|
|
|
*/
|
|
|
|
void MarkAsDead();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Exit the subprocess and vamoose. After this call IsAlive()
|
|
|
|
* will return false and this ContentParent will not be returned
|
|
|
|
* by the Get*() funtions. However, the shutdown sequence itself
|
|
|
|
* may be asynchronous.
|
2013-07-15 05:55:13 -07:00
|
|
|
*
|
2013-07-17 12:13:20 -07:00
|
|
|
* If aCloseWithError is true and this is the first call to
|
2013-07-15 05:55:13 -07:00
|
|
|
* ShutDownProcess, then we'll close our channel using CloseWithError()
|
|
|
|
* rather than vanilla Close(). CloseWithError() indicates to IPC that this
|
2013-07-17 12:13:20 -07:00
|
|
|
* is an abnormal shutdown (e.g. a crash).
|
2012-07-17 11:27:27 -07:00
|
|
|
*/
|
2013-07-17 12:13:20 -07:00
|
|
|
void ShutDownProcess(bool aCloseWithError);
|
2012-07-17 11:27:27 -07:00
|
|
|
|
2013-09-25 21:19:09 -07:00
|
|
|
PCompositorParent*
|
2013-07-08 08:48:39 -07:00
|
|
|
AllocPCompositorParent(mozilla::ipc::Transport* aTransport,
|
|
|
|
base::ProcessId aOtherProcess) MOZ_OVERRIDE;
|
2013-09-25 21:19:09 -07:00
|
|
|
PImageBridgeParent*
|
2013-07-08 08:48:39 -07:00
|
|
|
AllocPImageBridgeParent(mozilla::ipc::Transport* aTransport,
|
|
|
|
base::ProcessId aOtherProcess) MOZ_OVERRIDE;
|
2012-07-17 16:59:45 -07:00
|
|
|
|
2012-09-04 17:36:16 -07:00
|
|
|
virtual bool RecvGetProcessAttributes(uint64_t* aId,
|
|
|
|
bool* aIsForApp,
|
|
|
|
bool* aIsForBrowser) MOZ_OVERRIDE;
|
2012-11-08 13:09:39 -08:00
|
|
|
virtual bool RecvGetXPCOMProcessAttributes(bool* aIsOffline) MOZ_OVERRIDE;
|
2012-09-04 17:36:16 -07:00
|
|
|
|
2013-07-08 08:48:39 -07:00
|
|
|
virtual bool DeallocPJavaScriptParent(mozilla::jsipc::PJavaScriptParent*);
|
2013-07-03 00:24:32 -07:00
|
|
|
|
2013-07-08 08:48:39 -07:00
|
|
|
virtual PBrowserParent* AllocPBrowserParent(const IPCTabContext& aContext,
|
|
|
|
const uint32_t& aChromeFlags);
|
|
|
|
virtual bool DeallocPBrowserParent(PBrowserParent* frame);
|
2009-08-12 09:18:08 -07:00
|
|
|
|
2013-07-08 08:48:39 -07:00
|
|
|
virtual PDeviceStorageRequestParent* AllocPDeviceStorageRequestParent(const DeviceStorageParams&);
|
|
|
|
virtual bool DeallocPDeviceStorageRequestParent(PDeviceStorageRequestParent*);
|
2012-06-19 16:14:39 -07:00
|
|
|
|
2013-07-08 08:48:39 -07:00
|
|
|
virtual PBlobParent* AllocPBlobParent(const BlobConstructorParams& aParams);
|
|
|
|
virtual bool DeallocPBlobParent(PBlobParent*);
|
2012-08-01 23:02:29 -07:00
|
|
|
|
2013-07-08 08:48:39 -07:00
|
|
|
virtual bool DeallocPCrashReporterParent(PCrashReporterParent* crashreporter);
|
2010-11-24 06:15:03 -08:00
|
|
|
|
2013-02-27 12:31:19 -08:00
|
|
|
virtual bool RecvGetRandomValues(const uint32_t& length,
|
|
|
|
InfallibleTArray<uint8_t>* randomValues);
|
|
|
|
|
2013-07-08 08:48:39 -07:00
|
|
|
virtual bool DeallocPHalParent(PHalParent*) MOZ_OVERRIDE;
|
2011-10-05 15:15:45 -07:00
|
|
|
|
2013-07-08 08:48:39 -07:00
|
|
|
virtual bool DeallocPIndexedDBParent(PIndexedDBParent* aActor);
|
2012-07-14 04:24:20 -07:00
|
|
|
|
2013-07-08 08:48:39 -07:00
|
|
|
virtual PMemoryReportRequestParent* AllocPMemoryReportRequestParent();
|
|
|
|
virtual bool DeallocPMemoryReportRequestParent(PMemoryReportRequestParent* actor);
|
2011-02-16 10:43:23 -08:00
|
|
|
|
2013-07-08 08:48:39 -07:00
|
|
|
virtual PTestShellParent* AllocPTestShellParent();
|
|
|
|
virtual bool DeallocPTestShellParent(PTestShellParent* shell);
|
2009-08-12 11:31:48 -07:00
|
|
|
|
2013-07-08 08:48:39 -07:00
|
|
|
virtual bool DeallocPNeckoParent(PNeckoParent* necko);
|
2009-08-18 12:05:15 -07:00
|
|
|
|
2013-07-08 08:48:39 -07:00
|
|
|
virtual PExternalHelperAppParent* AllocPExternalHelperAppParent(
|
2012-08-23 12:33:46 -07:00
|
|
|
const OptionalURIParams& aUri,
|
2010-09-15 15:55:08 -07:00
|
|
|
const nsCString& aMimeContentType,
|
|
|
|
const nsCString& aContentDisposition,
|
|
|
|
const bool& aForceSave,
|
2012-08-22 08:56:38 -07:00
|
|
|
const int64_t& aContentLength,
|
2013-09-12 12:24:10 -07:00
|
|
|
const OptionalURIParams& aReferrer,
|
|
|
|
PBrowserParent* aBrowser);
|
2013-07-08 08:48:39 -07:00
|
|
|
virtual bool DeallocPExternalHelperAppParent(PExternalHelperAppParent* aService);
|
2010-09-15 15:55:08 -07:00
|
|
|
|
2013-07-08 08:48:39 -07:00
|
|
|
virtual PSmsParent* AllocPSmsParent();
|
|
|
|
virtual bool DeallocPSmsParent(PSmsParent*);
|
2011-11-20 14:40:53 -08:00
|
|
|
|
2013-09-06 23:19:53 -07:00
|
|
|
virtual PTelephonyParent* AllocPTelephonyParent();
|
|
|
|
virtual bool DeallocPTelephonyParent(PTelephonyParent*);
|
|
|
|
|
2013-07-08 08:48:39 -07:00
|
|
|
virtual bool DeallocPStorageParent(PStorageParent* aActor);
|
2010-11-18 17:15:23 -08:00
|
|
|
|
2013-07-08 08:48:39 -07:00
|
|
|
virtual PBluetoothParent* AllocPBluetoothParent();
|
|
|
|
virtual bool DeallocPBluetoothParent(PBluetoothParent* aActor);
|
2012-09-13 09:37:14 -07:00
|
|
|
virtual bool RecvPBluetoothConstructor(PBluetoothParent* aActor);
|
|
|
|
|
2013-09-03 15:28:06 -07:00
|
|
|
virtual PFMRadioParent* AllocPFMRadioParent();
|
|
|
|
virtual bool DeallocPFMRadioParent(PFMRadioParent* aActor);
|
|
|
|
|
2013-07-08 08:48:39 -07:00
|
|
|
virtual PSpeechSynthesisParent* AllocPSpeechSynthesisParent();
|
|
|
|
virtual bool DeallocPSpeechSynthesisParent(PSpeechSynthesisParent* aActor);
|
2013-04-03 15:13:17 -07:00
|
|
|
virtual bool RecvPSpeechSynthesisConstructor(PSpeechSynthesisParent* aActor);
|
|
|
|
|
2012-08-22 13:00:21 -07:00
|
|
|
virtual bool RecvReadPrefsArray(InfallibleTArray<PrefSetting>* aPrefs);
|
2011-01-12 20:04:42 -08:00
|
|
|
virtual bool RecvReadFontList(InfallibleTArray<FontListEntry>* retValue);
|
2010-05-28 11:09:15 -07:00
|
|
|
|
2010-11-08 18:49:00 -08:00
|
|
|
virtual bool RecvReadPermissions(InfallibleTArray<IPC::Permission>* aPermissions);
|
2011-04-29 16:46:20 -07:00
|
|
|
|
2012-08-22 08:56:38 -07:00
|
|
|
virtual bool RecvSetClipboardText(const nsString& text, const bool& isPrivateData, const int32_t& whichClipboard);
|
|
|
|
virtual bool RecvGetClipboardText(const int32_t& whichClipboard, nsString* text);
|
2011-02-28 21:36:43 -08:00
|
|
|
virtual bool RecvEmptyClipboard();
|
2011-09-28 23:19:26 -07:00
|
|
|
virtual bool RecvClipboardHasText(bool* hasText);
|
2010-05-25 17:13:47 -07:00
|
|
|
|
2012-08-22 08:56:38 -07:00
|
|
|
virtual bool RecvGetSystemColors(const uint32_t& colorsCount, InfallibleTArray<uint32_t>* colors);
|
|
|
|
virtual bool RecvGetIconForExtension(const nsCString& aFileExt, const uint32_t& aIconSize, InfallibleTArray<uint8_t>* bits);
|
2011-09-28 23:19:26 -07:00
|
|
|
virtual bool RecvGetShowPasswordSetting(bool* showPassword);
|
2011-03-30 11:04:41 -07:00
|
|
|
|
2012-08-23 12:33:46 -07:00
|
|
|
virtual bool RecvStartVisitedQuery(const URIParams& uri);
|
2010-07-02 08:50:41 -07:00
|
|
|
|
2012-08-23 12:33:46 -07:00
|
|
|
virtual bool RecvVisitURI(const URIParams& uri,
|
|
|
|
const OptionalURIParams& referrer,
|
2012-08-22 08:56:38 -07:00
|
|
|
const uint32_t& flags);
|
2010-07-02 08:50:24 -07:00
|
|
|
|
2012-08-23 12:33:46 -07:00
|
|
|
virtual bool RecvSetURITitle(const URIParams& uri,
|
2010-07-02 08:53:42 -07:00
|
|
|
const nsString& title);
|
2012-12-05 19:01:58 -08:00
|
|
|
|
2012-08-22 08:56:38 -07:00
|
|
|
virtual bool RecvShowFilePicker(const int16_t& mode,
|
|
|
|
const int16_t& selectedType,
|
2011-09-28 23:19:26 -07:00
|
|
|
const bool& addToRecentDocs,
|
2010-10-20 08:19:24 -07:00
|
|
|
const nsString& title,
|
|
|
|
const nsString& defaultFile,
|
|
|
|
const nsString& defaultExtension,
|
2010-11-08 18:49:00 -08:00
|
|
|
const InfallibleTArray<nsString>& filters,
|
|
|
|
const InfallibleTArray<nsString>& filterNames,
|
|
|
|
InfallibleTArray<nsString>* files,
|
2012-08-22 08:56:38 -07:00
|
|
|
int16_t* retValue,
|
2010-10-20 08:19:24 -07:00
|
|
|
nsresult* result);
|
2012-12-05 19:01:58 -08:00
|
|
|
|
2010-09-15 09:44:57 -07:00
|
|
|
virtual bool RecvShowAlertNotification(const nsString& aImageUrl, const nsString& aTitle,
|
2011-09-28 23:19:26 -07:00
|
|
|
const nsString& aText, const bool& aTextClickable,
|
2013-03-18 06:24:53 -07:00
|
|
|
const nsString& aCookie, const nsString& aName,
|
|
|
|
const nsString& aBidi, const nsString& aLang);
|
|
|
|
|
|
|
|
virtual bool RecvCloseAlert(const nsString& aName);
|
2010-07-02 08:53:42 -07:00
|
|
|
|
2012-08-23 12:33:46 -07:00
|
|
|
virtual bool RecvLoadURIExternal(const URIParams& uri);
|
2010-08-10 10:14:45 -07:00
|
|
|
|
2012-08-01 23:02:29 -07:00
|
|
|
virtual bool RecvSyncMessage(const nsString& aMsg,
|
|
|
|
const ClonedMessageData& aData,
|
2013-07-10 15:05:39 -07:00
|
|
|
const InfallibleTArray<CpowEntry>& aCpows,
|
2010-11-08 18:49:00 -08:00
|
|
|
InfallibleTArray<nsString>* aRetvals);
|
2013-10-01 09:15:06 -07:00
|
|
|
virtual bool AnswerRpcMessage(const nsString& aMsg,
|
|
|
|
const ClonedMessageData& aData,
|
|
|
|
const InfallibleTArray<CpowEntry>& aCpows,
|
|
|
|
InfallibleTArray<nsString>* aRetvals);
|
2012-08-01 23:02:29 -07:00
|
|
|
virtual bool RecvAsyncMessage(const nsString& aMsg,
|
2013-07-10 15:05:39 -07:00
|
|
|
const ClonedMessageData& aData,
|
|
|
|
const InfallibleTArray<CpowEntry>& aCpows);
|
2010-08-31 11:58:35 -07:00
|
|
|
|
2013-01-09 07:03:28 -08:00
|
|
|
virtual bool RecvFilePathUpdateNotify(const nsString& aType,
|
2013-05-11 02:10:18 -07:00
|
|
|
const nsString& aStorageName,
|
2013-01-09 07:03:28 -08:00
|
|
|
const nsString& aFilePath,
|
|
|
|
const nsCString& aReason);
|
|
|
|
|
2013-02-26 09:27:31 -08:00
|
|
|
virtual bool RecvAddGeolocationListener(const IPC::Principal& aPrincipal,
|
|
|
|
const bool& aHighAccuracy);
|
2010-11-05 10:43:13 -07:00
|
|
|
virtual bool RecvRemoveGeolocationListener();
|
2012-12-31 08:36:46 -08:00
|
|
|
virtual bool RecvSetGeolocationHigherAccuracy(const bool& aEnable);
|
2010-09-20 21:16:37 -07:00
|
|
|
|
2010-09-23 18:39:32 -07:00
|
|
|
virtual bool RecvConsoleMessage(const nsString& aMessage);
|
|
|
|
virtual bool RecvScriptError(const nsString& aMessage,
|
|
|
|
const nsString& aSourceName,
|
|
|
|
const nsString& aSourceLine,
|
2012-08-22 08:56:38 -07:00
|
|
|
const uint32_t& aLineNumber,
|
|
|
|
const uint32_t& aColNumber,
|
|
|
|
const uint32_t& aFlags,
|
2010-09-23 18:39:32 -07:00
|
|
|
const nsCString& aCategory);
|
|
|
|
|
2012-04-19 17:13:20 -07:00
|
|
|
virtual bool RecvPrivateDocShellsExist(const bool& aExist);
|
2012-08-01 23:32:04 -07:00
|
|
|
|
2012-10-08 21:46:19 -07:00
|
|
|
virtual bool RecvFirstIdle();
|
|
|
|
|
2013-09-02 02:45:44 -07:00
|
|
|
virtual bool RecvAudioChannelGetState(const AudioChannelType& aType,
|
2013-01-08 23:18:16 -08:00
|
|
|
const bool& aElementHidden,
|
|
|
|
const bool& aElementWasHidden,
|
2013-09-02 02:45:44 -07:00
|
|
|
AudioChannelState* aValue);
|
2012-12-05 19:01:58 -08:00
|
|
|
|
2013-09-17 20:46:22 -07:00
|
|
|
virtual bool RecvAudioChannelRegisterType(const AudioChannelType& aType,
|
|
|
|
const bool& aWithVideo);
|
2013-01-08 23:18:16 -08:00
|
|
|
virtual bool RecvAudioChannelUnregisterType(const AudioChannelType& aType,
|
2013-09-17 20:46:22 -07:00
|
|
|
const bool& aElementHidden,
|
|
|
|
const bool& aWithVideo);
|
2013-01-08 23:18:16 -08:00
|
|
|
|
|
|
|
virtual bool RecvAudioChannelChangedNotification();
|
2012-12-05 19:01:58 -08:00
|
|
|
|
2013-09-12 05:26:03 -07:00
|
|
|
virtual bool RecvAudioChannelChangeDefVolChannel(
|
|
|
|
const AudioChannelType& aType, const bool& aHidden);
|
|
|
|
|
2012-12-14 16:01:34 -08:00
|
|
|
virtual bool RecvBroadcastVolume(const nsString& aVolumeName);
|
|
|
|
|
2013-01-24 18:45:36 -08:00
|
|
|
virtual bool RecvRecordingDeviceEvents(const nsString& aRecordingStatus);
|
|
|
|
|
2013-02-14 12:41:30 -08:00
|
|
|
virtual bool RecvSystemMessageHandled() MOZ_OVERRIDE;
|
|
|
|
|
2013-06-03 03:14:40 -07:00
|
|
|
virtual bool RecvNuwaReady() MOZ_OVERRIDE;
|
|
|
|
|
|
|
|
virtual bool RecvAddNewProcess(const uint32_t& aPid,
|
|
|
|
const InfallibleTArray<ProtocolFdMapping>& aFds) MOZ_OVERRIDE;
|
|
|
|
|
2013-07-08 23:37:47 -07:00
|
|
|
virtual bool RecvCreateFakeVolume(const nsString& fsName, const nsString& mountPoint) MOZ_OVERRIDE;
|
|
|
|
|
|
|
|
virtual bool RecvSetFakeVolumeState(const nsString& fsName, const int32_t& fsState) MOZ_OVERRIDE;
|
|
|
|
|
2013-08-16 10:59:31 -07:00
|
|
|
virtual bool RecvKeywordToURI(const nsCString& aKeyword, OptionalInputStreamParams* aPostData,
|
|
|
|
OptionalURIParams* aURI);
|
|
|
|
|
2011-07-12 23:52:31 -07:00
|
|
|
virtual void ProcessingError(Result what) MOZ_OVERRIDE;
|
|
|
|
|
2013-07-31 14:26:19 -07:00
|
|
|
// If you add strong pointers to cycle collected objects here, be sure to
|
|
|
|
// release these objects in ShutDownProcess. See the comment there for more
|
|
|
|
// details.
|
|
|
|
|
2009-09-02 17:18:27 -07:00
|
|
|
GeckoChildProcessHost* mSubprocess;
|
2013-02-08 06:32:23 -08:00
|
|
|
base::ChildPrivileges mOSPrivileges;
|
2010-02-01 17:53:52 -08:00
|
|
|
|
2012-11-17 07:05:18 -08:00
|
|
|
uint64_t mChildID;
|
2012-08-22 08:56:38 -07:00
|
|
|
int32_t mGeolocationWatchID;
|
2010-02-01 17:53:52 -08:00
|
|
|
|
2013-08-27 16:24:51 -07:00
|
|
|
// This is a reporter holding the reports from the child's last
|
|
|
|
// "child-memory-reporter-update" notification. To update this, one can
|
|
|
|
// broadcast the topic "child-memory-reporter-request" using the
|
|
|
|
// nsIObserverService.
|
|
|
|
//
|
|
|
|
// Note that this assumes there is at most one child process at a time!
|
|
|
|
nsCOMPtr<nsIMemoryReporter> mChildReporter;
|
2011-02-16 10:43:23 -08:00
|
|
|
|
2013-04-25 17:53:26 -07:00
|
|
|
nsString mAppManifestURL;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* We cache mAppName instead of looking it up using mAppManifestURL when we
|
|
|
|
* need it because it turns out that getting an app from the apps service is
|
|
|
|
* expensive.
|
|
|
|
*/
|
|
|
|
nsString mAppName;
|
|
|
|
|
2011-08-02 12:57:48 -07:00
|
|
|
nsRefPtr<nsFrameMessageManager> mMessageManager;
|
2011-06-08 12:56:31 -07:00
|
|
|
|
2013-01-10 05:22:14 -08:00
|
|
|
// After we initiate shutdown, we also start a timer to ensure
|
|
|
|
// that even content processes that are 100% blocked (say from
|
|
|
|
// SIGSTOP), are still killed eventually. This task enforces that
|
|
|
|
// timer.
|
|
|
|
CancelableTask* mForceKillTask;
|
|
|
|
// How many tabs we're waiting to finish their destruction
|
|
|
|
// sequence. Precisely, how many TabParents have called
|
|
|
|
// NotifyTabDestroying() but not called NotifyTabDestroyed().
|
|
|
|
int32_t mNumDestroyingTabs;
|
2012-11-27 12:43:52 -08:00
|
|
|
// True only while this is ready to be used to host remote tabs.
|
|
|
|
// This must not be used for new purposes after mIsAlive goes to
|
|
|
|
// false, but some previously scheduled IPC traffic may still pass
|
|
|
|
// through.
|
2012-09-04 17:36:16 -07:00
|
|
|
bool mIsAlive;
|
2013-08-07 11:08:52 -07:00
|
|
|
|
2012-09-04 17:36:16 -07:00
|
|
|
bool mSendPermissionUpdates;
|
|
|
|
bool mIsForBrowser;
|
|
|
|
|
2013-08-16 17:44:17 -07:00
|
|
|
// These variables track whether we've called Close(), CloseWithError()
|
|
|
|
// and KillHard() on our channel.
|
2013-08-07 11:08:52 -07:00
|
|
|
bool mCalledClose;
|
|
|
|
bool mCalledCloseWithError;
|
2013-08-16 17:44:17 -07:00
|
|
|
bool mCalledKillHard;
|
2013-08-07 11:08:52 -07:00
|
|
|
|
2011-06-08 12:56:31 -07:00
|
|
|
friend class CrashReporterParent;
|
2012-11-09 09:52:09 -08:00
|
|
|
|
|
|
|
nsRefPtr<nsConsoleService> mConsoleService;
|
2012-11-09 10:23:18 -08:00
|
|
|
nsConsoleService* GetConsoleService();
|
2009-08-12 09:18:08 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace dom
|
|
|
|
} // namespace mozilla
|
|
|
|
|
|
|
|
#endif
|