| 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_H_ | 5 #ifndef CONTENT_COMMON_GPU_CLIENT_CONTEXT_PROVIDER_COMMAND_BUFFER_H_ |
| 6 #define CONTENT_COMMON_GPU_CLIENT_CONTEXT_PROVIDER_COMMAND_BUFFER_H_ | 6 #define CONTENT_COMMON_GPU_CLIENT_CONTEXT_PROVIDER_COMMAND_BUFFER_H_ |
| 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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 bool DestroyedOnMainThread() override; | 48 bool DestroyedOnMainThread() override; |
| 49 void SetLostContextCallback( | 49 void SetLostContextCallback( |
| 50 const LostContextCallback& lost_context_callback) override; | 50 const LostContextCallback& lost_context_callback) override; |
| 51 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 CommandBufferContextType type); | 58 CommandBufferContextType type, |
| 59 bool enable_memory_allocation_callback); |
| 59 ~ContextProviderCommandBuffer() override; | 60 ~ContextProviderCommandBuffer() override; |
| 60 | 61 |
| 61 void OnLostContext(); | 62 void OnLostContext(); |
| 62 void OnMemoryAllocationChanged(const gpu::MemoryAllocation& allocation); | 63 void OnMemoryAllocationChanged(const gpu::MemoryAllocation& allocation); |
| 63 | 64 |
| 64 private: | 65 private: |
| 65 void InitializeCapabilities(); | 66 void InitializeCapabilities(); |
| 66 | 67 |
| 67 base::ThreadChecker main_thread_checker_; | 68 base::ThreadChecker main_thread_checker_; |
| 68 base::ThreadChecker context_thread_checker_; | 69 base::ThreadChecker context_thread_checker_; |
| 69 | 70 |
| 70 scoped_ptr<WebGraphicsContext3DCommandBufferImpl> context3d_; | 71 scoped_ptr<WebGraphicsContext3DCommandBufferImpl> context3d_; |
| 71 scoped_ptr<GrContextForWebGraphicsContext3D> gr_context_; | 72 scoped_ptr<GrContextForWebGraphicsContext3D> gr_context_; |
| 72 | 73 |
| 73 cc::ContextProvider::Capabilities capabilities_; | 74 cc::ContextProvider::Capabilities capabilities_; |
| 74 CommandBufferContextType context_type_; | 75 CommandBufferContextType context_type_; |
| 75 std::string debug_name_; | 76 std::string debug_name_; |
| 76 | 77 |
| 77 LostContextCallback lost_context_callback_; | 78 LostContextCallback lost_context_callback_; |
| 78 MemoryPolicyChangedCallback memory_policy_changed_callback_; | 79 MemoryPolicyChangedCallback memory_policy_changed_callback_; |
| 80 const bool enable_memory_allocation_callback_; |
| 79 | 81 |
| 80 base::Lock main_thread_lock_; | 82 base::Lock main_thread_lock_; |
| 81 bool destroyed_; | 83 bool destroyed_; |
| 82 | 84 |
| 83 base::Lock context_lock_; | 85 base::Lock context_lock_; |
| 84 | 86 |
| 85 class LostContextCallbackProxy; | 87 class LostContextCallbackProxy; |
| 86 scoped_ptr<LostContextCallbackProxy> lost_context_callback_proxy_; | 88 scoped_ptr<LostContextCallbackProxy> lost_context_callback_proxy_; |
| 87 }; | 89 }; |
| 88 | 90 |
| 89 } // namespace content | 91 } // namespace content |
| 90 | 92 |
| 91 #endif // CONTENT_COMMON_GPU_CLIENT_CONTEXT_PROVIDER_COMMAND_BUFFER_H_ | 93 #endif // CONTENT_COMMON_GPU_CLIENT_CONTEXT_PROVIDER_COMMAND_BUFFER_H_ |
| OLD | NEW |