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

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

Issue 2294963002: Submit Compositor Frame from OffscreenCanvas on main (Closed)
Patch Set: a test to ensure resizing on transferred offscreencanvas has no effect Created 4 years, 3 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 b5f8febd6e7bfcd7f93520e4634a53b70aa5fd7f..1d62bf46088754aaa1d7afd728e2f571bcf2cf46 100644
--- a/third_party/WebKit/Source/core/offscreencanvas/OffscreenCanvas.cpp
+++ b/third_party/WebKit/Source/core/offscreencanvas/OffscreenCanvas.cpp
@@ -9,6 +9,7 @@
#include "core/html/canvas/CanvasRenderingContext.h"
#include "core/html/canvas/CanvasRenderingContextFactory.h"
#include "platform/graphics/ImageBuffer.h"
+#include "platform/graphics/OffscreenCanvasFrameDispatcherImpl.h"
#include "wtf/MathExtras.h"
#include <memory>
@@ -27,11 +28,18 @@ OffscreenCanvas* OffscreenCanvas::create(unsigned width, unsigned height)
void OffscreenCanvas::setWidth(unsigned width)
{
+ // If this OffscreenCanvas is transferred control by an html canvas,
+ // its size is determined by html canvas's size and cannot be resized.
+ if (m_canvasId >= 0)
+ return;
m_size.setWidth(clampTo<int>(width));
}
void OffscreenCanvas::setHeight(unsigned height)
{
+ // Same comment as above.
+ if (m_canvasId >= 0)
+ return;
m_size.setHeight(clampTo<int>(height));
}
@@ -134,6 +142,13 @@ bool OffscreenCanvas::isPaintable() const
return m_context->isPaintable();
}
+OffscreenCanvasFrameDispatcher* OffscreenCanvas::getOrCreateFrameDispatcher()
+{
+ if (!m_frameDispatcher)
+ m_frameDispatcher = wrapUnique(new OffscreenCanvasFrameDispatcherImpl(m_clientId, m_localId, m_nonce, width(), height()));
+ return m_frameDispatcher.get();
+}
+
DEFINE_TRACE(OffscreenCanvas)
{
visitor->trace(m_context);

Powered by Google App Engine
This is Rietveld 408576698