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" |
11 #include "base/threading/thread_checker.h" | 11 #include "base/threading/thread_checker.h" |
12 #include "cc/blink/context_provider_web_context.h" | 12 #include "cc/blink/context_provider_web_context.h" |
13 #include "cc/output/context_provider.h" | 13 #include "cc/output/context_provider.h" |
14 #include "content/common/content_export.h" | 14 #include "content/common/content_export.h" |
15 #include "content/common/gpu/client/command_buffer_metrics.h" | 15 #include "content/common/gpu/client/command_buffer_metrics.h" |
16 #include "content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h" | 16 #include "content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h" |
17 | 17 |
18 namespace webkit { | 18 namespace content { |
19 namespace gpu { | 19 |
20 class GrContextForWebGraphicsContext3D; | 20 class GrContextForWebGraphicsContext3D; |
21 } | |
22 } | |
23 | |
24 namespace content { | |
25 | 21 |
26 // Implementation of cc::ContextProvider that provides a | 22 // Implementation of cc::ContextProvider that provides a |
27 // WebGraphicsContext3DCommandBufferImpl context and a GrContext. | 23 // WebGraphicsContext3DCommandBufferImpl context and a GrContext. |
28 class CONTENT_EXPORT ContextProviderCommandBuffer | 24 class CONTENT_EXPORT ContextProviderCommandBuffer |
29 : NON_EXPORTED_BASE(public cc_blink::ContextProviderWebContext) { | 25 : NON_EXPORTED_BASE(public cc_blink::ContextProviderWebContext) { |
30 public: | 26 public: |
31 static scoped_refptr<ContextProviderCommandBuffer> Create( | 27 static scoped_refptr<ContextProviderCommandBuffer> Create( |
32 scoped_ptr<WebGraphicsContext3DCommandBufferImpl> context3d, | 28 scoped_ptr<WebGraphicsContext3DCommandBufferImpl> context3d, |
33 CommandBufferContextType type); | 29 CommandBufferContextType type); |
34 | 30 |
(...skipping 30 matching lines...) Loading... |
65 void OnLostContext(); | 61 void OnLostContext(); |
66 void OnMemoryAllocationChanged(const gpu::MemoryAllocation& allocation); | 62 void OnMemoryAllocationChanged(const gpu::MemoryAllocation& allocation); |
67 | 63 |
68 private: | 64 private: |
69 void InitializeCapabilities(); | 65 void InitializeCapabilities(); |
70 | 66 |
71 base::ThreadChecker main_thread_checker_; | 67 base::ThreadChecker main_thread_checker_; |
72 base::ThreadChecker context_thread_checker_; | 68 base::ThreadChecker context_thread_checker_; |
73 | 69 |
74 scoped_ptr<WebGraphicsContext3DCommandBufferImpl> context3d_; | 70 scoped_ptr<WebGraphicsContext3DCommandBufferImpl> context3d_; |
75 scoped_ptr<webkit::gpu::GrContextForWebGraphicsContext3D> gr_context_; | 71 scoped_ptr<GrContextForWebGraphicsContext3D> gr_context_; |
76 | 72 |
77 cc::ContextProvider::Capabilities capabilities_; | 73 cc::ContextProvider::Capabilities capabilities_; |
78 CommandBufferContextType context_type_; | 74 CommandBufferContextType context_type_; |
79 std::string debug_name_; | 75 std::string debug_name_; |
80 | 76 |
81 LostContextCallback lost_context_callback_; | 77 LostContextCallback lost_context_callback_; |
82 MemoryPolicyChangedCallback memory_policy_changed_callback_; | 78 MemoryPolicyChangedCallback memory_policy_changed_callback_; |
83 | 79 |
84 base::Lock main_thread_lock_; | 80 base::Lock main_thread_lock_; |
85 bool destroyed_; | 81 bool destroyed_; |
86 | 82 |
87 base::Lock context_lock_; | 83 base::Lock context_lock_; |
88 | 84 |
89 class LostContextCallbackProxy; | 85 class LostContextCallbackProxy; |
90 scoped_ptr<LostContextCallbackProxy> lost_context_callback_proxy_; | 86 scoped_ptr<LostContextCallbackProxy> lost_context_callback_proxy_; |
91 }; | 87 }; |
92 | 88 |
93 } // namespace content | 89 } // namespace content |
94 | 90 |
95 #endif // CONTENT_COMMON_GPU_CLIENT_CONTEXT_PROVIDER_COMMAND_BUFFER_H_ | 91 #endif // CONTENT_COMMON_GPU_CLIENT_CONTEXT_PROVIDER_COMMAND_BUFFER_H_ |
OLD | NEW |