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

Unified Diff: third_party/WebKit/Source/core/html/HTMLCanvasElement.cpp

Issue 2644653003: Make OffscreenCanvas animation in sync with its placeholder canvas's parent frame rate (Closed)
Patch Set: fix based on both reviewers 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/html/HTMLCanvasElement.cpp
diff --git a/third_party/WebKit/Source/core/html/HTMLCanvasElement.cpp b/third_party/WebKit/Source/core/html/HTMLCanvasElement.cpp
index 68d1351e64a3af40a74ff91a8bf00eac10f2c91e..a37e4106b3aacc12cf278c06b95a5f064a29a94d 100644
--- a/third_party/WebKit/Source/core/html/HTMLCanvasElement.cpp
+++ b/third_party/WebKit/Source/core/html/HTMLCanvasElement.cpp
@@ -38,6 +38,7 @@
#include "core/dom/ExceptionCode.h"
#include "core/dom/TaskRunnerHelper.h"
#include "core/fileapi/File.h"
+#include "core/frame/FrameHost.h"
#include "core/frame/ImageBitmap.h"
#include "core/frame/LocalFrame.h"
#include "core/frame/Settings.h"
@@ -56,6 +57,7 @@
#include "core/layout/LayoutHTMLCanvas.h"
#include "core/layout/api/LayoutViewItem.h"
#include "core/layout/compositing/PaintLayerCompositor.h"
+#include "core/page/ChromeClient.h"
#include "core/paint/PaintLayer.h"
#include "core/paint/PaintTiming.h"
#include "platform/Histogram.h"
@@ -1423,7 +1425,14 @@ String HTMLCanvasElement::getIdFromControl(const Element* element) {
void HTMLCanvasElement::createLayer() {
DCHECK(!m_surfaceLayerBridge);
- m_surfaceLayerBridge = WTF::wrapUnique(new CanvasSurfaceLayerBridge(this));
+ LocalFrame* frame = document().frame();
+ WebLayerTreeView* layerTreeView = nullptr;
+ if (frame && frame->host()) {
dcheng 2017/01/20 08:44:12 No need to check frame->host() as well: if Documen
xlai (Olivia) 2017/01/20 16:36:21 Done.
+ layerTreeView = frame->host()->chromeClient().getWebLayerTreeView();
+ }
+
+ m_surfaceLayerBridge =
+ WTF::wrapUnique(new CanvasSurfaceLayerBridge(this, layerTreeView));
// Creates a placeholder layer first before Surface is created.
m_surfaceLayerBridge->createSolidColorLayer();
}

Powered by Google App Engine
This is Rietveld 408576698