Backed out 2 changesets (bug 838616) for bustage. a=backout

This commit is contained in:
Ryan VanderMeulen 2013-02-12 12:38:15 -05:00
Родитель 1b5b9e173e
Коммит 547562d6a5
2 изменённых файлов: 8 добавлений и 39 удалений

Просмотреть файл

@ -234,26 +234,10 @@ ContentParent::ScheduleDelayedPreallocateAppProcess()
}
/*static*/ already_AddRefed<ContentParent>
ContentParent::MaybeTakePreallocatedAppProcess(const nsAString& aAppManifestURL,
ChildPrivileges aPrivs)
ContentParent::MaybeTakePreallocatedAppProcess()
{
nsRefPtr<ContentParent> process = sPreallocatedAppProcess.get();
sPreallocatedAppProcess = nullptr;
if (!process) {
return nullptr;
}
if (!process->TransformPreallocatedIntoApp(aAppManifestURL, aPrivs)) {
NS_WARNING("Can't TransformPrealocatedIntoApp. Maybe "
"the preallocated process died?");
// Kill the process just in case it's not actually dead; we don't want
// to "leak" this process!
process->KillHard();
return nullptr;
}
return process.forget();
}
@ -442,8 +426,10 @@ ContentParent::CreateBrowserOrApp(const TabContext& aContext)
nsRefPtr<ContentParent> p = gAppContentParents->Get(manifestURL);
if (!p) {
ChildPrivileges privs = PrivilegesForApp(ownApp);
p = MaybeTakePreallocatedAppProcess(manifestURL, privs);
if (!p) {
p = MaybeTakePreallocatedAppProcess();
if (p) {
p->TransformPreallocatedIntoApp(manifestURL, privs);
} else {
NS_WARNING("Unable to use pre-allocated app process");
p = new ContentParent(manifestURL, /* isBrowserElement = */ false,
privs);
@ -529,7 +515,7 @@ ContentParent::Init()
NS_ASSERTION(observer, "FileUpdateDispatcher is null");
}
bool
void
ContentParent::TransformPreallocatedIntoApp(const nsAString& aAppManifestURL,
ChildPrivileges aPrivs)
{
@ -537,18 +523,8 @@ ContentParent::TransformPreallocatedIntoApp(const nsAString& aAppManifestURL,
// Clients should think of mAppManifestURL as const ... we're
// bending the rules here just for the preallocation hack.
const_cast<nsString&>(mAppManifestURL) = aAppManifestURL;
// Boost this process's priority. The subprocess will call
// TemporarilySetProcessPriorityToForeground() from within
// ContentChild::AllocPBrowser, but this happens earlier, thus reducing the
// window in which the child might be killed due to low memory.
if (Preferences::GetBool("dom.ipc.processPriorityManager.enabled")) {
SetProcessPriority(base::GetProcId(mSubprocess->GetChildProcessHandle()),
PROCESS_PRIORITY_FOREGROUND);
}
// If this fails, the child process died.
return SendSetProcessPrivileges(aPrivs);
unused << SendSetProcessPrivileges(aPrivs);
}
void

Просмотреть файл

@ -162,14 +162,7 @@ private:
static void PreallocateAppProcess();
static void DelayedPreallocateAppProcess();
static void ScheduleDelayedPreallocateAppProcess();
// 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,
ChildPrivileges aPrivs);
static already_AddRefed<ContentParent> MaybeTakePreallocatedAppProcess();
static void FirstIdle();
// Hide the raw constructor methods since we don't want client code