Index: third_party/WebKit/Source/core/offscreencanvas/OffscreenCanvas.cpp |
diff --git a/third_party/WebKit/Source/core/offscreencanvas/OffscreenCanvas.cpp b/third_party/WebKit/Source/core/offscreencanvas/OffscreenCanvas.cpp |
index 4a4755592a1d9bf6503af65551366df75341d915..ea7dd1d06b1bde620311c0cc754ef06399d5fa75 100644 |
--- a/third_party/WebKit/Source/core/offscreencanvas/OffscreenCanvas.cpp |
+++ b/third_party/WebKit/Source/core/offscreencanvas/OffscreenCanvas.cpp |
@@ -236,6 +236,7 @@ OffscreenCanvasFrameDispatcher* OffscreenCanvas::getOrCreateFrameDispatcher() { |
ScriptPromise OffscreenCanvas::commit(RefPtr<StaticBitmapImage> image, |
bool isWebGLSoftwareRendering, |
ScriptState* scriptState) { |
+ getOrCreateFrameDispatcher()->setNeedsBeginFrame(true); |
if (m_commitPromiseResolver) { |
if (image) { |
m_overdrawFrame = std::move(image); |
@@ -266,6 +267,11 @@ void OffscreenCanvas::beginFrame() { |
} else if (m_commitPromiseResolver) { |
m_commitPromiseResolver->resolve(); |
m_commitPromiseResolver.clear(); |
+ // We need to tell parent frame to stop sending signals on begin frame to |
+ // avoid overhead once we resolve the promise. |
+ // In the case of overdraw frame (if block), we still need to wait for one |
+ // more frame time to resolve the existing promise. |
+ getOrCreateFrameDispatcher()->setNeedsBeginFrame(false); |
} |
} |