Bug 1576499 - Split off EndRemoteDrawing from TryToEndRemoteDrawing and call it directly instead of calling TryToEndRemoteDrawing(true). r=mattwoodrow

This eliminates a boolean parameter whose meaning is not immediately obvious at the call site.

Depends on D43378

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

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Markus Stange 2019-08-27 08:17:21 +00:00
Родитель 24bf8a7ca3
Коммит c94dc585ca
2 изменённых файлов: 16 добавлений и 12 удалений

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

@ -251,7 +251,7 @@ void BasicCompositingRenderTarget::BindRenderTarget() {
void BasicCompositor::Destroy() {
if (mIsPendingEndRemoteDrawing) {
// Force to end previous remote drawing.
TryToEndRemoteDrawing(/* aForceToEnd */ true);
EndRemoteDrawing();
MOZ_ASSERT(!mIsPendingEndRemoteDrawing);
}
mWidget->CleanupRemoteDrawing();
@ -892,7 +892,7 @@ Maybe<gfx::IntRect> BasicCompositor::BeginFrame(
NativeLayer* aNativeLayer) {
if (mIsPendingEndRemoteDrawing) {
// Force to end previous remote drawing.
TryToEndRemoteDrawing(/* aForceToEnd */ true);
EndRemoteDrawing();
MOZ_ASSERT(!mIsPendingEndRemoteDrawing);
}
@ -983,7 +983,7 @@ Maybe<gfx::IntRect> BasicCompositor::BeginFrame(
// Setup a render target for drawing. In cases where we need to buffer all
// compositing (bufferMode == BufferMode::BUFFERED), this will set up the back
// buffer. We will copy the drawing into mDrawTarget (the widget) in
// TryToEndRemoteDrawing(), which gets called during EndFrame().
// EndRemoteDrawing().
RefPtr<CompositingRenderTarget> target =
CreateRenderTargetForWindow(mInvalidRect, clearRegion, bufferMode);
@ -1048,15 +1048,13 @@ void BasicCompositor::EndFrame() {
}
}
void BasicCompositor::TryToEndRemoteDrawing(bool aForceToEnd) {
void BasicCompositor::TryToEndRemoteDrawing() {
if (mIsDestroyed || !mRenderTarget) {
return;
}
MOZ_ASSERT_IF(mTarget, aForceToEnd);
// It it is not a good timing for EndRemoteDrawing, defter to call it.
if (!aForceToEnd && NeedsToDeferEndRemoteDrawing()) {
// If it is not a good time to call EndRemoteDrawing, defer it.
if (NeedsToDeferEndRemoteDrawing()) {
mIsPendingEndRemoteDrawing = true;
const uint32_t retryMs = 2;
@ -1065,6 +1063,13 @@ void BasicCompositor::TryToEndRemoteDrawing(bool aForceToEnd) {
NS_NewRunnableFunction("layers::BasicCompositor::TryToEndRemoteDrawing",
[self]() { self->TryToEndRemoteDrawing(); });
MessageLoop::current()->PostDelayedTask(runnable.forget(), retryMs);
} else {
EndRemoteDrawing();
}
}
void BasicCompositor::EndRemoteDrawing() {
if (mIsDestroyed || !mRenderTarget) {
return;
}
@ -1138,9 +1143,7 @@ bool BasicCompositor::NeedsToDeferEndRemoteDrawing() {
return mWidget->NeedsToDeferEndRemoteDrawing();
}
void BasicCompositor::FinishPendingComposite() {
TryToEndRemoteDrawing(/* aForceToEnd */ true);
}
void BasicCompositor::FinishPendingComposite() { EndRemoteDrawing(); }
bool BasicCompositor::NeedToRecreateFullWindowRenderTarget() const {
if (!ShouldRecordFrames()) {

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

@ -167,7 +167,8 @@ class BasicCompositor : public Compositor {
const gfx::Matrix4x4& aTransform,
const gfx::Rect& aVisibleRect) override;
void TryToEndRemoteDrawing(bool aForceToEnd = false);
void TryToEndRemoteDrawing();
void EndRemoteDrawing();
bool NeedsToDeferEndRemoteDrawing();