| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 #ifndef CONTENT_COMMON_GPU_CLIENT_CONTEXT_PROVIDER_COMMAND_BUFFER | 5 #ifndef CONTENT_COMMON_GPU_CLIENT_CONTEXT_PROVIDER_COMMAND_BUFFER |
| 6 #define CONTENT_COMMON_GPU_CLIENT_CONTEXT_PROVIDER_COMMAND_BUFFER | 6 #define CONTENT_COMMON_GPU_CLIENT_CONTEXT_PROVIDER_COMMAND_BUFFER |
| 7 | 7 |
| 8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "base/synchronization/lock.h" | 10 #include "base/synchronization/lock.h" |
| 11 #include "base/threading/thread_checker.h" | 11 #include "base/threading/thread_checker.h" |
| 12 #include "cc/output/context_provider.h" | 12 #include "cc/output/context_provider.h" |
| 13 #include "content/common/content_export.h" | 13 #include "content/common/content_export.h" |
| 14 #include "content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h" | 14 #include "content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h" |
| 15 #include "webkit/common/gpu/context_provider_web_context.h" |
| 15 | 16 |
| 16 namespace webkit { | 17 namespace webkit { |
| 17 namespace gpu { | 18 namespace gpu { |
| 18 class GrContextForWebGraphicsContext3D; | 19 class GrContextForWebGraphicsContext3D; |
| 19 } | 20 } |
| 20 } | 21 } |
| 21 | 22 |
| 22 namespace content { | 23 namespace content { |
| 23 | 24 |
| 24 // Implementation of cc::ContextProvider that provides a | 25 // Implementation of cc::ContextProvider that provides a |
| 25 // WebGraphicsContext3DCommandBufferImpl context and a GrContext. | 26 // WebGraphicsContext3DCommandBufferImpl context and a GrContext. |
| 26 class CONTENT_EXPORT ContextProviderCommandBuffer | 27 class CONTENT_EXPORT ContextProviderCommandBuffer |
| 27 : NON_EXPORTED_BASE(public cc::ContextProvider) { | 28 : NON_EXPORTED_BASE(public webkit::gpu::ContextProviderWebContext) { |
| 28 public: | 29 public: |
| 29 static scoped_refptr<ContextProviderCommandBuffer> Create( | 30 static scoped_refptr<ContextProviderCommandBuffer> Create( |
| 30 scoped_ptr<WebGraphicsContext3DCommandBufferImpl> context3d, | 31 scoped_ptr<WebGraphicsContext3DCommandBufferImpl> context3d, |
| 31 const std::string& debug_name); | 32 const std::string& debug_name); |
| 32 | 33 |
| 33 CommandBufferProxyImpl* GetCommandBufferProxy(); | 34 CommandBufferProxyImpl* GetCommandBufferProxy(); |
| 34 int GetGPUProcessID(); | 35 int GetGPUProcessID(); |
| 35 | 36 |
| 36 void set_leak_on_destroy() { | 37 void set_leak_on_destroy() { |
| 37 base::AutoLock lock(main_thread_lock_); | 38 base::AutoLock lock(main_thread_lock_); |
| 38 leak_on_destroy_ = true; | 39 leak_on_destroy_ = true; |
| 39 } | 40 } |
| 40 | 41 |
| 42 // ContextProviderWebContext implementation. |
| 43 virtual WebGraphicsContext3DCommandBufferImpl* WebContext3D() OVERRIDE; |
| 44 |
| 41 // cc::ContextProvider implementation. | 45 // cc::ContextProvider implementation. |
| 42 virtual bool BindToCurrentThread() OVERRIDE; | 46 virtual bool BindToCurrentThread() OVERRIDE; |
| 43 virtual WebGraphicsContext3DCommandBufferImpl* Context3d() OVERRIDE; | 47 virtual blink::WebGraphicsContext3D* Context3d() OVERRIDE; |
| 44 virtual gpu::gles2::GLES2Interface* ContextGL() OVERRIDE; | 48 virtual gpu::gles2::GLES2Interface* ContextGL() OVERRIDE; |
| 45 virtual gpu::ContextSupport* ContextSupport() OVERRIDE; | 49 virtual gpu::ContextSupport* ContextSupport() OVERRIDE; |
| 46 virtual class GrContext* GrContext() OVERRIDE; | 50 virtual class GrContext* GrContext() OVERRIDE; |
| 47 virtual void MakeGrContextCurrent() OVERRIDE; | 51 virtual void MakeGrContextCurrent() OVERRIDE; |
| 48 virtual Capabilities ContextCapabilities() OVERRIDE; | 52 virtual Capabilities ContextCapabilities() OVERRIDE; |
| 49 virtual bool IsContextLost() OVERRIDE; | 53 virtual bool IsContextLost() OVERRIDE; |
| 50 virtual void VerifyContexts() OVERRIDE; | 54 virtual void VerifyContexts() OVERRIDE; |
| 51 virtual bool DestroyedOnMainThread() OVERRIDE; | 55 virtual bool DestroyedOnMainThread() OVERRIDE; |
| 52 virtual void SetLostContextCallback( | 56 virtual void SetLostContextCallback( |
| 53 const LostContextCallback& lost_context_callback) OVERRIDE; | 57 const LostContextCallback& lost_context_callback) OVERRIDE; |
| (...skipping 29 matching lines...) Expand all Loading... |
| 83 bool leak_on_destroy_; | 87 bool leak_on_destroy_; |
| 84 bool destroyed_; | 88 bool destroyed_; |
| 85 | 89 |
| 86 class LostContextCallbackProxy; | 90 class LostContextCallbackProxy; |
| 87 scoped_ptr<LostContextCallbackProxy> lost_context_callback_proxy_; | 91 scoped_ptr<LostContextCallbackProxy> lost_context_callback_proxy_; |
| 88 }; | 92 }; |
| 89 | 93 |
| 90 } // namespace content | 94 } // namespace content |
| 91 | 95 |
| 92 #endif // CONTENT_COMMON_GPU_CLIENT_CONTEXT_PROVIDER_COMMAND_BUFFER | 96 #endif // CONTENT_COMMON_GPU_CLIENT_CONTEXT_PROVIDER_COMMAND_BUFFER |
| OLD | NEW |