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