| 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" |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 class CONTENT_EXPORT ContextProviderCommandBuffer | 27 class CONTENT_EXPORT ContextProviderCommandBuffer |
| 28 : NON_EXPORTED_BASE(public webkit::gpu::ContextProviderWebContext) { | 28 : NON_EXPORTED_BASE(public webkit::gpu::ContextProviderWebContext) { |
| 29 public: | 29 public: |
| 30 static scoped_refptr<ContextProviderCommandBuffer> Create( | 30 static scoped_refptr<ContextProviderCommandBuffer> Create( |
| 31 scoped_ptr<WebGraphicsContext3DCommandBufferImpl> context3d, | 31 scoped_ptr<WebGraphicsContext3DCommandBufferImpl> context3d, |
| 32 const std::string& debug_name); | 32 const std::string& debug_name); |
| 33 | 33 |
| 34 CommandBufferProxyImpl* GetCommandBufferProxy(); | 34 CommandBufferProxyImpl* GetCommandBufferProxy(); |
| 35 | 35 |
| 36 // ContextProviderWebContext implementation. | 36 // ContextProviderWebContext implementation. |
| 37 virtual WebGraphicsContext3DCommandBufferImpl* WebContext3D() override; | 37 WebGraphicsContext3DCommandBufferImpl* WebContext3D() override; |
| 38 | 38 |
| 39 // cc::ContextProvider implementation. | 39 // cc::ContextProvider implementation. |
| 40 virtual bool BindToCurrentThread() override; | 40 bool BindToCurrentThread() override; |
| 41 virtual gpu::gles2::GLES2Interface* ContextGL() override; | 41 gpu::gles2::GLES2Interface* ContextGL() override; |
| 42 virtual gpu::ContextSupport* ContextSupport() override; | 42 gpu::ContextSupport* ContextSupport() override; |
| 43 virtual class GrContext* GrContext() override; | 43 class GrContext* GrContext() override; |
| 44 virtual Capabilities ContextCapabilities() override; | 44 Capabilities ContextCapabilities() override; |
| 45 virtual bool IsContextLost() override; | 45 bool IsContextLost() override; |
| 46 virtual void VerifyContexts() override; | 46 void VerifyContexts() override; |
| 47 virtual void DeleteCachedResources() override; | 47 void DeleteCachedResources() override; |
| 48 virtual bool DestroyedOnMainThread() override; | 48 bool DestroyedOnMainThread() override; |
| 49 virtual void SetLostContextCallback( | 49 void SetLostContextCallback( |
| 50 const LostContextCallback& lost_context_callback) override; | 50 const LostContextCallback& lost_context_callback) override; |
| 51 virtual void SetMemoryPolicyChangedCallback( | 51 void SetMemoryPolicyChangedCallback( |
| 52 const MemoryPolicyChangedCallback& memory_policy_changed_callback) | 52 const MemoryPolicyChangedCallback& memory_policy_changed_callback) |
| 53 override; | 53 override; |
| 54 | 54 |
| 55 protected: | 55 protected: |
| 56 ContextProviderCommandBuffer( | 56 ContextProviderCommandBuffer( |
| 57 scoped_ptr<WebGraphicsContext3DCommandBufferImpl> context3d, | 57 scoped_ptr<WebGraphicsContext3DCommandBufferImpl> context3d, |
| 58 const std::string& debug_name); | 58 const std::string& debug_name); |
| 59 virtual ~ContextProviderCommandBuffer(); | 59 ~ContextProviderCommandBuffer() override; |
| 60 | 60 |
| 61 void OnLostContext(); | 61 void OnLostContext(); |
| 62 void OnMemoryAllocationChanged(const gpu::MemoryAllocation& allocation); | 62 void OnMemoryAllocationChanged(const gpu::MemoryAllocation& allocation); |
| 63 | 63 |
| 64 private: | 64 private: |
| 65 void InitializeCapabilities(); | 65 void InitializeCapabilities(); |
| 66 | 66 |
| 67 base::ThreadChecker main_thread_checker_; | 67 base::ThreadChecker main_thread_checker_; |
| 68 base::ThreadChecker context_thread_checker_; | 68 base::ThreadChecker context_thread_checker_; |
| 69 | 69 |
| 70 scoped_ptr<WebGraphicsContext3DCommandBufferImpl> context3d_; | 70 scoped_ptr<WebGraphicsContext3DCommandBufferImpl> context3d_; |
| 71 scoped_ptr<webkit::gpu::GrContextForWebGraphicsContext3D> gr_context_; | 71 scoped_ptr<webkit::gpu::GrContextForWebGraphicsContext3D> gr_context_; |
| 72 | 72 |
| 73 cc::ContextProvider::Capabilities capabilities_; | 73 cc::ContextProvider::Capabilities capabilities_; |
| 74 std::string debug_name_; | 74 std::string debug_name_; |
| 75 | 75 |
| 76 LostContextCallback lost_context_callback_; | 76 LostContextCallback lost_context_callback_; |
| 77 MemoryPolicyChangedCallback memory_policy_changed_callback_; | 77 MemoryPolicyChangedCallback memory_policy_changed_callback_; |
| 78 | 78 |
| 79 base::Lock main_thread_lock_; | 79 base::Lock main_thread_lock_; |
| 80 bool destroyed_; | 80 bool destroyed_; |
| 81 | 81 |
| 82 class LostContextCallbackProxy; | 82 class LostContextCallbackProxy; |
| 83 scoped_ptr<LostContextCallbackProxy> lost_context_callback_proxy_; | 83 scoped_ptr<LostContextCallbackProxy> lost_context_callback_proxy_; |
| 84 }; | 84 }; |
| 85 | 85 |
| 86 } // namespace content | 86 } // namespace content |
| 87 | 87 |
| 88 #endif // CONTENT_COMMON_GPU_CLIENT_CONTEXT_PROVIDER_COMMAND_BUFFER | 88 #endif // CONTENT_COMMON_GPU_CLIENT_CONTEXT_PROVIDER_COMMAND_BUFFER |
| OLD | NEW |