Bug 1499828 Part 3 - Redraw the overlay when required, r=mccr8.

--HG--
extra : rebase_source : dc275641c80c674a9384acc8f101abbf8178be74
This commit is contained in:
Brian Hackett 2018-10-17 13:32:19 -06:00
Родитель 9701e7e569
Коммит 8cefe66b8d
3 изменённых файлов: 34 добавлений и 4 удалений

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

@ -153,9 +153,6 @@ UpdateGraphicsInUIProcess(const PaintMessage* aMsg)
InitGraphicsSandbox();
}
AutoSafeJSContext cx;
JSAutoRealm ar(cx, *gGraphicsSandbox);
size_t width = gLastPaintWidth;
size_t height = gLastPaintHeight;
size_t stride = layers::ImageDataSerializer::ComputeRGBStride(gSurfaceFormat, width);
@ -184,6 +181,9 @@ UpdateGraphicsInUIProcess(const PaintMessage* aMsg)
}
}
AutoSafeJSContext cx;
JSAutoRealm ar(cx, *gGraphicsSandbox);
JSObject* bufferObject =
JS_NewArrayBufferWithExternalContents(cx, width * height * 4, memory);
MOZ_RELEASE_ASSERT(bufferObject);
@ -196,11 +196,28 @@ UpdateGraphicsInUIProcess(const PaintMessage* aMsg)
// Call into the graphics module to update the canvas it manages.
RootedValue rval(cx);
if (!JS_CallFunctionName(cx, *gGraphicsSandbox, "Update", args, &rval)) {
if (!JS_CallFunctionName(cx, *gGraphicsSandbox, "UpdateCanvas", args, &rval)) {
MOZ_CRASH("UpdateGraphicsInUIProcess");
}
}
void
UpdateGraphicsOverlay()
{
if (!gLastPaintWidth || !gLastPaintHeight) {
return;
}
AutoSafeJSContext cx;
JSAutoRealm ar(cx, *gGraphicsSandbox);
RootedValue rval(cx);
if (!JS_CallFunctionName(cx, *gGraphicsSandbox, "UpdateOverlay",
JS::HandleValueArray::empty(), &rval)) {
MOZ_CRASH("UpdateGraphicsOverlay");
}
}
static void
MaybeTriggerExplicitPaint()
{

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

@ -611,6 +611,12 @@ SwitchActiveChild(ChildProcessInfo* aChild, bool aRecoverPosition = true)
oldActiveChild->RecoverToCheckpoint(oldActiveChild->MostRecentSavedCheckpoint());
oldActiveChild->SetRole(MakeUnique<ChildRoleStandby>());
}
// The graphics overlay is affected when we switch between recording and
// replaying children.
if (aChild->IsRecording() != oldActiveChild->IsRecording()) {
UpdateGraphicsOverlay();
}
}
///////////////////////////////////////////////////////////////////////////////
@ -1181,6 +1187,10 @@ RecvHitCheckpoint(const HitCheckpointMessage& aMsg)
UpdateCheckpointTimes(aMsg);
MaybeUpdateGraphicsAtCheckpoint(aMsg.mCheckpointId);
if (!gActiveChild->IsRecording()) {
UpdateGraphicsOverlay();
}
// Resume either forwards or backwards. Break the resume off into a separate
// runnable, to avoid starving any code already on the stack and waiting for
// the process to pause. Immediately resume if the main thread is blocked.

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

@ -94,6 +94,9 @@ void SendGraphicsMemoryToChild();
// an unhandled recording divergence.
void UpdateGraphicsInUIProcess(const PaintMessage* aMsg);
// Update the overlay shown over the tab's graphics.
void UpdateGraphicsOverlay();
// If necessary, update graphics after the active child sends a paint message
// or reaches a checkpoint.
void MaybeUpdateGraphicsAtPaint(const PaintMessage& aMsg);