Bug 1465466 Part 1 - Use a separate compositor in recording/replaying processes, r=nical.

--HG--
extra : rebase_source : 003f6557370f2e4e6959ea14e833f7e2e617c5b0
This commit is contained in:
Brian Hackett 2018-07-23 21:46:47 +00:00
Родитель ac35a3d53e
Коммит 99d34528e4
9 изменённых файлов: 37 добавлений и 17 удалений

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

@ -647,6 +647,12 @@ TabChild::Init()
mAPZEventState = new APZEventState(mPuppetWidget, std::move(callback));
mIPCOpen = true;
// Recording/replaying processes use their own compositor.
if (recordreplay::IsRecordingOrReplaying()) {
mPuppetWidget->CreateCompositor();
}
return NS_OK;
}
@ -1285,7 +1291,9 @@ TabChild::RecvInitRendering(const TextureFactoryIdentifier& aTextureFactoryIdent
mozilla::ipc::IPCResult
TabChild::RecvUpdateDimensions(const DimensionInfo& aDimensionInfo)
{
if (!mRemoteFrame) {
// When recording/replaying we need to make sure the dimensions are up to
// date on the compositor used in this process.
if (!mRemoteFrame && !recordreplay::IsRecordingOrReplaying()) {
return IPC_OK();
}
@ -2920,7 +2928,10 @@ void
TabChild::NotifyPainted()
{
if (!mNotified) {
mRemoteFrame->SendNotifyCompositorTransaction();
// Recording/replaying processes have a compositor but not a remote frame.
if (!recordreplay::IsRecordingOrReplaying()) {
mRemoteFrame->SendNotifyCompositorTransaction();
}
mNotified = true;
}
}

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

@ -502,7 +502,7 @@ ClientLayerManager::GetRemoteRenderer()
CompositorBridgeChild*
ClientLayerManager::GetCompositorBridgeChild()
{
if (!XRE_IsParentProcess()) {
if (!XRE_IsParentProcess() && !recordreplay::IsRecordingOrReplaying()) {
return CompositorBridgeChild::Get();
}
return GetRemoteRenderer();
@ -530,7 +530,11 @@ ClientLayerManager::DidComposite(TransactionId aTransactionId,
const TimeStamp& aCompositeStart,
const TimeStamp& aCompositeEnd)
{
MOZ_ASSERT(mWidget);
if (!mWidget) {
// When recording/replaying this manager may have already been destroyed.
MOZ_ASSERT(recordreplay::IsRecordingOrReplaying());
return;
}
// Notifying the observers may tick the refresh driver which can cause
// a lot of different things to happen that may affect the lifetime of

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

@ -376,7 +376,7 @@ void
CompositorBridgeParent::InitSameProcess(widget::CompositorWidget* aWidget,
const LayersId& aLayerTreeId)
{
MOZ_ASSERT(XRE_IsParentProcess());
MOZ_ASSERT(XRE_IsParentProcess() || recordreplay::IsRecordingOrReplaying());
MOZ_ASSERT(NS_IsMainThread());
mWidget = aWidget;

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

@ -154,7 +154,7 @@ CompositorManagerChild::CreateWidgetCompositorBridge(uint64_t aProcessToken,
CompositorManagerChild::CreateSameProcessWidgetCompositorBridge(LayerManager* aLayerManager,
uint32_t aNamespace)
{
MOZ_ASSERT(XRE_IsParentProcess());
MOZ_ASSERT(XRE_IsParentProcess() || recordreplay::IsRecordingOrReplaying());
MOZ_ASSERT(NS_IsMainThread());
if (NS_WARN_IF(!sInstance || !sInstance->CanSend())) {
return nullptr;

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

@ -26,7 +26,7 @@ StaticAutoPtr<nsTArray<CompositorManagerParent*>> CompositorManagerParent::sActi
/* static */ already_AddRefed<CompositorManagerParent>
CompositorManagerParent::CreateSameProcess()
{
MOZ_ASSERT(XRE_IsParentProcess());
MOZ_ASSERT(XRE_IsParentProcess() || recordreplay::IsRecordingOrReplaying());
MOZ_ASSERT(NS_IsMainThread());
StaticMutexAutoLock lock(sMutex);
@ -71,7 +71,7 @@ CompositorManagerParent::CreateSameProcessWidgetCompositorBridge(CSSToLayoutDevi
bool aUseExternalSurfaceSize,
const gfx::IntSize& aSurfaceSize)
{
MOZ_ASSERT(XRE_IsParentProcess());
MOZ_ASSERT(XRE_IsParentProcess() || recordreplay::IsRecordingOrReplaying());
MOZ_ASSERT(NS_IsMainThread());
// When we are in a combined UI / GPU process, InProcessCompositorSession

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

@ -650,7 +650,7 @@ gfxPlatform::Init()
gfxConfig::Init();
if (XRE_IsParentProcess()) {
if (XRE_IsParentProcess() || recordreplay::IsRecordingOrReplaying()) {
GPUProcessManager::Initialize();
if (Preferences::GetBool("media.wmf.skip-blacklist")) {
@ -745,7 +745,7 @@ gfxPlatform::Init()
gpu->LaunchGPUProcess();
}
if (XRE_IsParentProcess()) {
if (XRE_IsParentProcess() || recordreplay::IsRecordingOrReplaying()) {
if (gfxPlatform::ForceSoftwareVsync()) {
gPlatform->mVsyncSource = (gPlatform)->gfxPlatform::CreateHardwareVsyncSource();
} else {
@ -1040,10 +1040,12 @@ gfxPlatform::InitLayersIPC()
sLayersIPCIsUp = true;
if (XRE_IsContentProcess()) {
if (gfxVars::UseOMTP()) {
if (gfxVars::UseOMTP() && !recordreplay::IsRecordingOrReplaying()) {
layers::PaintThread::Start();
}
} else if (XRE_IsParentProcess()) {
}
if (XRE_IsParentProcess() || recordreplay::IsRecordingOrReplaying()) {
if (!gfxConfig::IsEnabled(Feature::GPU_PROCESS) && gfxVars::UseWebRender()) {
wr::RenderThread::Start();
}
@ -1069,7 +1071,7 @@ gfxPlatform::ShutdownLayersIPC()
layers::ImageBridgeChild::ShutDown();
}
if (gfxVars::UseOMTP()) {
if (gfxVars::UseOMTP() && !recordreplay::IsRecordingOrReplaying()) {
layers::PaintThread::Shutdown();
}
} else if (XRE_IsParentProcess()) {
@ -2884,7 +2886,7 @@ gfxPlatform::IsInLayoutAsapMode()
/* static */ bool
gfxPlatform::ForceSoftwareVsync()
{
return gfxPrefs::LayoutFrameRate() > 0;
return gfxPrefs::LayoutFrameRate() > 0 || recordreplay::IsRecordingOrReplaying();
}
/* static */ int

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

@ -631,7 +631,7 @@ public:
*/
virtual mozilla::gfx::VsyncSource* GetHardwareVsync() {
MOZ_ASSERT(mVsyncSource != nullptr);
MOZ_ASSERT(XRE_IsParentProcess());
MOZ_ASSERT(XRE_IsParentProcess() || mozilla::recordreplay::IsRecordingOrReplaying());
return mVsyncSource;
}

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

@ -98,13 +98,13 @@ CompositorVsyncDispatcher::Shutdown()
RefreshTimerVsyncDispatcher::RefreshTimerVsyncDispatcher()
: mRefreshTimersLock("RefreshTimers lock")
{
MOZ_ASSERT(XRE_IsParentProcess());
MOZ_ASSERT(XRE_IsParentProcess() || recordreplay::IsRecordingOrReplaying());
MOZ_ASSERT(NS_IsMainThread());
}
RefreshTimerVsyncDispatcher::~RefreshTimerVsyncDispatcher()
{
MOZ_ASSERT(XRE_IsParentProcess());
MOZ_ASSERT(XRE_IsParentProcess() || recordreplay::IsRecordingOrReplaying());
MOZ_ASSERT(NS_IsMainThread());
}

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

@ -1528,6 +1528,9 @@ CompositorBridgeChild* nsBaseWidget::GetRemoteRenderer()
already_AddRefed<gfx::DrawTarget>
nsBaseWidget::StartRemoteDrawing()
{
if (recordreplay::IsRecordingOrReplaying()) {
return recordreplay::child::DrawTargetForRemoteDrawing(mBounds.Size());
}
return nullptr;
}