Bug 1561178 - Initialize gfxVars in the RDD process. r=jya

Differential Revision: https://phabricator.services.mozilla.com/D36001

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Matt Woodrow 2019-06-28 07:08:43 +00:00
Родитель f07980eb66
Коммит 89a62c3ee9
5 изменённых файлов: 40 добавлений и 5 удалений

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

@ -3,6 +3,7 @@
* 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 GraphicsMessages;
include MemoryReportTypes;
include PrefsTypes;
@ -22,7 +23,9 @@ protocol PRDD
{
parent:
async Init(FileDescriptor? sandboxBroker, bool startMacSandbox);
async Init(GfxVarUpdate[] vars,
FileDescriptor? sandboxBroker,
bool startMacSandbox);
async InitProfiler(Endpoint<PProfilerChild> endpoint);
@ -36,6 +39,8 @@ parent:
async PreferenceUpdate(Pref pref);
async UpdateVar(GfxVarUpdate var);
async CreateVideoBridgeToParentProcess(Endpoint<PVideoBridgeChild> endpoint);
child:

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

@ -7,6 +7,7 @@
#include "mozilla/dom/MemoryReportRequest.h"
#include "mozilla/ipc/CrashReporterHost.h"
#include "mozilla/gfx/gfxVars.h"
#if defined(XP_LINUX) && defined(MOZ_SANDBOX)
# include "mozilla/SandboxBroker.h"
@ -21,6 +22,7 @@
namespace mozilla {
using namespace layers;
using namespace gfx;
RDDChild::RDDChild(RDDProcessHost* aHost) : mHost(aHost), mRDDReady(false) {
MOZ_COUNT_CTOR(RDDChild);
@ -46,12 +48,16 @@ bool RDDChild::Init(bool aStartMacSandbox) {
}
#endif // XP_LINUX && MOZ_SANDBOX
SendInit(brokerFd, aStartMacSandbox);
nsTArray<GfxVarUpdate> updates = gfxVars::FetchNonDefaultVars();
SendInit(updates, brokerFd, aStartMacSandbox);
#ifdef MOZ_GECKO_PROFILER
Unused << SendInitProfiler(ProfilerParent::CreateForProcess(OtherPid()));
#endif
gfxVars::AddReceiver(this);
return true;
}
@ -92,6 +98,8 @@ bool RDDChild::SendRequestMemoryReport(const uint32_t& aGeneration,
return true;
}
void RDDChild::OnVarChanged(const GfxVarUpdate& aVar) { SendUpdateVar(aVar); }
mozilla::ipc::IPCResult RDDChild::RecvAddMemoryReport(
const MemoryReport& aReport) {
if (mMemoryReportRequest) {
@ -117,6 +125,7 @@ void RDDChild::ActorDestroy(ActorDestroyReason aWhy) {
}
}
gfxVars::RemoveReceiver(this);
mHost->OnChannelClosed();
}

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

@ -9,6 +9,7 @@
#include "mozilla/RefPtr.h"
#include "mozilla/UniquePtr.h"
#include "mozilla/gfx/gfxVarReceiver.h"
namespace mozilla {
@ -25,7 +26,7 @@ class MemoryReportRequestHost;
class RDDProcessHost;
class RDDChild final : public PRDDChild {
class RDDChild final : public PRDDChild, public gfx::gfxVarReceiver {
typedef mozilla::dom::MemoryReportRequestHost MemoryReportRequestHost;
public:
@ -36,6 +37,8 @@ class RDDChild final : public PRDDChild {
bool EnsureRDDReady();
void OnVarChanged(const GfxVarUpdate& aVar) override;
// PRDDChild overrides.
mozilla::ipc::IPCResult RecvInitComplete();
mozilla::ipc::IPCResult RecvInitCrashReporter(

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

@ -18,6 +18,7 @@
#include "mozilla/dom/MemoryReportRequest.h"
#include "mozilla/ipc/CrashReporterClient.h"
#include "mozilla/ipc/ProcessChild.h"
#include "mozilla/gfx/gfxVars.h"
#if defined(XP_LINUX) && defined(MOZ_SANDBOX)
# include "mozilla/Sandbox.h"
@ -41,6 +42,7 @@
namespace mozilla {
using namespace ipc;
using namespace gfx;
static RDDParent* sRDDParent;
@ -83,6 +85,8 @@ bool RDDParent::Init(base::ProcessId aParentPid, const char* aParentBuildID,
return false;
}
gfxVars::Initialize();
mozilla::ipc::SetThisProcessName("RDD Process");
return true;
}
@ -115,8 +119,14 @@ static void StartRDDMacSandbox() {
#endif
mozilla::ipc::IPCResult RDDParent::RecvInit(
const Maybe<FileDescriptor>& aBrokerFd, bool aStartMacSandbox) {
nsTArray<GfxVarUpdate>&& vars, const Maybe<FileDescriptor>& aBrokerFd,
bool aStartMacSandbox) {
Unused << SendInitComplete();
for (const auto& var : vars) {
gfxVars::ApplyUpdate(var);
}
#if defined(MOZ_SANDBOX)
# if defined(XP_MACOSX)
// Close all current connections to the WindowServer. This ensures that the
@ -143,6 +153,11 @@ mozilla::ipc::IPCResult RDDParent::RecvInit(
return IPC_OK();
}
IPCResult RDDParent::RecvUpdateVar(const GfxVarUpdate& aUpdate) {
gfxVars::ApplyUpdate(aUpdate);
return IPC_OK();
}
mozilla::ipc::IPCResult RDDParent::RecvInitProfiler(
Endpoint<PProfilerChild>&& aEndpoint) {
#ifdef MOZ_GECKO_PROFILER
@ -210,6 +225,7 @@ void RDDParent::ActorDestroy(ActorDestroyReason aWhy) {
RemoteDecoderManagerParent::ShutdownVideoBridge();
gfxVars::Shutdown();
CrashReporterClient::DestroySingleton();
XRE_ShutdownChildProcess();
}

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

@ -24,7 +24,8 @@ class RDDParent final : public PRDDParent {
bool Init(base::ProcessId aParentPid, const char* aParentBuildID,
MessageLoop* aIOLoop, IPC::Channel* aChannel);
mozilla::ipc::IPCResult RecvInit(const Maybe<ipc::FileDescriptor>& aBrokerFd,
mozilla::ipc::IPCResult RecvInit(nsTArray<GfxVarUpdate>&& vars,
const Maybe<ipc::FileDescriptor>& aBrokerFd,
bool aStartMacSandbox);
mozilla::ipc::IPCResult RecvInitProfiler(
Endpoint<PProfilerChild>&& aEndpoint);
@ -38,6 +39,7 @@ class RDDParent final : public PRDDParent {
const bool& minimizeMemoryUsage,
const Maybe<ipc::FileDescriptor>& DMDFile);
mozilla::ipc::IPCResult RecvPreferenceUpdate(const Pref& pref);
mozilla::ipc::IPCResult RecvUpdateVar(const GfxVarUpdate& pref);
void ActorDestroy(ActorDestroyReason aWhy) override;