Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(638)

Unified Diff: third_party/WebKit/Source/core/offscreencanvas/OffscreenCanvas.cpp

Issue 2644653003: Make OffscreenCanvas animation in sync with its placeholder canvas's parent frame rate (Closed)
Patch Set: rebase again Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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);
}
}
« no previous file with comments | « third_party/WebKit/Source/core/html/HTMLCanvasElement.cpp ('k') | third_party/WebKit/Source/core/page/ChromeClient.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698