mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-10 03:45:46 +00:00
Backed out changeset 21619c674c86 (bug 1348361) for failing mochitest test_group_zoom.html on Android and robocop tests. r=backout
This commit is contained in:
parent
2aac283f14
commit
aaeaf6ba8a
@ -1513,13 +1513,14 @@ ContentParent::MarkAsDead()
|
||||
void
|
||||
ContentParent::OnChannelError()
|
||||
{
|
||||
RefPtr<ContentParent> content(this);
|
||||
PContentParent::OnChannelError();
|
||||
}
|
||||
|
||||
void
|
||||
ContentParent::OnChannelConnected(int32_t pid)
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
SetOtherProcessId(pid);
|
||||
|
||||
#if defined(ANDROID) || defined(LINUX)
|
||||
// Check nice preference
|
||||
@ -1544,11 +1545,6 @@ ContentParent::OnChannelConnected(int32_t pid)
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef MOZ_CODE_COVERAGE
|
||||
Unused << SendShareCodeCoverageMutex(
|
||||
CodeCoverageHandler::Get()->GetMutexHandle(pid));
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
@ -2042,14 +2038,22 @@ ContentParent::LaunchSubprocess(ProcessPriority aInitialPriority /* = PROCESS_PR
|
||||
extraArgs.push_back("-safeMode");
|
||||
}
|
||||
|
||||
if (!mSubprocess->Launch(extraArgs)) {
|
||||
if (!mSubprocess->LaunchAndWaitForProcessHandle(extraArgs)) {
|
||||
MarkAsDead();
|
||||
return false;
|
||||
}
|
||||
|
||||
OpenWithAsyncPid(mSubprocess->GetChannel());
|
||||
base::ProcessId procId = base::GetProcId(mSubprocess->GetChildProcessHandle());
|
||||
|
||||
InitInternal(aInitialPriority);
|
||||
Open(mSubprocess->GetChannel(), procId);
|
||||
|
||||
#ifdef MOZ_CODE_COVERAGE
|
||||
Unused << SendShareCodeCoverageMutex(CodeCoverageHandler::Get()->GetMutexHandle(procId));
|
||||
#endif
|
||||
|
||||
InitInternal(aInitialPriority,
|
||||
true, /* Setup off-main thread compositing */
|
||||
true /* Send registered chrome */);
|
||||
|
||||
ContentProcessManager::GetSingleton()->AddContentProcess(this);
|
||||
|
||||
@ -2119,7 +2123,7 @@ ContentParent::ContentParent(ContentParent* aOpener,
|
||||
ChildPrivileges privs = mRemoteType.EqualsLiteral(FILE_REMOTE_TYPE)
|
||||
? base::PRIVILEGES_FILEREAD
|
||||
: base::PRIVILEGES_DEFAULT;
|
||||
mSubprocess = new ContentProcessHost(this, privs);
|
||||
mSubprocess = new GeckoChildProcessHost(GeckoProcessType_Content, privs);
|
||||
}
|
||||
|
||||
ContentParent::~ContentParent()
|
||||
@ -2143,7 +2147,9 @@ ContentParent::~ContentParent()
|
||||
}
|
||||
|
||||
void
|
||||
ContentParent::InitInternal(ProcessPriority aPriority)
|
||||
ContentParent::InitInternal(ProcessPriority aInitialPriority,
|
||||
bool aSetupOffMainThreadCompositing,
|
||||
bool aSendRegisteredChrome)
|
||||
{
|
||||
Telemetry::Accumulate(Telemetry::CONTENT_PROCESS_LAUNCH_TIME_MS,
|
||||
static_cast<uint32_t>((TimeStamp::Now() - mLaunchTS)
|
||||
@ -2259,10 +2265,12 @@ ContentParent::InitInternal(ProcessPriority aPriority)
|
||||
|
||||
Unused << SendSetXPCOMProcessAttributes(xpcomInit, initialData, lnfCache);
|
||||
|
||||
nsCOMPtr<nsIChromeRegistry> registrySvc = nsChromeRegistry::GetService();
|
||||
nsChromeRegistryChrome* chromeRegistry =
|
||||
static_cast<nsChromeRegistryChrome*>(registrySvc.get());
|
||||
chromeRegistry->SendRegisteredChrome(this);
|
||||
if (aSendRegisteredChrome) {
|
||||
nsCOMPtr<nsIChromeRegistry> registrySvc = nsChromeRegistry::GetService();
|
||||
nsChromeRegistryChrome* chromeRegistry =
|
||||
static_cast<nsChromeRegistryChrome*>(registrySvc.get());
|
||||
chromeRegistry->SendRegisteredChrome(this);
|
||||
}
|
||||
|
||||
if (gAppData) {
|
||||
nsCString version(gAppData->version);
|
||||
@ -2293,43 +2301,45 @@ ContentParent::InitInternal(ProcessPriority aPriority)
|
||||
//
|
||||
// This call can cause us to send IPC messages to the child process, so it
|
||||
// must come after the Open() call above.
|
||||
ProcessPriorityManager::SetProcessPriority(this, aPriority);
|
||||
ProcessPriorityManager::SetProcessPriority(this, aInitialPriority);
|
||||
|
||||
// NB: internally, this will send an IPC message to the child
|
||||
// process to get it to create the CompositorBridgeChild. This
|
||||
// message goes through the regular IPC queue for this
|
||||
// channel, so delivery will happen-before any other messages
|
||||
// we send. The CompositorBridgeChild must be created before any
|
||||
// PBrowsers are created, because they rely on the Compositor
|
||||
// already being around. (Creation is async, so can't happen
|
||||
// on demand.)
|
||||
bool useOffMainThreadCompositing = !!CompositorThreadHolder::Loop();
|
||||
if (useOffMainThreadCompositing) {
|
||||
GPUProcessManager* gpm = GPUProcessManager::Get();
|
||||
if (aSetupOffMainThreadCompositing) {
|
||||
// NB: internally, this will send an IPC message to the child
|
||||
// process to get it to create the CompositorBridgeChild. This
|
||||
// message goes through the regular IPC queue for this
|
||||
// channel, so delivery will happen-before any other messages
|
||||
// we send. The CompositorBridgeChild must be created before any
|
||||
// PBrowsers are created, because they rely on the Compositor
|
||||
// already being around. (Creation is async, so can't happen
|
||||
// on demand.)
|
||||
bool useOffMainThreadCompositing = !!CompositorThreadHolder::Loop();
|
||||
if (useOffMainThreadCompositing) {
|
||||
GPUProcessManager* gpm = GPUProcessManager::Get();
|
||||
|
||||
Endpoint<PCompositorManagerChild> compositor;
|
||||
Endpoint<PImageBridgeChild> imageBridge;
|
||||
Endpoint<PVRManagerChild> vrBridge;
|
||||
Endpoint<PVideoDecoderManagerChild> videoManager;
|
||||
AutoTArray<uint32_t, 3> namespaces;
|
||||
Endpoint<PCompositorManagerChild> compositor;
|
||||
Endpoint<PImageBridgeChild> imageBridge;
|
||||
Endpoint<PVRManagerChild> vrBridge;
|
||||
Endpoint<PVideoDecoderManagerChild> videoManager;
|
||||
AutoTArray<uint32_t, 3> namespaces;
|
||||
|
||||
DebugOnly<bool> opened = gpm->CreateContentBridges(
|
||||
OtherPid(),
|
||||
&compositor,
|
||||
&imageBridge,
|
||||
&vrBridge,
|
||||
&videoManager,
|
||||
&namespaces);
|
||||
MOZ_ASSERT(opened);
|
||||
DebugOnly<bool> opened = gpm->CreateContentBridges(
|
||||
OtherPid(),
|
||||
&compositor,
|
||||
&imageBridge,
|
||||
&vrBridge,
|
||||
&videoManager,
|
||||
&namespaces);
|
||||
MOZ_ASSERT(opened);
|
||||
|
||||
Unused << SendInitRendering(
|
||||
Move(compositor),
|
||||
Move(imageBridge),
|
||||
Move(vrBridge),
|
||||
Move(videoManager),
|
||||
namespaces);
|
||||
Unused << SendInitRendering(
|
||||
Move(compositor),
|
||||
Move(imageBridge),
|
||||
Move(vrBridge),
|
||||
Move(videoManager),
|
||||
namespaces);
|
||||
|
||||
gpm->AddListener(this);
|
||||
gpm->AddListener(this);
|
||||
}
|
||||
}
|
||||
|
||||
nsStyleSheetService *sheetService = nsStyleSheetService::GetInstance();
|
||||
|
@ -12,6 +12,7 @@
|
||||
#include "mozilla/gfx/gfxVarReceiver.h"
|
||||
#include "mozilla/gfx/GPUProcessListener.h"
|
||||
#include "mozilla/ipc/CrashReporterHost.h"
|
||||
#include "mozilla/ipc/GeckoChildProcessHost.h"
|
||||
#include "mozilla/Attributes.h"
|
||||
#include "mozilla/FileUtils.h"
|
||||
#include "mozilla/HalTypes.h"
|
||||
@ -21,7 +22,6 @@
|
||||
#include "mozilla/TimeStamp.h"
|
||||
#include "mozilla/UniquePtr.h"
|
||||
|
||||
#include "ContentProcessHost.h"
|
||||
#include "nsDataHashtable.h"
|
||||
#include "nsPluginTags.h"
|
||||
#include "nsFrameMessageManager.h"
|
||||
@ -116,6 +116,7 @@ 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;
|
||||
@ -123,7 +124,6 @@ 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;
|
||||
}
|
||||
|
||||
ContentProcessHost* Process() const
|
||||
GeckoChildProcessHost* Process() const
|
||||
{
|
||||
return mSubprocess;
|
||||
}
|
||||
@ -718,7 +718,9 @@ private:
|
||||
bool LaunchSubprocess(hal::ProcessPriority aInitialPriority = hal::PROCESS_PRIORITY_FOREGROUND);
|
||||
|
||||
// Common initialization after sub process launch or adoption.
|
||||
void InitInternal(ProcessPriority aPriority);
|
||||
void InitInternal(ProcessPriority aPriority,
|
||||
bool aSetupOffMainThreadCompositing,
|
||||
bool aSendRegisteredChrome);
|
||||
|
||||
virtual ~ContentParent();
|
||||
|
||||
@ -1183,7 +1185,7 @@ private:
|
||||
// release these objects in ShutDownProcess. See the comment there for more
|
||||
// details.
|
||||
|
||||
ContentProcessHost* mSubprocess;
|
||||
GeckoChildProcessHost* mSubprocess;
|
||||
const TimeStamp mLaunchTS; // used to calculate time to start content process
|
||||
TimeStamp mActivateTS;
|
||||
ContentParent* mOpener;
|
||||
|
@ -1,64 +0,0 @@
|
||||
/* -*- 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,
|
||||
ChildPrivileges aPrivileges)
|
||||
: GeckoChildProcessHost(GeckoProcessType_Content, aPrivileges),
|
||||
mHasLaunched(false),
|
||||
mContentParent(aContentParent)
|
||||
{
|
||||
MOZ_COUNT_CTOR(ContentProcessHost);
|
||||
}
|
||||
|
||||
ContentProcessHost::~ContentProcessHost()
|
||||
{
|
||||
MOZ_COUNT_DTOR(ContentProcessHost);
|
||||
}
|
||||
|
||||
bool
|
||||
ContentProcessHost::Launch(StringVector aExtraOpts)
|
||||
{
|
||||
MOZ_ASSERT(!mHasLaunched);
|
||||
MOZ_ASSERT(mContentParent);
|
||||
|
||||
if (!GeckoChildProcessHost::AsyncLaunch(aExtraOpts)) {
|
||||
mHasLaunched = true;
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void
|
||||
ContentProcessHost::OnChannelConnected(int32_t aPid)
|
||||
{
|
||||
MOZ_ASSERT(!NS_IsMainThread());
|
||||
|
||||
// This will wake up the main thread if it is waiting for the process to
|
||||
// launch.
|
||||
mContentParent->SetOtherProcessId(aPid);
|
||||
|
||||
mHasLaunched = true;
|
||||
GeckoChildProcessHost::OnChannelConnected(aPid);
|
||||
}
|
||||
|
||||
void
|
||||
ContentProcessHost::OnChannelError()
|
||||
{
|
||||
MOZ_ASSERT(!NS_IsMainThread());
|
||||
|
||||
mHasLaunched = true;
|
||||
GeckoChildProcessHost::OnChannelError();
|
||||
}
|
||||
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
@ -1,51 +0,0 @@
|
||||
/* -*- 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,
|
||||
ChildPrivileges aPrivileges=base::PRIVILEGES_DEFAULT);
|
||||
~ContentProcessHost();
|
||||
|
||||
// Launch the subprocess asynchronously. On failure, false is returned.
|
||||
// Otherwise, true is returned, and the OnLaunchComplete listener callback
|
||||
// will be invoked either when a connection has been established, or if a
|
||||
// connection could not be established due to an asynchronous error.
|
||||
bool Launch(StringVector aExtraOpts);
|
||||
|
||||
// Called on the IO thread.
|
||||
void OnChannelConnected(int32_t aPid) override;
|
||||
void OnChannelError() override;
|
||||
|
||||
private:
|
||||
DISALLOW_COPY_AND_ASSIGN(ContentProcessHost);
|
||||
|
||||
bool mHasLaunched;
|
||||
|
||||
ContentParent* mContentParent; // weak
|
||||
};
|
||||
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
|
||||
#endif // _include_mozilla_dom_ipc_ContentProcessHost_h_
|
@ -26,7 +26,6 @@ EXPORTS.mozilla.dom += [
|
||||
'ContentParent.h',
|
||||
'ContentPrefs.h',
|
||||
'ContentProcess.h',
|
||||
'ContentProcessHost.h',
|
||||
'ContentProcessManager.h',
|
||||
'CPOWManagerGetter.h',
|
||||
'FilePickerParent.h',
|
||||
@ -58,7 +57,6 @@ UNIFIED_SOURCES += [
|
||||
'ContentParent.cpp',
|
||||
'ContentPrefs.cpp',
|
||||
'ContentProcess.cpp',
|
||||
'ContentProcessHost.cpp',
|
||||
'ContentProcessManager.cpp',
|
||||
'FilePickerParent.cpp',
|
||||
'MemoryReportRequest.cpp',
|
||||
|
@ -589,10 +589,8 @@ IProtocol::GetActorEventTargetInternal(IProtocol* aActor)
|
||||
|
||||
IToplevelProtocol::IToplevelProtocol(ProtocolId aProtoId, Side aSide)
|
||||
: IProtocol(aSide),
|
||||
mMonitor("mozilla.ipc.IToplevelProtocol.mMonitor"),
|
||||
mProtocolId(aProtoId),
|
||||
mOtherPid(mozilla::ipc::kInvalidProcessId),
|
||||
mOtherPidState(ProcessIdState::eUndefined),
|
||||
mLastRouteId(aSide == ParentSide ? kFreedActorId : kNullActorId),
|
||||
mLastShmemId(aSide == ParentSide ? kFreedActorId : kNullActorId),
|
||||
mEventTargetMutex("ProtocolEventTargetMutex")
|
||||
@ -610,23 +608,13 @@ IToplevelProtocol::~IToplevelProtocol()
|
||||
base::ProcessId
|
||||
IToplevelProtocol::OtherPid() const
|
||||
{
|
||||
MonitorAutoLock lock(mMonitor);
|
||||
while (mOtherPidState < ProcessIdState::eReady) {
|
||||
lock.Wait();
|
||||
}
|
||||
MOZ_ASSERT(mOtherPidState == ProcessIdState::eReady);
|
||||
|
||||
return mOtherPid;
|
||||
}
|
||||
|
||||
void
|
||||
IToplevelProtocol::SetOtherProcessId(base::ProcessId aOtherPid,
|
||||
ProcessIdState aState)
|
||||
IToplevelProtocol::SetOtherProcessId(base::ProcessId aOtherPid)
|
||||
{
|
||||
MonitorAutoLock lock(mMonitor);
|
||||
mOtherPid = aOtherPid;
|
||||
mOtherPidState = aState;
|
||||
lock.NotifyAll();
|
||||
}
|
||||
|
||||
bool
|
||||
@ -668,15 +656,6 @@ IToplevelProtocol::Open(MessageChannel* aChannel,
|
||||
return GetIPCChannel()->Open(aChannel, aEventTarget, aSide);
|
||||
}
|
||||
|
||||
bool
|
||||
IToplevelProtocol::OpenWithAsyncPid(mozilla::ipc::Transport* aTransport,
|
||||
MessageLoop* aThread,
|
||||
mozilla::ipc::Side aSide)
|
||||
{
|
||||
SetOtherProcessId(0, ProcessIdState::ePending);
|
||||
return GetIPCChannel()->Open(aTransport, aThread, aSide);
|
||||
}
|
||||
|
||||
void
|
||||
IToplevelProtocol::Close()
|
||||
{
|
||||
|
@ -24,7 +24,6 @@
|
||||
#include "mozilla/ipc/MessageLink.h"
|
||||
#include "mozilla/LinkedList.h"
|
||||
#include "mozilla/Maybe.h"
|
||||
#include "mozilla/Monitor.h"
|
||||
#include "mozilla/MozPromise.h"
|
||||
#include "mozilla/Mutex.h"
|
||||
#include "mozilla/NotNull.h"
|
||||
@ -262,12 +261,6 @@ class IToplevelProtocol : public IProtocol
|
||||
{
|
||||
template<class PFooSide> friend class Endpoint;
|
||||
|
||||
enum ProcessIdState {
|
||||
eUndefined,
|
||||
ePending,
|
||||
eReady
|
||||
};
|
||||
|
||||
protected:
|
||||
explicit IToplevelProtocol(ProtocolId aProtoId, Side aSide);
|
||||
~IToplevelProtocol();
|
||||
@ -283,8 +276,7 @@ public:
|
||||
ProtocolId GetProtocolId() const { return mProtocolId; }
|
||||
|
||||
base::ProcessId OtherPid() const;
|
||||
void SetOtherProcessId(base::ProcessId aOtherPid,
|
||||
ProcessIdState aState = ProcessIdState::eReady);
|
||||
void SetOtherProcessId(base::ProcessId aOtherPid);
|
||||
|
||||
bool TakeMinidump(nsIFile** aDump, uint32_t* aSequence);
|
||||
|
||||
@ -306,10 +298,6 @@ public:
|
||||
nsIEventTarget* aEventTarget,
|
||||
mozilla::ipc::Side aSide = mozilla::ipc::UnknownSide);
|
||||
|
||||
bool OpenWithAsyncPid(mozilla::ipc::Transport* aTransport,
|
||||
MessageLoop* aThread = nullptr,
|
||||
mozilla::ipc::Side aSide = mozilla::ipc::UnknownSide);
|
||||
|
||||
void Close();
|
||||
|
||||
void SetReplyTimeoutMs(int32_t aTimeoutMs);
|
||||
@ -426,14 +414,10 @@ protected:
|
||||
virtual already_AddRefed<nsIEventTarget>
|
||||
GetActorEventTargetInternal(IProtocol* aActor);
|
||||
|
||||
// This monitor protects mOtherPid and mOtherPidState. All other fields
|
||||
// should only be accessed on the worker thread.
|
||||
mutable mozilla::Monitor mMonitor;
|
||||
private:
|
||||
ProtocolId mProtocolId;
|
||||
UniquePtr<Transport> mTrans;
|
||||
base::ProcessId mOtherPid;
|
||||
ProcessIdState mOtherPidState;
|
||||
IDMap<IProtocol*> mActorMap;
|
||||
int32_t mLastRouteId;
|
||||
IDMap<Shmem::SharedMemory*> mShmemMap;
|
||||
|
Loading…
Reference in New Issue
Block a user