mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-11 04:15:43 +00:00
Bug 1514874 - start RDD process on-demand r=jya,jld
Differential Revision: https://phabricator.services.mozilla.com/D15775 --HG-- extra : moz-landing-system : lando
This commit is contained in:
parent
91b4da5027
commit
1a75356195
@ -73,6 +73,7 @@
|
||||
#include "mozilla/layers/CompositorManagerChild.h"
|
||||
#include "mozilla/layers/ContentProcessController.h"
|
||||
#include "mozilla/layers/ImageBridgeChild.h"
|
||||
#include "mozilla/layers/SynchronousTask.h" // for LaunchRDDProcess
|
||||
#include "mozilla/loader/ScriptCacheActors.h"
|
||||
#include "mozilla/net/NeckoChild.h"
|
||||
#include "mozilla/net/CookieServiceChild.h"
|
||||
@ -1116,6 +1117,22 @@ void ContentChild::GetProcessName(nsAString& aName) const {
|
||||
aName.Assign(mProcessName);
|
||||
}
|
||||
|
||||
void ContentChild::LaunchRDDProcess() {
|
||||
SynchronousTask task("LaunchRDDProcess");
|
||||
SystemGroup::Dispatch(
|
||||
TaskCategory::Other,
|
||||
NS_NewRunnableFunction("LaunchRDDProcess", [&task, this] {
|
||||
AutoCompleteTask complete(&task);
|
||||
nsresult rv;
|
||||
Endpoint<PRemoteDecoderManagerChild> endpoint;
|
||||
Unused << SendLaunchRDDProcess(&rv, &endpoint);
|
||||
if (rv == NS_OK) {
|
||||
RemoteDecoderManagerChild::InitForContent(std::move(endpoint));
|
||||
}
|
||||
}));
|
||||
task.Wait();
|
||||
}
|
||||
|
||||
bool ContentChild::IsAlive() const { return mIsAlive; }
|
||||
|
||||
bool ContentChild::IsShuttingDown() const { return mShuttingDown; }
|
||||
@ -1440,12 +1457,6 @@ mozilla::ipc::IPCResult ContentChild::RecvReinitRenderingForDeviceReset() {
|
||||
return IPC_OK();
|
||||
}
|
||||
|
||||
mozilla::ipc::IPCResult ContentChild::RecvInitRemoteDecoder(
|
||||
Endpoint<PRemoteDecoderManagerChild>&& aRemoteManager) {
|
||||
RemoteDecoderManagerChild::InitForContent(std::move(aRemoteManager));
|
||||
return IPC_OK();
|
||||
}
|
||||
|
||||
#if defined(XP_MACOSX) && defined(MOZ_CONTENT_SANDBOX)
|
||||
extern "C" {
|
||||
CGError CGSSetDenyWindowServerConnections(bool);
|
||||
|
@ -133,6 +133,8 @@ class ContentChild final : public PContentChild,
|
||||
|
||||
void GetProcessName(nsACString& aName) const;
|
||||
|
||||
void LaunchRDDProcess();
|
||||
|
||||
#if defined(XP_MACOSX) && defined(MOZ_CONTENT_SANDBOX)
|
||||
void GetProfileDir(nsIFile** aProfileDir) const {
|
||||
*aProfileDir = mProfileDir;
|
||||
@ -188,9 +190,6 @@ class ContentChild final : public PContentChild,
|
||||
|
||||
mozilla::ipc::IPCResult RecvReinitRenderingForDeviceReset() override;
|
||||
|
||||
virtual mozilla::ipc::IPCResult RecvInitRemoteDecoder(
|
||||
Endpoint<PRemoteDecoderManagerChild>&& aRemoteManager) override;
|
||||
|
||||
virtual mozilla::ipc::IPCResult RecvSetProcessSandbox(
|
||||
const MaybeFileDesc& aBroker) override;
|
||||
|
||||
|
@ -1119,6 +1119,31 @@ mozilla::ipc::IPCResult ContentParent::RecvConnectPluginBridge(
|
||||
return IPC_OK();
|
||||
}
|
||||
|
||||
mozilla::ipc::IPCResult ContentParent::RecvLaunchRDDProcess(
|
||||
nsresult* aRv, Endpoint<PRemoteDecoderManagerChild>* aEndpoint) {
|
||||
*aRv = NS_OK;
|
||||
|
||||
if (XRE_IsParentProcess() &&
|
||||
BrowserTabsRemoteAutostart() && // only do rdd process if e10s on
|
||||
Preferences::GetBool("media.rdd-process.enabled", false)) {
|
||||
RDDProcessManager* rdd = RDDProcessManager::Get();
|
||||
if (rdd) {
|
||||
rdd->LaunchRDDProcess();
|
||||
|
||||
bool rddOpened = rdd->CreateContentBridge(OtherPid(), aEndpoint);
|
||||
MOZ_ASSERT(rddOpened);
|
||||
|
||||
if (!rddOpened) {
|
||||
*aRv = NS_ERROR_NOT_AVAILABLE;
|
||||
}
|
||||
} else {
|
||||
*aRv = NS_ERROR_NOT_AVAILABLE;
|
||||
}
|
||||
}
|
||||
|
||||
return IPC_OK();
|
||||
}
|
||||
|
||||
/*static*/ TabParent* ContentParent::CreateBrowser(
|
||||
const TabContext& aContext, Element* aFrameElement,
|
||||
ContentParent* aOpenerContentParent, TabParent* aSameTabGroupAs,
|
||||
@ -2612,22 +2637,6 @@ void ContentParent::InitInternal(ProcessPriority aInitialPriority) {
|
||||
|
||||
gpm->AddListener(this);
|
||||
|
||||
if (StaticPrefs::MediaRddProcessEnabled() && BrowserTabsRemoteAutostart()) {
|
||||
RDDProcessManager* rdd = RDDProcessManager::Get();
|
||||
|
||||
Endpoint<PRemoteDecoderManagerChild> remoteManager;
|
||||
bool rddOpened = rdd->CreateContentBridge(OtherPid(), &remoteManager);
|
||||
MOZ_ASSERT(rddOpened);
|
||||
|
||||
if (rddOpened) {
|
||||
// not using std::move here (like in SendInitRendering above) because
|
||||
// clang-tidy says:
|
||||
// Warning: Passing result of std::move() as a const reference
|
||||
// argument; no move will actually happen
|
||||
Unused << SendInitRemoteDecoder(remoteManager);
|
||||
}
|
||||
}
|
||||
|
||||
nsStyleSheetService* sheetService = nsStyleSheetService::GetInstance();
|
||||
if (sheetService) {
|
||||
// This looks like a lot of work, but in a normal browser session we just
|
||||
|
@ -302,6 +302,9 @@ class ContentParent final : public PContentParent,
|
||||
const uint32_t& aPluginId, nsresult* aRv,
|
||||
Endpoint<PPluginModuleParent>* aEndpoint) override;
|
||||
|
||||
virtual mozilla::ipc::IPCResult RecvLaunchRDDProcess(
|
||||
nsresult* aRv, Endpoint<PRemoteDecoderManagerChild>* aEndpoint) override;
|
||||
|
||||
virtual mozilla::ipc::IPCResult RecvUngrabPointer(
|
||||
const uint32_t& aTime) override;
|
||||
|
||||
|
@ -435,8 +435,6 @@ child:
|
||||
// Re-create the rendering stack for a device reset.
|
||||
async ReinitRenderingForDeviceReset();
|
||||
|
||||
async InitRemoteDecoder(Endpoint<PRemoteDecoderManagerChild> decoder);
|
||||
|
||||
/**
|
||||
* Enable system-level sandboxing features, if available. Can
|
||||
* usually only be performed zero or one times. The child may
|
||||
@ -805,6 +803,10 @@ parent:
|
||||
sync ConnectPluginBridge(uint32_t aPluginId)
|
||||
returns (nsresult rv, Endpoint<PPluginModuleParent> aEndpoint);
|
||||
|
||||
// See Bug 1518344 - Investigate using async for PContent::LaunchRDDProcess
|
||||
sync LaunchRDDProcess()
|
||||
returns (nsresult rv, Endpoint<PRemoteDecoderManagerChild> aEndpoint);
|
||||
|
||||
async PJavaScript();
|
||||
|
||||
async PRemoteSpellcheckEngine();
|
||||
|
@ -6,6 +6,7 @@
|
||||
#include "RemoteDecoderModule.h"
|
||||
|
||||
#include "base/thread.h"
|
||||
#include "mozilla/dom/ContentChild.h" // for launching RDD w/ ContentChild
|
||||
#include "mozilla/layers/SynchronousTask.h"
|
||||
#include "mozilla/StaticPrefs.h"
|
||||
|
||||
@ -19,16 +20,10 @@
|
||||
namespace mozilla {
|
||||
|
||||
using base::Thread;
|
||||
using dom::ContentChild;
|
||||
using namespace ipc;
|
||||
using namespace layers;
|
||||
|
||||
nsresult RemoteDecoderModule::Startup() {
|
||||
if (!RemoteDecoderManagerChild::GetManagerThread()) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
bool RemoteDecoderModule::SupportsMimeType(
|
||||
const nsACString& aMimeType, DecoderDoctorDiagnostics* aDiagnostics) const {
|
||||
bool supports = false;
|
||||
@ -46,6 +41,11 @@ bool RemoteDecoderModule::SupportsMimeType(
|
||||
|
||||
already_AddRefed<MediaDataDecoder> RemoteDecoderModule::CreateVideoDecoder(
|
||||
const CreateDecoderParams& aParams) {
|
||||
if (XRE_IsContentProcess()) {
|
||||
ContentChild* contentChild = ContentChild::GetSingleton();
|
||||
contentChild->LaunchRDDProcess();
|
||||
}
|
||||
|
||||
RemoteVideoDecoderChild* child = new RemoteVideoDecoderChild();
|
||||
RefPtr<RemoteMediaDataDecoder> object = new RemoteMediaDataDecoder(
|
||||
child, RemoteDecoderManagerChild::GetManagerThread(),
|
||||
|
@ -17,8 +17,6 @@ class RemoteDecoderModule : public PlatformDecoderModule {
|
||||
public:
|
||||
RemoteDecoderModule() = default;
|
||||
|
||||
nsresult Startup() override;
|
||||
|
||||
bool SupportsMimeType(const nsACString& aMimeType,
|
||||
DecoderDoctorDiagnostics* aDiagnostics) const override;
|
||||
|
||||
|
@ -931,15 +931,6 @@ void gfxPlatform::Init() {
|
||||
gpu->LaunchGPUProcess();
|
||||
}
|
||||
|
||||
if (XRE_IsParentProcess() &&
|
||||
BrowserTabsRemoteAutostart() && // only do rdd process if e10s on
|
||||
Preferences::GetBool("media.rdd-process.enabled", false)) {
|
||||
RDDProcessManager* rdd = RDDProcessManager::Get();
|
||||
if (rdd) {
|
||||
rdd->LaunchRDDProcess();
|
||||
}
|
||||
}
|
||||
|
||||
gLastUsedFrameRate = ForceSoftwareVsync() ? GetSoftwareVsyncRate() : -1;
|
||||
auto updateFrameRateCallback = [](const GfxPrefValue& aValue) -> void {
|
||||
int32_t newRate = ForceSoftwareVsync() ? GetSoftwareVsyncRate() : -1;
|
||||
|
@ -914,6 +914,8 @@ description =
|
||||
description =
|
||||
[PRemoteDecoderManager::PRemoteVideoDecoder]
|
||||
description = See Bug 1505976 - investigate changing to async instead of matching GPU pattern
|
||||
[PContent::LaunchRDDProcess]
|
||||
description = See Bug 1518344 - investigate using async for PContent::LaunchRDDProcess
|
||||
[PVideoDecoderManager::PVideoDecoder]
|
||||
description =
|
||||
[PVideoDecoderManager::Readback]
|
||||
|
Loading…
Reference in New Issue
Block a user