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 #include "skia/ext/refptr.h" | |
18 | 17 |
19 namespace content { | 18 namespace content { |
20 | 19 |
21 class GrContextForWebGraphicsContext3D; | 20 class GrContextForWebGraphicsContext3D; |
22 class GrGLInterfaceForWebGraphicsContext3D; | |
23 | 21 |
24 // Implementation of cc::ContextProvider that provides a | 22 // Implementation of cc::ContextProvider that provides a |
25 // WebGraphicsContext3DCommandBufferImpl context and a GrContext. | 23 // WebGraphicsContext3DCommandBufferImpl context and a GrContext. |
26 class CONTENT_EXPORT ContextProviderCommandBuffer | 24 class CONTENT_EXPORT ContextProviderCommandBuffer |
27 : NON_EXPORTED_BASE(public cc_blink::ContextProviderWebContext) { | 25 : NON_EXPORTED_BASE(public cc_blink::ContextProviderWebContext) { |
28 public: | 26 public: |
29 static scoped_refptr<ContextProviderCommandBuffer> Create( | 27 static scoped_refptr<ContextProviderCommandBuffer> Create( |
30 scoped_ptr<WebGraphicsContext3DCommandBufferImpl> context3d, | 28 scoped_ptr<WebGraphicsContext3DCommandBufferImpl> context3d, |
31 CommandBufferContextType type); | 29 CommandBufferContextType type); |
32 | 30 |
(...skipping 18 matching lines...) Expand all Loading... |
51 | 49 |
52 protected: | 50 protected: |
53 ContextProviderCommandBuffer( | 51 ContextProviderCommandBuffer( |
54 scoped_ptr<WebGraphicsContext3DCommandBufferImpl> context3d, | 52 scoped_ptr<WebGraphicsContext3DCommandBufferImpl> context3d, |
55 CommandBufferContextType type); | 53 CommandBufferContextType type); |
56 ~ContextProviderCommandBuffer() override; | 54 ~ContextProviderCommandBuffer() override; |
57 | 55 |
58 void OnLostContext(); | 56 void OnLostContext(); |
59 | 57 |
60 private: | 58 private: |
61 WebGraphicsContext3DCommandBufferImpl* WebContext3DNoChecks(); | |
62 void InitializeCapabilities(); | 59 void InitializeCapabilities(); |
63 | 60 |
64 base::ThreadChecker main_thread_checker_; | 61 base::ThreadChecker main_thread_checker_; |
65 base::ThreadChecker context_thread_checker_; | 62 base::ThreadChecker context_thread_checker_; |
66 | 63 |
67 skia::RefPtr<GrGLInterfaceForWebGraphicsContext3D> gr_interface_; | 64 scoped_ptr<WebGraphicsContext3DCommandBufferImpl> context3d_; |
68 scoped_ptr<GrContextForWebGraphicsContext3D> gr_context_; | 65 scoped_ptr<GrContextForWebGraphicsContext3D> gr_context_; |
69 | 66 |
70 cc::ContextProvider::Capabilities capabilities_; | 67 cc::ContextProvider::Capabilities capabilities_; |
71 CommandBufferContextType context_type_; | 68 CommandBufferContextType context_type_; |
72 std::string debug_name_; | 69 std::string debug_name_; |
73 | 70 |
74 LostContextCallback lost_context_callback_; | 71 LostContextCallback lost_context_callback_; |
75 | 72 |
76 base::Lock context_lock_; | 73 base::Lock context_lock_; |
77 | 74 |
78 class LostContextCallbackProxy; | 75 class LostContextCallbackProxy; |
79 friend class LostContextCallbackProxy; | |
80 scoped_ptr<LostContextCallbackProxy> lost_context_callback_proxy_; | 76 scoped_ptr<LostContextCallbackProxy> lost_context_callback_proxy_; |
81 }; | 77 }; |
82 | 78 |
83 } // namespace content | 79 } // namespace content |
84 | 80 |
85 #endif // CONTENT_COMMON_GPU_CLIENT_CONTEXT_PROVIDER_COMMAND_BUFFER_H_ | 81 #endif // CONTENT_COMMON_GPU_CLIENT_CONTEXT_PROVIDER_COMMAND_BUFFER_H_ |
OLD | NEW |