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

Unified Diff: third_party/WebKit/Source/platform/graphics/Canvas2DLayerBridgeTest.cpp

Issue 2101823002: Revert of Make 2D canvas disable gpu acceleration when getImageData is called (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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/platform/graphics/Canvas2DLayerBridgeTest.cpp
diff --git a/third_party/WebKit/Source/platform/graphics/Canvas2DLayerBridgeTest.cpp b/third_party/WebKit/Source/platform/graphics/Canvas2DLayerBridgeTest.cpp
index bf23684214574a767125fc1d17253202343da7db..60d56e6f4642fa9d8e254da0199b0d6c848cb147 100644
--- a/third_party/WebKit/Source/platform/graphics/Canvas2DLayerBridgeTest.cpp
+++ b/third_party/WebKit/Source/platform/graphics/Canvas2DLayerBridgeTest.cpp
@@ -25,14 +25,16 @@
#include "platform/graphics/Canvas2DLayerBridge.h"
#include "SkSurface.h"
+#include "gpu/command_buffer/client/gles2_interface.h"
+#include "gpu/command_buffer/common/capabilities.h"
#include "platform/ThreadSafeFunctional.h"
#include "platform/WaitableEvent.h"
#include "platform/graphics/ImageBuffer.h"
#include "platform/graphics/UnacceleratedImageBufferSurface.h"
#include "platform/graphics/test/FakeGLES2Interface.h"
-#include "platform/graphics/test/FakeWebGraphicsContext3DProvider.h"
#include "public/platform/Platform.h"
#include "public/platform/WebExternalBitmap.h"
+#include "public/platform/WebGraphicsContext3DProvider.h"
#include "public/platform/WebScheduler.h"
#include "public/platform/WebTaskRunner.h"
#include "public/platform/WebThread.h"
@@ -42,6 +44,8 @@
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/skia/include/core/SkCanvas.h"
+#include "third_party/skia/include/gpu/GrContext.h"
+#include "third_party/skia/include/gpu/gl/GrGLInterface.h"
#include "third_party/skia/include/gpu/gl/GrGLTypes.h"
#include "wtf/PtrUtil.h"
#include "wtf/RefPtr.h"
@@ -57,6 +61,40 @@
namespace blink {
namespace {
+
+class FakeWebGraphicsContext3DProvider : public WebGraphicsContext3DProvider {
+public:
+ FakeWebGraphicsContext3DProvider(gpu::gles2::GLES2Interface* gl)
+ : m_gl(gl)
+ {
+ RefPtr<const GrGLInterface> glInterface = adoptRef(GrGLCreateNullInterface());
+ m_grContext = adoptRef(GrContext::Create(kOpenGL_GrBackend, reinterpret_cast<GrBackendContext>(glInterface.get())));
+ }
+
+ GrContext* grContext() override
+ {
+ return m_grContext.get();
+ }
+
+ gpu::Capabilities getCapabilities()
+ {
+ return gpu::Capabilities();
+ }
+
+ gpu::gles2::GLES2Interface* contextGL() override
+ {
+ return m_gl;
+ }
+
+ bool bindToCurrentThread() override { return false; }
+
+ void setLostContextCallback(WebClosure) override {}
+ void setErrorMessageCallback(WebFunction<void(const char*, int32_t id)>) {}
+
+private:
+ gpu::gles2::GLES2Interface* m_gl;
+ RefPtr<GrContext> m_grContext;
+};
class Canvas2DLayerBridgePtr {
public:
@@ -1062,4 +1100,5 @@
postAndWaitDestroyBridgeTask(BLINK_FROM_HERE, testThread.get(), &bridge);
}
+
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698