OLD | NEW |
(Empty) | |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "gpu/command_buffer/client/gles2_interface.h" |
| 6 #include "gpu/command_buffer/common/capabilities.h" |
| 7 #include "public/platform/WebGraphicsContext3DProvider.h" |
| 8 #include "third_party/skia/include/gpu/GrContext.h" |
| 9 #include "third_party/skia/include/gpu/gl/GrGLInterface.h" |
| 10 #include "wtf/RefPtr.h" |
| 11 |
| 12 namespace blink { |
| 13 |
| 14 class FakeWebGraphicsContext3DProvider : public WebGraphicsContext3DProvider { |
| 15 public: |
| 16 FakeWebGraphicsContext3DProvider(gpu::gles2::GLES2Interface* gl) |
| 17 : m_gl(gl) |
| 18 { |
| 19 RefPtr<const GrGLInterface> glInterface = adoptRef(GrGLCreateNullInterfa
ce()); |
| 20 m_grContext = adoptRef(GrContext::Create(kOpenGL_GrBackend, reinterpret_
cast<GrBackendContext>(glInterface.get()))); |
| 21 } |
| 22 |
| 23 GrContext* grContext() override |
| 24 { |
| 25 return m_grContext.get(); |
| 26 } |
| 27 |
| 28 gpu::Capabilities getCapabilities() |
| 29 { |
| 30 return gpu::Capabilities(); |
| 31 } |
| 32 |
| 33 gpu::gles2::GLES2Interface* contextGL() override |
| 34 { |
| 35 return m_gl; |
| 36 } |
| 37 |
| 38 bool bindToCurrentThread() override { return false; } |
| 39 void setLostContextCallback(WebClosure) override {} |
| 40 void setErrorMessageCallback(WebFunction<void(const char*, int32_t id)>) {} |
| 41 |
| 42 private: |
| 43 gpu::gles2::GLES2Interface* m_gl; |
| 44 RefPtr<GrContext> m_grContext; |
| 45 }; |
| 46 |
| 47 } // namespace blink |
OLD | NEW |