Bug 1348361 - Part 2 - Introduce a GeckoChildProcessHost subclass, ContentProcessHost, that will be used for async process launches; r=jld

MozReview-Commit-ID: OgV5fcZM8m

--HG--
extra : rebase_source : 717f37bdc004480ef1dc90cc565324766e5b7b09
This commit is contained in:
Alex Gaynor 2018-02-22 14:29:49 -05:00
Родитель 911eab5d61
Коммит fc6d4621a1
5 изменённых файлов: 77 добавлений и 5 удалений

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

@ -2141,7 +2141,7 @@ ContentParent::ContentParent(ContentParent* aOpener,
NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
bool isFile = mRemoteType.EqualsLiteral(FILE_REMOTE_TYPE);
mSubprocess = new GeckoChildProcessHost(GeckoProcessType_Content, isFile);
mSubprocess = new ContentProcessHost(this, isFile);
}
ContentParent::~ContentParent()

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

@ -11,7 +11,6 @@
#include "mozilla/dom/nsIContentParent.h"
#include "mozilla/gfx/gfxVarReceiver.h"
#include "mozilla/gfx/GPUProcessListener.h"
#include "mozilla/ipc/GeckoChildProcessHost.h"
#include "mozilla/Attributes.h"
#include "mozilla/FileUtils.h"
#include "mozilla/HalTypes.h"
@ -21,6 +20,7 @@
#include "mozilla/TimeStamp.h"
#include "mozilla/UniquePtr.h"
#include "ContentProcessHost.h"
#include "nsDataHashtable.h"
#include "nsPluginTags.h"
#include "nsFrameMessageManager.h"
@ -114,7 +114,6 @@ class ContentParent final : public PContentParent
, public gfx::GPUProcessListener
, public mozilla::MemoryReportingProcess
{
typedef mozilla::ipc::GeckoChildProcessHost GeckoChildProcessHost;
typedef mozilla::ipc::OptionalURIParams OptionalURIParams;
typedef mozilla::ipc::PFileDescriptorSetParent PFileDescriptorSetParent;
typedef mozilla::ipc::TestShellParent TestShellParent;
@ -122,6 +121,7 @@ class ContentParent final : public PContentParent
typedef mozilla::ipc::PrincipalInfo PrincipalInfo;
typedef mozilla::dom::ClonedMessageData ClonedMessageData;
friend class ContentProcessHost;
friend class mozilla::PreallocatedProcessManagerImpl;
public:
@ -375,7 +375,7 @@ public:
return mJSPluginID != nsFakePluginTag::NOT_JSPLUGIN;
}
GeckoChildProcessHost* Process() const
ContentProcessHost* Process() const
{
return mSubprocess;
}
@ -1232,7 +1232,7 @@ private:
// release these objects in ShutDownProcess. See the comment there for more
// details.
GeckoChildProcessHost* mSubprocess;
ContentProcessHost* mSubprocess;
const TimeStamp mLaunchTS; // used to calculate time to start content process
TimeStamp mActivateTS;
ContentParent* mOpener;

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

@ -0,0 +1,29 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
* vim: sts=8 sw=2 ts=2 tw=99 et :
* 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/. */
#include "ContentProcessHost.h"
namespace mozilla {
namespace dom {
using namespace ipc;
ContentProcessHost::ContentProcessHost(ContentParent* aContentParent,
bool aIsFileContent)
: GeckoChildProcessHost(GeckoProcessType_Content, aIsFileContent),
mHasLaunched(false),
mContentParent(aContentParent)
{
MOZ_COUNT_CTOR(ContentProcessHost);
}
ContentProcessHost::~ContentProcessHost()
{
MOZ_COUNT_DTOR(ContentProcessHost);
}
} // namespace dom
} // namespace mozilla

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

@ -0,0 +1,41 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
* vim: sts=8 sw=2 ts=2 tw=99 et :
* 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/. */
#ifndef _include_mozilla_dom_ipc_ContentProcessHost_h_
#define _include_mozilla_dom_ipc_ContentProcessHost_h_
#include "mozilla/ipc/GeckoChildProcessHost.h"
namespace mozilla {
namespace dom {
class ContentParent;
// ContentProcessHost is the "parent process" container for a subprocess handle
// and IPC connection. It owns the parent process IPDL actor, which in this
// case, is a ContentParent.
class ContentProcessHost final : public ::mozilla::ipc::GeckoChildProcessHost
{
friend class ContentParent;
public:
explicit
ContentProcessHost(ContentParent* aContentParent,
bool aIsFileContent = false);
~ContentProcessHost();
private:
DISALLOW_COPY_AND_ASSIGN(ContentProcessHost);
bool mHasLaunched;
ContentParent* mContentParent; // weak
};
} // namespace dom
} // namespace mozilla
#endif // _include_mozilla_dom_ipc_ContentProcessHost_h_

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

@ -28,6 +28,7 @@ EXPORTS.mozilla.dom += [
'ContentParent.h',
'ContentPrefs.h',
'ContentProcess.h',
'ContentProcessHost.h',
'ContentProcessManager.h',
'CPOWManagerGetter.h',
'FilePickerParent.h',
@ -60,6 +61,7 @@ UNIFIED_SOURCES += [
'ContentParent.cpp',
'ContentPrefs.cpp',
'ContentProcess.cpp',
'ContentProcessHost.cpp',
'ContentProcessManager.cpp',
'FilePickerParent.cpp',
'MemoryReportRequest.cpp',