Backout 06f6eede6b77 (bug 762221) for crashes

This commit is contained in:
Ed Morley 2012-08-23 10:27:56 +01:00
parent 97efc4771c
commit cb6e92c0d0
6 changed files with 22 additions and 55 deletions

View File

@ -225,8 +225,6 @@ ContentChild::ContentChild()
#ifdef ANDROID
,mScreenSize(0, 0)
#endif
, mIsForApp(false)
, mIsForBrowser(false)
{
// This process is a content process, so it's clearly running in
// multiprocess mode!
@ -922,16 +920,12 @@ ContentChild::RecvAppInfo(const nsCString& version, const nsCString& buildID)
}
bool
ContentChild::RecvSetProcessAttributes(const uint64_t &id,
const bool& aIsForApp,
const bool& aIsForBrowser)
ContentChild::RecvSetID(const uint64_t &id)
{
if (mID != uint64_t(-1)) {
NS_WARNING("Setting content child's ID twice?");
}
mID = id;
mIsForApp = aIsForApp;
mIsForBrowser = aIsForBrowser;
return true;
}

View File

@ -157,9 +157,7 @@ public:
virtual bool RecvCycleCollect();
virtual bool RecvAppInfo(const nsCString& version, const nsCString& buildID);
virtual bool RecvSetProcessAttributes(const uint64_t& id,
const bool& aIsForApp,
const bool& aIsForBrowser);
virtual bool RecvSetID(const uint64_t &id);
virtual bool RecvLastPrivateDocShellDestroyed();
@ -176,9 +174,6 @@ public:
uint64_t GetID() { return mID; }
bool IsForApp() { return mIsForApp; }
bool IsForBrowser() { return mIsForBrowser; }
BlobChild* GetOrCreateActorForBlob(nsIDOMBlob* aBlob);
private:
@ -210,9 +205,6 @@ private:
gfxIntSize mScreenSize;
#endif
bool mIsForApp;
bool mIsForBrowser;
static ContentChild* sSingleton;
DISALLOW_EVIL_CONSTRUCTORS(ContentChild);

View File

@ -186,8 +186,7 @@ ContentParent::PreallocateAppProcess()
}
sPreallocatedAppProcess =
new ContentParent(MAGIC_PREALLOCATED_APP_MANIFEST_URL,
/*isBrowserElement=*/false);
new ContentParent(MAGIC_PREALLOCATED_APP_MANIFEST_URL);
sPreallocatedAppProcess->Init();
}
@ -249,7 +248,7 @@ ContentParent::ShutDown()
}
/*static*/ ContentParent*
ContentParent::GetNewOrUsed(bool aForBrowserElement)
ContentParent::GetNewOrUsed()
{
if (!gNonAppContentParents)
gNonAppContentParents = new nsTArray<ContentParent*>();
@ -266,8 +265,7 @@ ContentParent::GetNewOrUsed(bool aForBrowserElement)
}
nsRefPtr<ContentParent> p =
new ContentParent(/* appManifestURL = */ EmptyString(),
aForBrowserElement);
new ContentParent(/* appManifestURL = */ EmptyString());
p->Init();
gNonAppContentParents->AppendElement(p);
return p;
@ -276,14 +274,8 @@ ContentParent::GetNewOrUsed(bool aForBrowserElement)
/*static*/ TabParent*
ContentParent::CreateBrowser(mozIApplication* aApp, bool aIsBrowserElement)
{
// We currently don't set the <app> ancestor for <browser> content
// correctly. This assertion is to notify the person who fixes
// this code that they need to reevaluate places here where we may
// make bad assumptions based on that bug.
MOZ_ASSERT(!aApp || !aIsBrowserElement);
if (!aApp) {
if (ContentParent* cp = GetNewOrUsed(aIsBrowserElement)) {
if (ContentParent* cp = GetNewOrUsed()) {
nsRefPtr<TabParent> tp(new TabParent(aApp, aIsBrowserElement));
return static_cast<TabParent*>(
cp->SendPBrowserConstructor(
@ -329,7 +321,7 @@ ContentParent::CreateBrowser(mozIApplication* aApp, bool aIsBrowserElement)
p->SetManifestFromPreallocated(manifestURL);
} else {
NS_WARNING("Unable to use pre-allocated app process");
p = new ContentParent(manifestURL, aIsBrowserElement);
p = new ContentParent(manifestURL);
p->Init();
}
gAppContentParents->Put(manifestURL, p);
@ -655,8 +647,7 @@ ContentParent::GetTestShellSingleton()
return static_cast<TestShellParent*>(ManagedPTestShellParent()[0]);
}
ContentParent::ContentParent(const nsAString& aAppManifestURL,
bool aIsForBrowser)
ContentParent::ContentParent(const nsAString& aAppManifestURL)
: mGeolocationWatchID(-1)
, mRunToCompletionDepth(0)
, mShouldCallUnblockChild(false)
@ -680,8 +671,7 @@ ContentParent::ContentParent(const nsAString& aAppManifestURL,
mSubprocess->AsyncLaunch();
}
Open(mSubprocess->GetChannel(), mSubprocess->GetChildProcessHandle());
unused << SendSetProcessAttributes(gContentChildID++,
IsForApp(), aIsForBrowser);
unused << SendSetID(gContentChildID++);
// NB: internally, this will send an IPC message to the child
// process to get it to create the CompositorChild. This

View File

@ -65,7 +65,7 @@ public:
/** Shut down the content-process machinery. */
static void ShutDown();
static ContentParent* GetNewOrUsed(bool aForBrowserElement = false);
static ContentParent* GetNewOrUsed();
/**
* Get or create a content process for the given app descriptor,
@ -129,7 +129,7 @@ private:
using PContentParent::SendPBrowserConstructor;
using PContentParent::SendPTestShellConstructor;
ContentParent(const nsAString& aAppManifestURL, bool aIsForBrowser);
ContentParent(const nsAString& aAppManifestURL);
virtual ~ContentParent();
void Init();

View File

@ -192,17 +192,6 @@ child:
PTestShell();
/**
* Tell the content process some attributes of itself. This is
* the first message received by content processes after startup.
*
* |id| is a unique ID among all subprocesses. When |isForApp &&
* isForBrowser|, we're loading <browser> for an app. When
* |isForBrowser|, we're loading <browser>. When |!isForApp &&
* !isForBrowser|, we're probably loading <xul:browser remote>.
*/
SetProcessAttributes(uint64_t id, bool isForApp, bool isForBrowser);
RegisterChrome(ChromePackage[] packages, ResourceMapping[] resources,
OverrideMapping[] overrides, nsCString locale);
@ -233,6 +222,8 @@ child:
AppInfo(nsCString version, nsCString buildID);
SetID(uint64_t id);
// Notify child that last-pb-context-exited notification was observed
LastPrivateDocShellDestroyed();

View File

@ -3,14 +3,11 @@
* 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/. */
#include "base/basictypes.h"
#include "gfxAndroidPlatform.h"
#include "mozilla/gfx/2D.h"
#include "gfxFT2FontList.h"
#include "gfxImageSurface.h"
#include "mozilla/dom/ContentChild.h"
#include "nsXULAppAPI.h"
#include "nsIScreen.h"
#include "nsIScreenManager.h"
@ -20,7 +17,6 @@
#include "ft2build.h"
#include FT_FREETYPE_H
using namespace mozilla;
using namespace mozilla::dom;
using namespace mozilla::gfx;
static FT_Library gPlatformFTLibrary = NULL;
@ -194,11 +190,15 @@ gfxAndroidPlatform::FontHintingEnabled()
// want to re-enable hinting.
return false;
#else
// Otherwise, enable hinting unless we're in a content process
// that might be used for non-reflowing zoom.
return (XRE_GetProcessType() != GeckoProcessType_Content ||
(ContentChild::GetSingleton()->IsForApp() &&
!ContentChild::GetSingleton()->IsForBrowser()));
// Otherwise, if we're in a content process, assume we don't want
// hinting.
//
// XXX when we use content processes to load "apps", we'll want to
// configure this dynamically based on whether we're an "app
// content process" or a "browser content process". The former
// wants hinting, the latter doesn't since it might be
// non-reflow-zoomed.
return (XRE_GetProcessType() != GeckoProcessType_Content);
#endif // MOZ_USING_ANDROID_JAVA_WIDGETS
}