зеркало из https://github.com/mozilla/pjs.git
Merge the electrolysis branch to mozilla-central.
This commit is contained in:
Коммит
7a67213cf3
|
@ -118,8 +118,15 @@ interface nsIInProcessContentFrameMessageManager : nsIContentFrameMessageManager
|
|||
[notxpcom] nsIContent getOwnerContent();
|
||||
};
|
||||
|
||||
[scriptable, uuid(ed6522fd-ffb6-4920-b50d-cf629309616b)]
|
||||
interface nsIChromeFrameMessageManager : nsIFrameMessageManager
|
||||
[scriptable, uuid(6331bbca-2c9f-4766-b3c7-ae75554bf1ec)]
|
||||
interface nsITreeItemFrameMessageManager : nsIFrameMessageManager
|
||||
{
|
||||
readonly attribute unsigned long childCount;
|
||||
nsITreeItemFrameMessageManager getChildAt(in unsigned long aIndex);
|
||||
};
|
||||
|
||||
[scriptable, uuid(23e6ef7b-8cc5-4e8b-9391-453440a3b858)]
|
||||
interface nsIChromeFrameMessageManager : nsITreeItemFrameMessageManager
|
||||
{
|
||||
/*
|
||||
* Load a script in the (remote) frame. aURL must be the absolute URL.
|
||||
|
|
|
@ -1791,7 +1791,7 @@ nsFrameLoader::TryRemoteBrowser()
|
|||
return false;
|
||||
}
|
||||
|
||||
ContentParent* parent = ContentParent::GetSingleton();
|
||||
ContentParent* parent = ContentParent::GetNewOrUsed();
|
||||
NS_ASSERTION(parent->IsAlive(), "Process parent should be alive; something is very wrong!");
|
||||
mRemoteBrowser = parent->CreateTab(chromeFlags);
|
||||
if (mRemoteBrowser) {
|
||||
|
|
|
@ -98,6 +98,8 @@ NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsFrameMessageManager)
|
|||
!mChrome && !mIsProcessManager)
|
||||
/* Message managers in child process support nsISyncMessageSender. */
|
||||
NS_INTERFACE_MAP_ENTRY_CONDITIONAL(nsISyncMessageSender, !mChrome)
|
||||
/* Message managers in chrome process support nsITreeItemFrameMessageManager. */
|
||||
NS_INTERFACE_MAP_ENTRY_CONDITIONAL(nsITreeItemFrameMessageManager, mChrome)
|
||||
/* Process message manager doesn't support nsIChromeFrameMessageManager. */
|
||||
NS_INTERFACE_MAP_ENTRY_CONDITIONAL(nsIChromeFrameMessageManager,
|
||||
mChrome && !mIsProcessManager)
|
||||
|
@ -323,6 +325,24 @@ nsFrameMessageManager::GetDocShell(nsIDocShell** aDocShell)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFrameMessageManager::GetChildCount(PRUint32* aChildCount)
|
||||
{
|
||||
*aChildCount = static_cast<PRUint32>(mChildManagers.Count());
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFrameMessageManager::GetChildAt(PRUint32 aIndex,
|
||||
nsITreeItemFrameMessageManager** aMM)
|
||||
{
|
||||
*aMM = nsnull;
|
||||
nsCOMPtr<nsITreeItemFrameMessageManager> mm =
|
||||
do_QueryInterface(mChildManagers.SafeObjectAt(static_cast<PRUint32>(aIndex)));
|
||||
mm.swap(*aMM);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFrameMessageManager::Btoa(const nsAString& aBinaryData,
|
||||
nsAString& aAsciiBase64String)
|
||||
|
@ -823,7 +843,7 @@ bool SendAsyncMessageToChildProcess(void* aCallbackData,
|
|||
const nsAString& aJSON)
|
||||
{
|
||||
mozilla::dom::ContentParent* cp =
|
||||
mozilla::dom::ContentParent::GetSingleton(PR_FALSE);
|
||||
static_cast<mozilla::dom::ContentParent*>(aCallbackData);
|
||||
NS_WARN_IF_FALSE(cp, "No child process!");
|
||||
if (cp) {
|
||||
return cp->SendAsyncMessage(nsString(aMessage), nsString(aJSON));
|
||||
|
@ -857,6 +877,7 @@ bool SendAsyncMessageToParentProcess(void* aCallbackData,
|
|||
return true;
|
||||
}
|
||||
|
||||
// This creates the global parent process message manager.
|
||||
nsresult
|
||||
NS_NewParentProcessMessageManager(nsIFrameMessageManager** aResult)
|
||||
{
|
||||
|
@ -865,9 +886,9 @@ NS_NewParentProcessMessageManager(nsIFrameMessageManager** aResult)
|
|||
NS_ENSURE_TRUE(IsChromeProcess(), NS_ERROR_NOT_AVAILABLE);
|
||||
nsFrameMessageManager* mm = new nsFrameMessageManager(PR_TRUE,
|
||||
nsnull,
|
||||
SendAsyncMessageToChildProcess,
|
||||
nsnull,
|
||||
&nsFrameMessageManager::sParentProcessManager,
|
||||
nsnull,
|
||||
nsnull,
|
||||
nsnull,
|
||||
nsnull,
|
||||
PR_FALSE,
|
||||
|
@ -877,6 +898,25 @@ NS_NewParentProcessMessageManager(nsIFrameMessageManager** aResult)
|
|||
return CallQueryInterface(mm, aResult);
|
||||
}
|
||||
|
||||
nsFrameMessageManager*
|
||||
nsFrameMessageManager::NewProcessMessageManager(mozilla::dom::ContentParent* aProcess)
|
||||
{
|
||||
if (!nsFrameMessageManager::sParentProcessManager) {
|
||||
nsCOMPtr<nsIFrameMessageManager> dummy;
|
||||
NS_NewParentProcessMessageManager(getter_AddRefs(dummy));
|
||||
}
|
||||
|
||||
nsFrameMessageManager* mm = new nsFrameMessageManager(PR_TRUE,
|
||||
nsnull,
|
||||
SendAsyncMessageToChildProcess,
|
||||
nsnull,
|
||||
aProcess,
|
||||
nsFrameMessageManager::sParentProcessManager,
|
||||
nsnull,
|
||||
PR_FALSE,
|
||||
PR_TRUE);
|
||||
return mm;
|
||||
}
|
||||
|
||||
nsresult
|
||||
NS_NewChildProcessMessageManager(nsISyncMessageSender** aResult)
|
||||
|
|
|
@ -52,6 +52,12 @@
|
|||
#include "mozilla/Services.h"
|
||||
#include "nsIObserverService.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
class ContentParent;
|
||||
}
|
||||
}
|
||||
|
||||
class nsAXPCNativeCallContext;
|
||||
struct JSContext;
|
||||
struct JSObject;
|
||||
|
@ -125,6 +131,10 @@ public:
|
|||
NS_DECL_NSISYNCMESSAGESENDER
|
||||
NS_DECL_NSICONTENTFRAMEMESSAGEMANAGER
|
||||
NS_DECL_NSICHROMEFRAMEMESSAGEMANAGER
|
||||
NS_DECL_NSITREEITEMFRAMEMESSAGEMANAGER
|
||||
|
||||
static nsFrameMessageManager*
|
||||
NewProcessMessageManager(mozilla::dom::ContentParent* aProcess);
|
||||
|
||||
nsresult ReceiveMessage(nsISupports* aTarget, const nsAString& aMessage,
|
||||
PRBool aSync, const nsAString& aJSON,
|
||||
|
|
|
@ -44,6 +44,7 @@
|
|||
#include "History.h"
|
||||
#include "mozilla/ipc/TestShellParent.h"
|
||||
#include "mozilla/net/NeckoParent.h"
|
||||
#include "mozilla/Preferences.h"
|
||||
#include "nsHashPropertyBag.h"
|
||||
#include "nsIFilePicker.h"
|
||||
#include "nsIWindowWatcher.h"
|
||||
|
@ -111,6 +112,7 @@
|
|||
static NS_DEFINE_CID(kCClipboardCID, NS_CLIPBOARD_CID);
|
||||
static const char* sClipboardTextFlavors[] = { kUnicodeMime };
|
||||
|
||||
using mozilla::Preferences;
|
||||
using namespace mozilla::ipc;
|
||||
using namespace mozilla::net;
|
||||
using namespace mozilla::places;
|
||||
|
@ -154,21 +156,39 @@ MemoryReportRequestParent::~MemoryReportRequestParent()
|
|||
MOZ_COUNT_DTOR(MemoryReportRequestParent);
|
||||
}
|
||||
|
||||
ContentParent* ContentParent::gSingleton;
|
||||
nsTArray<ContentParent*>* ContentParent::gContentParents;
|
||||
|
||||
ContentParent*
|
||||
ContentParent::GetSingleton(PRBool aForceNew)
|
||||
ContentParent::GetNewOrUsed()
|
||||
{
|
||||
if (gSingleton && !gSingleton->IsAlive())
|
||||
gSingleton = nsnull;
|
||||
if (!gContentParents)
|
||||
gContentParents = new nsTArray<ContentParent*>();
|
||||
|
||||
if (!gSingleton && aForceNew) {
|
||||
nsRefPtr<ContentParent> parent = new ContentParent();
|
||||
gSingleton = parent;
|
||||
parent->Init();
|
||||
PRInt32 maxContentProcesses = Preferences::GetInt("dom.ipc.processCount", 1);
|
||||
if (maxContentProcesses < 1)
|
||||
maxContentProcesses = 1;
|
||||
|
||||
if (gContentParents->Length() >= PRUint32(maxContentProcesses)) {
|
||||
ContentParent* p = (*gContentParents)[rand() % gContentParents->Length()];
|
||||
NS_ASSERTION(p->IsAlive(), "Non-alive contentparent in gContentParents?");
|
||||
return p;
|
||||
}
|
||||
|
||||
return gSingleton;
|
||||
nsRefPtr<ContentParent> p = new ContentParent();
|
||||
p->Init();
|
||||
gContentParents->AppendElement(p);
|
||||
return p;
|
||||
}
|
||||
|
||||
void
|
||||
ContentParent::GetAll(nsTArray<ContentParent*>& aArray)
|
||||
{
|
||||
if (!gContentParents) {
|
||||
aArray.Clear();
|
||||
return;
|
||||
}
|
||||
|
||||
aArray = *gContentParents;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -195,7 +215,7 @@ ContentParent::Init()
|
|||
threadInt->SetObserver(this);
|
||||
}
|
||||
if (obs) {
|
||||
obs->NotifyObservers(nsnull, "ipc:content-created", nsnull);
|
||||
obs->NotifyObservers(static_cast<nsIObserver*>(this), "ipc:content-created", nsnull);
|
||||
}
|
||||
|
||||
#ifdef ACCESSIBILITY
|
||||
|
@ -274,6 +294,8 @@ ContentParent::ActorDestroy(ActorDestroyReason why)
|
|||
#endif
|
||||
}
|
||||
|
||||
mMessageManager->Disconnect();
|
||||
|
||||
// clear the child memory reporters
|
||||
InfallibleTArray<MemoryReport> empty;
|
||||
SetChildMemoryReporters(empty);
|
||||
|
@ -295,6 +317,14 @@ ContentParent::ActorDestroy(ActorDestroyReason why)
|
|||
if (mRunToCompletionDepth)
|
||||
mRunToCompletionDepth = 0;
|
||||
|
||||
if (gContentParents) {
|
||||
gContentParents->RemoveElement(this);
|
||||
if (!gContentParents->Length()) {
|
||||
delete gContentParents;
|
||||
gContentParents = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
mIsAlive = false;
|
||||
|
||||
if (obs) {
|
||||
|
@ -362,6 +392,7 @@ ContentParent::ContentParent()
|
|||
, mShouldCallUnblockChild(false)
|
||||
, mIsAlive(true)
|
||||
, mProcessStartTime(time(NULL))
|
||||
, mSendPermissionUpdates(false)
|
||||
{
|
||||
NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
|
||||
mSubprocess = new GeckoChildProcessHost(GeckoProcessType_Content);
|
||||
|
@ -372,6 +403,7 @@ ContentParent::ContentParent()
|
|||
nsChromeRegistryChrome* chromeRegistry =
|
||||
static_cast<nsChromeRegistryChrome*>(registrySvc.get());
|
||||
chromeRegistry->SendRegisteredChrome(this);
|
||||
mMessageManager = nsFrameMessageManager::NewProcessMessageManager(this);
|
||||
}
|
||||
|
||||
ContentParent::~ContentParent()
|
||||
|
@ -380,10 +412,8 @@ ContentParent::~ContentParent()
|
|||
base::CloseProcessHandle(OtherProcess());
|
||||
|
||||
NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
|
||||
//If the previous content process has died, a new one could have
|
||||
//been started since.
|
||||
if (gSingleton == this)
|
||||
gSingleton = nsnull;
|
||||
NS_ASSERTION(!gContentParents || !gContentParents->Contains(this),
|
||||
"Should have been removed in ActorDestroy");
|
||||
}
|
||||
|
||||
bool
|
||||
|
@ -459,7 +489,7 @@ ContentParent::RecvReadPermissions(InfallibleTArray<IPC::Permission>* aPermissio
|
|||
}
|
||||
|
||||
// Ask for future changes
|
||||
permissionManager->ChildRequestPermissions();
|
||||
mSendPermissionUpdates = true;
|
||||
#endif
|
||||
|
||||
return true;
|
||||
|
@ -1083,7 +1113,7 @@ bool
|
|||
ContentParent::RecvSyncMessage(const nsString& aMsg, const nsString& aJSON,
|
||||
InfallibleTArray<nsString>* aRetvals)
|
||||
{
|
||||
nsRefPtr<nsFrameMessageManager> ppm = nsFrameMessageManager::sParentProcessManager;
|
||||
nsRefPtr<nsFrameMessageManager> ppm = mMessageManager;
|
||||
if (ppm) {
|
||||
ppm->ReceiveMessage(static_cast<nsIContentFrameMessageManager*>(ppm.get()),
|
||||
aMsg,PR_TRUE, aJSON, nsnull, aRetvals);
|
||||
|
@ -1094,7 +1124,7 @@ ContentParent::RecvSyncMessage(const nsString& aMsg, const nsString& aJSON,
|
|||
bool
|
||||
ContentParent::RecvAsyncMessage(const nsString& aMsg, const nsString& aJSON)
|
||||
{
|
||||
nsRefPtr<nsFrameMessageManager> ppm = nsFrameMessageManager::sParentProcessManager;
|
||||
nsRefPtr<nsFrameMessageManager> ppm = mMessageManager;
|
||||
if (ppm) {
|
||||
ppm->ReceiveMessage(static_cast<nsIContentFrameMessageManager*>(ppm.get()),
|
||||
aMsg, PR_FALSE, aJSON, nsnull, nsnull);
|
||||
|
|
|
@ -55,6 +55,7 @@
|
|||
#include "nsIMemoryReporter.h"
|
||||
#include "nsCOMArray.h"
|
||||
|
||||
class nsFrameMessageManager;
|
||||
namespace mozilla {
|
||||
|
||||
namespace ipc {
|
||||
|
@ -77,12 +78,8 @@ private:
|
|||
typedef mozilla::ipc::TestShellParent TestShellParent;
|
||||
|
||||
public:
|
||||
static ContentParent* GetSingleton(PRBool aForceNew = PR_TRUE);
|
||||
|
||||
#if 0
|
||||
// TODO: implement this somewhere!
|
||||
static ContentParent* FreeSingleton();
|
||||
#endif
|
||||
static ContentParent* GetNewOrUsed();
|
||||
static void GetAll(nsTArray<ContentParent*>& aArray);
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSIOBSERVER
|
||||
|
@ -102,12 +99,16 @@ public:
|
|||
|
||||
void SetChildMemoryReporters(const InfallibleTArray<MemoryReport>& report);
|
||||
|
||||
bool NeedsPermissionsUpdate() {
|
||||
return mSendPermissionUpdates;
|
||||
}
|
||||
|
||||
protected:
|
||||
void OnChannelConnected(int32 pid);
|
||||
virtual void ActorDestroy(ActorDestroyReason why);
|
||||
|
||||
private:
|
||||
static ContentParent* gSingleton;
|
||||
static nsTArray<ContentParent*>* gContentParents;
|
||||
|
||||
// Hide the raw constructor methods since we don't want client code
|
||||
// using them.
|
||||
|
@ -230,6 +231,10 @@ private:
|
|||
bool mIsAlive;
|
||||
nsCOMPtr<nsIPrefServiceInternal> mPrefService;
|
||||
time_t mProcessStartTime;
|
||||
|
||||
bool mSendPermissionUpdates;
|
||||
|
||||
nsRefPtr<nsFrameMessageManager> mMessageManager;
|
||||
};
|
||||
|
||||
} // namespace dom
|
||||
|
|
|
@ -106,14 +106,37 @@
|
|||
if (!didThrow) {
|
||||
alert("One shouldn't be able to create content process message manager in chrome process!");
|
||||
}
|
||||
var tppm = ppm.QueryInterface(Components.interfaces.nsITreeItemFrameMessageManager);
|
||||
if (tppm.childCount != 1) {
|
||||
alert("Should have one child process!");
|
||||
}
|
||||
var childprocessmm = tppm.getChildAt(0);
|
||||
|
||||
childprocessmm.addMessageListener("ppm-sync",
|
||||
function(m) {
|
||||
if (m.target != childprocessmm) alert("Wrong target!");
|
||||
document.getElementById("messageLog").value += "[SYNC1 PPM]";
|
||||
}
|
||||
);
|
||||
|
||||
ppm.addMessageListener("ppm-sync",
|
||||
function(m) {
|
||||
document.getElementById("messageLog").value += "[SYNC PPM]";
|
||||
// Check that global process message manager gets the per-process mm as target.
|
||||
if (m.target != childprocessmm) alert("Wrong target!");
|
||||
document.getElementById("messageLog").value += "[SYNC2 PPM]";
|
||||
}
|
||||
);
|
||||
childprocessmm.addMessageListener("ppm-async",
|
||||
function(m) {
|
||||
if (m.target != childprocessmm) alert("Wrong target!");
|
||||
document.getElementById("messageLog").value += "[ASYNC1 PPM]";
|
||||
}
|
||||
);
|
||||
ppm.addMessageListener("ppm-async",
|
||||
function(m) {
|
||||
document.getElementById("messageLog").value += "[ASYNC PPM]";
|
||||
// Check that global process message manager gets the per-process mm as target.
|
||||
if (m.target != childprocessmm) alert("Wrong target!");
|
||||
document.getElementById("messageLog").value += "[ASYNC2 PPM]";
|
||||
}
|
||||
);
|
||||
messageManager.loadFrameScript("chrome://global/content/remote-test-ipc.js", true);
|
||||
|
|
|
@ -89,23 +89,6 @@ ChildProcess()
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* @returns The parent process object, or if we are not in the parent
|
||||
* process, nsnull.
|
||||
*/
|
||||
static ContentParent*
|
||||
ParentProcess()
|
||||
{
|
||||
if (!IsChildProcess()) {
|
||||
ContentParent* cpc = ContentParent::GetSingleton();
|
||||
if (!cpc)
|
||||
NS_RUNTIMEABORT("Content Process is NULL!");
|
||||
return cpc;
|
||||
}
|
||||
|
||||
return nsnull;
|
||||
}
|
||||
|
||||
#define ENSURE_NOT_CHILD_PROCESS_(onError) \
|
||||
PR_BEGIN_MACRO \
|
||||
if (IsChildProcess()) { \
|
||||
|
@ -170,7 +153,6 @@ NS_IMPL_ISUPPORTS3(nsPermissionManager, nsIPermissionManager, nsIObserver, nsISu
|
|||
|
||||
nsPermissionManager::nsPermissionManager()
|
||||
: mLargestID(0)
|
||||
, mUpdateChildProcess(PR_FALSE)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -467,12 +449,16 @@ nsPermissionManager::AddInternal(const nsAFlatCString &aHost,
|
|||
DBOperationType aDBOperation)
|
||||
{
|
||||
if (!IsChildProcess()) {
|
||||
// In the parent, send the update now, if the child is ready
|
||||
if (mUpdateChildProcess) {
|
||||
IPC::Permission permission((aHost),
|
||||
(aType),
|
||||
aPermission, aExpireType, aExpireTime);
|
||||
unused << ParentProcess()->SendAddPermission(permission);
|
||||
|
||||
nsTArray<ContentParent*> cplist;
|
||||
ContentParent::GetAll(cplist);
|
||||
for (PRUint32 i = 0; i < cplist.Length(); ++i) {
|
||||
ContentParent* cp = cplist[i];
|
||||
if (cp->NeedsPermissionsUpdate())
|
||||
unused << cp->SendAddPermission(permission);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -250,17 +250,6 @@ private:
|
|||
|
||||
// An array to store the strings identifying the different types.
|
||||
nsTArray<nsCString> mTypeArray;
|
||||
|
||||
// Whether we should update the child process with every change to a
|
||||
// permission. This is set to true once the child is ready to receive
|
||||
// such updates.
|
||||
PRBool mUpdateChildProcess;
|
||||
|
||||
public:
|
||||
void ChildRequestPermissions()
|
||||
{
|
||||
mUpdateChildProcess = PR_TRUE;
|
||||
}
|
||||
};
|
||||
|
||||
// {4F6B5E00-0C36-11d5-A535-0010A401EB10}
|
||||
|
|
|
@ -1482,6 +1482,8 @@ pref("dom.ipc.plugins.enabled.602plugin.so", false);
|
|||
#endif
|
||||
#endif
|
||||
|
||||
pref("dom.ipc.processCount", 1);
|
||||
|
||||
pref("svg.smil.enabled", true);
|
||||
|
||||
pref("font.minimum-size.ar", 0);
|
||||
|
|
|
@ -56,6 +56,7 @@
|
|||
#include "nsThreadUtils.h"
|
||||
#include "nsNetUtil.h"
|
||||
#include "nsIXPConnect.h"
|
||||
#include "mozilla/unused.h"
|
||||
#include "mozilla/Util.h"
|
||||
#include "nsContentUtils.h"
|
||||
|
||||
|
@ -66,6 +67,7 @@
|
|||
#define TOPIC_UPDATEPLACES_COMPLETE "places-updatePlaces-complete"
|
||||
|
||||
using namespace mozilla::dom;
|
||||
using mozilla::unused;
|
||||
|
||||
namespace mozilla {
|
||||
namespace places {
|
||||
|
@ -1288,10 +1290,11 @@ History::NotifyVisited(nsIURI* aURI)
|
|||
nsAutoScriptBlocker scriptBlocker;
|
||||
|
||||
if (XRE_GetProcessType() == GeckoProcessType_Default) {
|
||||
mozilla::dom::ContentParent* cpp =
|
||||
mozilla::dom::ContentParent::GetSingleton(PR_FALSE);
|
||||
if (cpp)
|
||||
(void)cpp->SendNotifyVisited(aURI);
|
||||
nsTArray<ContentParent*> cplist;
|
||||
ContentParent::GetAll(cplist);
|
||||
for (PRUint32 i = 0; i < cplist.Length(); ++i) {
|
||||
unused << cplist[i]->SendNotifyVisited(aURI);
|
||||
}
|
||||
}
|
||||
|
||||
// If the hash table has not been initialized, then we have nothing to notify
|
||||
|
|
|
@ -121,6 +121,9 @@
|
|||
#include "nsAppShellCID.h"
|
||||
|
||||
#include "mozilla/FunctionTimer.h"
|
||||
#include "mozilla/unused.h"
|
||||
|
||||
using mozilla::unused;
|
||||
|
||||
#ifdef XP_WIN
|
||||
#include "nsIWinAppHelper.h"
|
||||
|
@ -751,9 +754,7 @@ nsXULAppInfo::EnsureContentProcess()
|
|||
if (XRE_GetProcessType() != GeckoProcessType_Default)
|
||||
return NS_ERROR_NOT_AVAILABLE;
|
||||
|
||||
ContentParent* c = ContentParent::GetSingleton();
|
||||
if (!c)
|
||||
return NS_ERROR_NOT_AVAILABLE;
|
||||
unused << ContentParent::GetNewOrUsed();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
|
|
@ -712,7 +712,7 @@ TestShellParent* gTestShellParent = nsnull;
|
|||
TestShellParent* GetOrCreateTestShellParent()
|
||||
{
|
||||
if (!gTestShellParent) {
|
||||
ContentParent* parent = ContentParent::GetSingleton();
|
||||
ContentParent* parent = ContentParent::GetNewOrUsed();
|
||||
NS_ENSURE_TRUE(parent, nsnull);
|
||||
gTestShellParent = parent->CreateTestShell();
|
||||
NS_ENSURE_TRUE(gTestShellParent, nsnull);
|
||||
|
@ -758,7 +758,8 @@ XRE_ShutdownTestShell()
|
|||
{
|
||||
if (!gTestShellParent)
|
||||
return true;
|
||||
return ContentParent::GetSingleton()->DestroyTestShell(gTestShellParent);
|
||||
return static_cast<ContentParent*>(gTestShellParent->Manager())->
|
||||
DestroyTestShell(gTestShellParent);
|
||||
}
|
||||
|
||||
#ifdef MOZ_X11
|
||||
|
|
|
@ -95,8 +95,8 @@ class ContentCreationNotifier : public nsIObserver
|
|||
const PRUnichar* aData)
|
||||
{
|
||||
if (!strcmp(aTopic, "ipc:content-created")) {
|
||||
ContentParent *cp = ContentParent::GetSingleton(PR_FALSE);
|
||||
NS_ABORT_IF_FALSE(cp, "Must have content process if notified of its creation");
|
||||
nsCOMPtr<nsIObserver> cpo = do_QueryInterface(aSubject);
|
||||
ContentParent* cp = static_cast<ContentParent*>(cpo.get());
|
||||
unused << cp->SendScreenSizeChanged(gAndroidScreenBounds);
|
||||
} else if (!strcmp(aTopic, "xpcom-shutdown")) {
|
||||
nsCOMPtr<nsIObserverService>
|
||||
|
@ -774,9 +774,10 @@ nsWindow::OnGlobalAndroidEvent(AndroidGeckoEvent *ae)
|
|||
break;
|
||||
|
||||
// Tell the content process the new screen size.
|
||||
ContentParent *cp = ContentParent::GetSingleton(PR_FALSE);
|
||||
if (cp)
|
||||
unused << cp->SendScreenSizeChanged(gAndroidScreenBounds);
|
||||
nsTArray<ContentParent*> cplist;
|
||||
ContentParent::GetAll(cplist);
|
||||
for (PRUint32 i = 0; i < cplist.Length(); ++i)
|
||||
unused << cplist[i]->SendScreenSizeChanged(gAndroidScreenBounds);
|
||||
|
||||
if (gContentCreationNotifier)
|
||||
break;
|
||||
|
|
Загрузка…
Ссылка в новой задаче