2009-08-18 19:05:15 +00: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 11:12:37 +00: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 16:18:08 +00:00
|
|
|
|
2010-07-19 18:33:33 +00:00
|
|
|
#ifndef mozilla_dom_ContentChild_h
|
|
|
|
#define mozilla_dom_ContentChild_h
|
2009-08-12 16:18:08 +00:00
|
|
|
|
2011-12-17 21:45:29 +00:00
|
|
|
#include "mozilla/Attributes.h"
|
2010-07-19 18:33:33 +00:00
|
|
|
#include "mozilla/dom/PContentChild.h"
|
2012-08-02 06:02:29 +00:00
|
|
|
#include "mozilla/dom/ipc/Blob.h"
|
2013-09-23 21:30:40 +00:00
|
|
|
#include "nsWeakPtr.h"
|
2009-08-25 23:07:22 +00:00
|
|
|
|
2010-03-11 05:33:00 +00:00
|
|
|
struct ChromePackage;
|
2012-08-02 06:02:29 +00:00
|
|
|
class nsIDOMBlob;
|
2010-07-21 18:42:32 +00:00
|
|
|
class nsIObserver;
|
2010-03-11 05:33:00 +00:00
|
|
|
struct ResourceMapping;
|
|
|
|
struct OverrideMapping;
|
|
|
|
|
2009-08-12 16:18:08 +00:00
|
|
|
namespace mozilla {
|
2012-07-17 23:59:45 +00:00
|
|
|
|
2012-08-23 19:33:46 +00:00
|
|
|
namespace ipc {
|
|
|
|
class OptionalURIParams;
|
|
|
|
class URIParams;
|
|
|
|
}// namespace ipc
|
|
|
|
|
2013-07-03 07:24:32 +00:00
|
|
|
namespace jsipc {
|
|
|
|
class JavaScriptChild;
|
|
|
|
}
|
|
|
|
|
2012-07-17 23:59:45 +00:00
|
|
|
namespace layers {
|
|
|
|
class PCompositorChild;
|
2012-08-23 19:33:46 +00:00
|
|
|
} // namespace layers
|
2012-07-17 23:59:45 +00:00
|
|
|
|
2009-08-12 16:18:08 +00:00
|
|
|
namespace dom {
|
|
|
|
|
2010-09-15 16:44:57 +00:00
|
|
|
class AlertObserver;
|
2010-07-21 18:42:32 +00:00
|
|
|
class PrefObserver;
|
2010-09-24 01:39:32 +00:00
|
|
|
class ConsoleListener;
|
2010-11-19 01:15:23 +00:00
|
|
|
class PStorageChild;
|
2012-08-02 06:02:29 +00:00
|
|
|
class ClonedMessageData;
|
2010-07-21 18:42:32 +00:00
|
|
|
|
2010-07-19 18:33:33 +00:00
|
|
|
class ContentChild : public PContentChild
|
2009-08-12 16:18:08 +00:00
|
|
|
{
|
2012-08-02 06:02:29 +00:00
|
|
|
typedef mozilla::dom::ClonedMessageData ClonedMessageData;
|
2012-08-23 19:33:46 +00:00
|
|
|
typedef mozilla::ipc::OptionalURIParams OptionalURIParams;
|
|
|
|
typedef mozilla::ipc::URIParams URIParams;
|
2012-07-17 23:59:45 +00:00
|
|
|
|
2009-08-12 16:18:08 +00:00
|
|
|
public:
|
2010-07-19 18:33:33 +00:00
|
|
|
ContentChild();
|
|
|
|
virtual ~ContentChild();
|
2013-07-10 17:07:51 +00:00
|
|
|
nsrefcnt AddRef() { return 1; }
|
|
|
|
nsrefcnt Release() { return 1; }
|
2009-08-12 16:18:08 +00:00
|
|
|
|
2011-10-04 20:31:00 +00:00
|
|
|
struct AppInfo
|
|
|
|
{
|
|
|
|
nsCString version;
|
|
|
|
nsCString buildID;
|
2013-04-22 16:41:59 +00:00
|
|
|
nsCString name;
|
|
|
|
nsCString UAName;
|
2011-10-04 20:31:00 +00:00
|
|
|
};
|
|
|
|
|
2009-10-27 21:52:37 +00:00
|
|
|
bool Init(MessageLoop* aIOLoop,
|
|
|
|
base::ProcessHandle aParentHandle,
|
|
|
|
IPC::Channel* aChannel);
|
2010-09-24 01:39:32 +00:00
|
|
|
void InitXPCOM();
|
2009-08-12 16:18:08 +00:00
|
|
|
|
2010-07-19 18:33:33 +00:00
|
|
|
static ContentChild* GetSingleton() {
|
2009-08-13 00:32:50 +00:00
|
|
|
return sSingleton;
|
|
|
|
}
|
|
|
|
|
2011-10-04 20:31:00 +00:00
|
|
|
const AppInfo& GetAppInfo() {
|
|
|
|
return mAppInfo;
|
|
|
|
}
|
|
|
|
|
2012-10-05 21:54:54 +00:00
|
|
|
void SetProcessName(const nsAString& aName);
|
2013-10-25 03:47:48 +00:00
|
|
|
void GetProcessName(nsAString& aName);
|
|
|
|
void GetProcessName(nsACString& aName);
|
|
|
|
static void AppendProcessId(nsACString& aName);
|
2012-10-05 21:54:54 +00:00
|
|
|
|
2013-09-26 04:19:09 +00:00
|
|
|
PCompositorChild*
|
2013-07-08 15:48:39 +00:00
|
|
|
AllocPCompositorChild(mozilla::ipc::Transport* aTransport,
|
|
|
|
base::ProcessId aOtherProcess) MOZ_OVERRIDE;
|
2013-09-26 04:19:09 +00:00
|
|
|
PImageBridgeChild*
|
2013-07-08 15:48:39 +00:00
|
|
|
AllocPImageBridgeChild(mozilla::ipc::Transport* aTransport,
|
|
|
|
base::ProcessId aOtherProcess) MOZ_OVERRIDE;
|
2010-03-24 10:47:18 +00:00
|
|
|
|
2013-01-17 20:06:36 +00:00
|
|
|
virtual bool RecvSetProcessPrivileges(const ChildPrivileges& aPrivs);
|
|
|
|
|
2013-07-08 15:48:39 +00:00
|
|
|
virtual PBrowserChild* AllocPBrowserChild(const IPCTabContext &aContext,
|
|
|
|
const uint32_t &chromeFlags);
|
|
|
|
virtual bool DeallocPBrowserChild(PBrowserChild*);
|
2009-08-12 16:18:08 +00:00
|
|
|
|
2013-07-08 15:48:39 +00:00
|
|
|
virtual PDeviceStorageRequestChild* AllocPDeviceStorageRequestChild(const DeviceStorageParams&);
|
|
|
|
virtual bool DeallocPDeviceStorageRequestChild(PDeviceStorageRequestChild*);
|
2012-06-19 23:14:39 +00:00
|
|
|
|
2013-07-08 15:48:39 +00:00
|
|
|
virtual PBlobChild* AllocPBlobChild(const BlobConstructorParams& aParams);
|
|
|
|
virtual bool DeallocPBlobChild(PBlobChild*);
|
2012-08-02 06:02:29 +00:00
|
|
|
|
2011-06-08 19:56:31 +00:00
|
|
|
virtual PCrashReporterChild*
|
2013-07-08 15:48:39 +00:00
|
|
|
AllocPCrashReporterChild(const mozilla::dom::NativeThreadId& id,
|
|
|
|
const uint32_t& processType);
|
2011-06-08 19:56:31 +00:00
|
|
|
virtual bool
|
2013-07-08 15:48:39 +00:00
|
|
|
DeallocPCrashReporterChild(PCrashReporterChild*);
|
2010-11-24 14:15:03 +00:00
|
|
|
|
2013-07-08 15:48:39 +00:00
|
|
|
virtual PHalChild* AllocPHalChild() MOZ_OVERRIDE;
|
|
|
|
virtual bool DeallocPHalChild(PHalChild*) MOZ_OVERRIDE;
|
2011-10-05 22:15:45 +00:00
|
|
|
|
2013-07-08 15:48:39 +00:00
|
|
|
virtual PIndexedDBChild* AllocPIndexedDBChild();
|
|
|
|
virtual bool DeallocPIndexedDBChild(PIndexedDBChild* aActor);
|
2012-07-14 11:24:20 +00:00
|
|
|
|
2011-02-16 18:43:23 +00:00
|
|
|
virtual PMemoryReportRequestChild*
|
2013-10-23 05:26:24 +00:00
|
|
|
AllocPMemoryReportRequestChild(const uint32_t& generation);
|
2011-02-16 18:43:23 +00:00
|
|
|
|
|
|
|
virtual bool
|
2013-07-08 15:48:39 +00:00
|
|
|
DeallocPMemoryReportRequestChild(PMemoryReportRequestChild* actor);
|
2011-02-16 18:43:23 +00:00
|
|
|
|
|
|
|
virtual bool
|
2013-10-23 05:26:24 +00:00
|
|
|
RecvPMemoryReportRequestConstructor(PMemoryReportRequestChild* child,
|
|
|
|
const uint32_t& generation);
|
2011-02-16 18:43:23 +00:00
|
|
|
|
2012-12-06 03:01:58 +00:00
|
|
|
virtual bool
|
|
|
|
RecvAudioChannelNotify();
|
|
|
|
|
2012-10-03 01:19:11 +00:00
|
|
|
virtual bool
|
2013-03-28 03:31:26 +00:00
|
|
|
RecvDumpMemoryInfoToTempDir(const nsString& aIdentifier,
|
2012-10-03 01:19:11 +00:00
|
|
|
const bool& aMinimizeMemoryUsage,
|
|
|
|
const bool& aDumpChildProcesses);
|
2012-10-16 02:12:14 +00:00
|
|
|
virtual bool
|
|
|
|
RecvDumpGCAndCCLogsToFile(const nsString& aIdentifier,
|
2013-07-08 17:20:39 +00:00
|
|
|
const bool& aDumpAllTraces,
|
2012-10-16 02:12:14 +00:00
|
|
|
const bool& aDumpChildProcesses);
|
2012-10-03 01:19:11 +00:00
|
|
|
|
2013-07-08 15:48:39 +00:00
|
|
|
virtual PTestShellChild* AllocPTestShellChild();
|
|
|
|
virtual bool DeallocPTestShellChild(PTestShellChild*);
|
2009-11-06 20:43:39 +00:00
|
|
|
virtual bool RecvPTestShellConstructor(PTestShellChild*);
|
2013-07-03 07:24:32 +00:00
|
|
|
jsipc::JavaScriptChild *GetCPOWManager();
|
2009-08-25 23:07:22 +00:00
|
|
|
|
2013-07-08 15:48:39 +00:00
|
|
|
virtual PNeckoChild* AllocPNeckoChild();
|
|
|
|
virtual bool DeallocPNeckoChild(PNeckoChild*);
|
2009-08-18 19:05:15 +00:00
|
|
|
|
2013-07-08 15:48:39 +00:00
|
|
|
virtual PExternalHelperAppChild *AllocPExternalHelperAppChild(
|
2012-08-23 19:33:46 +00:00
|
|
|
const OptionalURIParams& uri,
|
2010-09-15 22:55:08 +00:00
|
|
|
const nsCString& aMimeContentType,
|
|
|
|
const nsCString& aContentDisposition,
|
|
|
|
const bool& aForceSave,
|
2012-08-22 15:56:38 +00:00
|
|
|
const int64_t& aContentLength,
|
2013-09-12 19:24:10 +00:00
|
|
|
const OptionalURIParams& aReferrer,
|
|
|
|
PBrowserChild* aBrowser);
|
2013-07-08 15:48:39 +00:00
|
|
|
virtual bool DeallocPExternalHelperAppChild(PExternalHelperAppChild *aService);
|
2010-09-15 22:55:08 +00:00
|
|
|
|
2013-07-08 15:48:39 +00:00
|
|
|
virtual PSmsChild* AllocPSmsChild();
|
|
|
|
virtual bool DeallocPSmsChild(PSmsChild*);
|
2011-11-20 22:40:53 +00:00
|
|
|
|
2013-09-07 06:19:53 +00:00
|
|
|
virtual PTelephonyChild* AllocPTelephonyChild();
|
|
|
|
virtual bool DeallocPTelephonyChild(PTelephonyChild*);
|
|
|
|
|
2013-07-08 15:48:39 +00:00
|
|
|
virtual PStorageChild* AllocPStorageChild();
|
|
|
|
virtual bool DeallocPStorageChild(PStorageChild* aActor);
|
2010-11-19 01:15:23 +00:00
|
|
|
|
2013-07-08 15:48:39 +00:00
|
|
|
virtual PBluetoothChild* AllocPBluetoothChild();
|
|
|
|
virtual bool DeallocPBluetoothChild(PBluetoothChild* aActor);
|
2012-09-13 16:37:14 +00:00
|
|
|
|
2013-09-03 22:28:06 +00:00
|
|
|
virtual PFMRadioChild* AllocPFMRadioChild();
|
|
|
|
virtual bool DeallocPFMRadioChild(PFMRadioChild* aActor);
|
|
|
|
|
2013-11-18 21:49:53 +00:00
|
|
|
virtual PAsmJSCacheEntryChild* AllocPAsmJSCacheEntryChild(
|
|
|
|
const asmjscache::OpenMode& aOpenMode,
|
|
|
|
const int64_t& aSizeToWrite,
|
|
|
|
const IPC::Principal& aPrincipal) MOZ_OVERRIDE;
|
|
|
|
virtual bool DeallocPAsmJSCacheEntryChild(
|
|
|
|
PAsmJSCacheEntryChild* aActor) MOZ_OVERRIDE;
|
|
|
|
|
2013-07-08 15:48:39 +00:00
|
|
|
virtual PSpeechSynthesisChild* AllocPSpeechSynthesisChild();
|
|
|
|
virtual bool DeallocPSpeechSynthesisChild(PSpeechSynthesisChild* aActor);
|
2013-04-03 22:13:17 +00:00
|
|
|
|
2010-11-09 02:49:00 +00:00
|
|
|
virtual bool RecvRegisterChrome(const InfallibleTArray<ChromePackage>& packages,
|
|
|
|
const InfallibleTArray<ResourceMapping>& resources,
|
2011-01-11 21:34:31 +00:00
|
|
|
const InfallibleTArray<OverrideMapping>& overrides,
|
|
|
|
const nsCString& locale);
|
2010-03-11 05:33:00 +00:00
|
|
|
|
2013-07-08 15:48:39 +00:00
|
|
|
virtual mozilla::jsipc::PJavaScriptChild* AllocPJavaScriptChild();
|
|
|
|
virtual bool DeallocPJavaScriptChild(mozilla::jsipc::PJavaScriptChild*);
|
2013-07-03 07:24:32 +00:00
|
|
|
|
2011-09-29 06:19:26 +00:00
|
|
|
virtual bool RecvSetOffline(const bool& offline);
|
2010-05-11 12:44:12 +00:00
|
|
|
|
2013-11-24 23:50:03 +00:00
|
|
|
virtual bool RecvSpeakerManagerNotify();
|
|
|
|
|
2012-08-23 19:33:46 +00:00
|
|
|
virtual bool RecvNotifyVisited(const URIParams& aURI);
|
2010-09-15 16:44:57 +00:00
|
|
|
// auto remove when alertfinished is received.
|
|
|
|
nsresult AddRemoteAlertObserver(const nsString& aData, nsIObserver* aObserver);
|
|
|
|
|
2012-08-22 20:00:21 +00:00
|
|
|
virtual bool RecvPreferenceUpdate(const PrefSetting& aPref);
|
2010-10-19 20:35:08 +00:00
|
|
|
|
2010-09-15 16:44:57 +00:00
|
|
|
virtual bool RecvNotifyAlertsObserver(const nsCString& aType, const nsString& aData);
|
|
|
|
|
2012-08-02 06:02:29 +00:00
|
|
|
virtual bool RecvAsyncMessage(const nsString& aMsg,
|
2013-07-10 22:05:39 +00:00
|
|
|
const ClonedMessageData& aData,
|
2013-11-06 17:21:15 +00:00
|
|
|
const InfallibleTArray<CpowEntry>& aCpows,
|
|
|
|
const IPC::Principal& aPrincipal);
|
2010-05-26 00:13:47 +00:00
|
|
|
|
2010-09-21 04:16:37 +00:00
|
|
|
virtual bool RecvGeolocationUpdate(const GeoPosition& somewhere);
|
|
|
|
|
2010-10-09 18:07:38 +00:00
|
|
|
virtual bool RecvAddPermission(const IPC::Permission& permission);
|
|
|
|
|
2010-11-24 18:22:40 +00:00
|
|
|
virtual bool RecvScreenSizeChanged(const gfxIntSize &size);
|
2010-12-11 22:36:08 +00:00
|
|
|
|
|
|
|
virtual bool RecvFlushMemory(const nsString& reason);
|
|
|
|
|
2011-07-21 04:37:32 +00:00
|
|
|
virtual bool RecvActivateA11y();
|
|
|
|
|
2011-09-13 17:53:51 +00:00
|
|
|
virtual bool RecvGarbageCollect();
|
|
|
|
virtual bool RecvCycleCollect();
|
|
|
|
|
2013-04-22 16:41:59 +00:00
|
|
|
virtual bool RecvAppInfo(const nsCString& version, const nsCString& buildID,
|
|
|
|
const nsCString& name, const nsCString& UAName);
|
2011-10-04 20:31:00 +00:00
|
|
|
|
2012-04-20 00:13:20 +00:00
|
|
|
virtual bool RecvLastPrivateDocShellDestroyed();
|
|
|
|
|
2013-05-11 09:10:18 +00:00
|
|
|
virtual bool RecvFilePathUpdate(const nsString& aStorageType,
|
|
|
|
const nsString& aStorageName,
|
|
|
|
const nsString& aPath,
|
|
|
|
const nsCString& aReason);
|
2012-12-15 00:01:34 +00:00
|
|
|
virtual bool RecvFileSystemUpdate(const nsString& aFsName,
|
2013-05-11 09:10:18 +00:00
|
|
|
const nsString& aVolumeName,
|
2012-12-15 00:01:34 +00:00
|
|
|
const int32_t& aState,
|
2013-08-22 23:12:25 +00:00
|
|
|
const int32_t& aMountGeneration,
|
|
|
|
const bool& aIsMediaPresent,
|
2013-12-03 09:32:56 +00:00
|
|
|
const bool& aIsSharing,
|
|
|
|
const bool& aIsFormatting);
|
2012-08-02 06:32:04 +00:00
|
|
|
|
2013-06-03 10:14:40 +00:00
|
|
|
virtual bool RecvNuwaFork() MOZ_OVERRIDE;
|
|
|
|
|
2013-04-26 00:53:26 +00:00
|
|
|
virtual bool RecvNotifyProcessPriorityChanged(const hal::ProcessPriority& aPriority);
|
|
|
|
virtual bool RecvMinimizeMemoryUsage();
|
|
|
|
virtual bool RecvCancelMinimizeMemoryUsage();
|
|
|
|
|
2013-08-27 17:10:39 +00:00
|
|
|
virtual bool RecvLoadAndRegisterSheet(const URIParams& aURI, const uint32_t& aType);
|
|
|
|
virtual bool RecvUnregisterSheet(const URIParams& aURI, const uint32_t& aType);
|
|
|
|
|
2013-09-13 08:51:45 +00:00
|
|
|
virtual bool RecvNotifyPhoneStateChange(const nsString& state);
|
2010-11-24 18:22:40 +00:00
|
|
|
#ifdef ANDROID
|
|
|
|
gfxIntSize GetScreenSize() { return mScreenSize; }
|
|
|
|
#endif
|
|
|
|
|
2011-04-29 23:46:20 +00:00
|
|
|
// Get the directory for IndexedDB files. We query the parent for this and
|
|
|
|
// cache the value
|
|
|
|
nsString &GetIndexedDBPath();
|
|
|
|
|
2012-08-22 15:56:38 +00:00
|
|
|
uint64_t GetID() { return mID; }
|
2011-09-30 07:00:48 +00:00
|
|
|
|
2013-01-11 11:19:02 +00:00
|
|
|
bool IsForApp() { return mIsForApp; }
|
|
|
|
bool IsForBrowser() { return mIsForBrowser; }
|
|
|
|
|
2012-08-02 06:02:29 +00:00
|
|
|
BlobChild* GetOrCreateActorForBlob(nsIDOMBlob* aBlob);
|
|
|
|
|
2013-02-23 04:24:28 +00:00
|
|
|
protected:
|
|
|
|
virtual bool RecvPBrowserConstructor(PBrowserChild* actor,
|
|
|
|
const IPCTabContext& context,
|
|
|
|
const uint32_t& chromeFlags);
|
|
|
|
|
2009-12-07 06:03:49 +00:00
|
|
|
private:
|
2012-07-17 23:59:45 +00:00
|
|
|
virtual void ActorDestroy(ActorDestroyReason why) MOZ_OVERRIDE;
|
2009-12-07 06:03:49 +00:00
|
|
|
|
2012-07-17 23:59:45 +00:00
|
|
|
virtual void ProcessingError(Result what) MOZ_OVERRIDE;
|
2010-08-20 23:24:40 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Exit *now*. Do not shut down XPCOM, do not pass Go, do not run
|
|
|
|
* static destructors, do not collect $200.
|
|
|
|
*/
|
2011-12-17 21:45:29 +00:00
|
|
|
MOZ_NORETURN void QuickExit();
|
2010-08-20 23:24:40 +00:00
|
|
|
|
2010-11-09 02:49:00 +00:00
|
|
|
InfallibleTArray<nsAutoPtr<AlertObserver> > mAlertObservers;
|
2010-09-24 01:39:32 +00:00
|
|
|
nsRefPtr<ConsoleListener> mConsoleListener;
|
2009-08-13 00:32:50 +00:00
|
|
|
|
2011-09-30 07:00:48 +00:00
|
|
|
/**
|
|
|
|
* An ID unique to the process containing our corresponding
|
|
|
|
* content parent.
|
|
|
|
*
|
|
|
|
* We expect our content parent to set this ID immediately after opening a
|
|
|
|
* channel to us.
|
|
|
|
*/
|
2012-08-22 15:56:38 +00:00
|
|
|
uint64_t mID;
|
2011-09-30 07:00:48 +00:00
|
|
|
|
2012-04-25 16:35:58 +00:00
|
|
|
AppInfo mAppInfo;
|
|
|
|
|
2012-08-07 07:06:29 +00:00
|
|
|
#ifdef ANDROID
|
|
|
|
gfxIntSize mScreenSize;
|
|
|
|
#endif
|
|
|
|
|
2012-08-23 10:23:43 +00:00
|
|
|
bool mIsForApp;
|
|
|
|
bool mIsForBrowser;
|
2012-10-05 21:54:54 +00:00
|
|
|
nsString mProcessName;
|
2013-04-26 00:53:26 +00:00
|
|
|
nsWeakPtr mMemoryMinimizerRunnable;
|
2012-08-23 10:23:43 +00:00
|
|
|
|
2010-07-21 18:42:32 +00:00
|
|
|
static ContentChild* sSingleton;
|
2010-05-26 00:13:47 +00:00
|
|
|
|
2010-07-19 18:33:33 +00:00
|
|
|
DISALLOW_EVIL_CONSTRUCTORS(ContentChild);
|
2009-08-12 16:18:08 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace dom
|
|
|
|
} // namespace mozilla
|
|
|
|
|
|
|
|
#endif
|