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_BROWSER_ANDROID_IN_PROCESS_CONTEXT_PROVIDER_IN_PROCESS_H_ | 5 #ifndef CONTENT_BROWSER_ANDROID_IN_PROCESS_CONTEXT_PROVIDER_IN_PROCESS_H_ |
6 #define CONTENT_BROWSER_ANDROID_IN_PROCESS_CONTEXT_PROVIDER_IN_PROCESS_H_ | 6 #define CONTENT_BROWSER_ANDROID_IN_PROCESS_CONTEXT_PROVIDER_IN_PROCESS_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
12 #include "base/synchronization/lock.h" | 12 #include "base/synchronization/lock.h" |
13 #include "base/threading/thread_checker.h" | 13 #include "base/threading/thread_checker.h" |
14 #include "cc/blink/context_provider_web_context.h" | 14 #include "cc/blink/context_provider_web_context.h" |
15 #include "skia/ext/refptr.h" | |
16 | 15 |
17 namespace blink { class WebGraphicsContext3D; } | 16 namespace blink { class WebGraphicsContext3D; } |
18 | 17 |
19 namespace gpu_blink { | 18 namespace gpu_blink { |
20 class WebGraphicsContext3DInProcessCommandBufferImpl; | 19 class WebGraphicsContext3DInProcessCommandBufferImpl; |
21 } | 20 } |
22 | 21 |
23 namespace content { | 22 namespace content { |
24 | 23 |
25 class GrContextForWebGraphicsContext3D; | 24 class GrContextForWebGraphicsContext3D; |
26 class GrGLInterfaceForWebGraphicsContext3D; | |
27 | 25 |
28 class ContextProviderInProcess | 26 class ContextProviderInProcess |
29 : NON_EXPORTED_BASE(public cc_blink::ContextProviderWebContext) { | 27 : NON_EXPORTED_BASE(public cc_blink::ContextProviderWebContext) { |
30 public: | 28 public: |
31 static scoped_refptr<ContextProviderInProcess> Create( | 29 static scoped_refptr<ContextProviderInProcess> Create( |
32 scoped_ptr<gpu_blink::WebGraphicsContext3DInProcessCommandBufferImpl> | 30 scoped_ptr<gpu_blink::WebGraphicsContext3DInProcessCommandBufferImpl> |
33 context3d, | 31 context3d, |
34 const std::string& debug_name); | 32 const std::string& debug_name); |
35 | 33 |
36 private: | 34 private: |
37 ContextProviderInProcess( | 35 ContextProviderInProcess( |
38 scoped_ptr<gpu_blink::WebGraphicsContext3DInProcessCommandBufferImpl> | 36 scoped_ptr<gpu_blink::WebGraphicsContext3DInProcessCommandBufferImpl> |
39 context3d, | 37 context3d, |
40 const std::string& debug_name); | 38 const std::string& debug_name); |
41 ~ContextProviderInProcess() override; | 39 ~ContextProviderInProcess() override; |
42 | 40 |
43 // cc_blink::ContextProviderWebContext: | 41 // cc_blink::ContextProviderWebContext: |
44 blink::WebGraphicsContext3D* WebContext3D() override; | 42 blink::WebGraphicsContext3D* WebContext3D() override; |
45 | 43 |
46 gpu_blink::WebGraphicsContext3DInProcessCommandBufferImpl* WebContext3DImpl(); | |
47 | |
48 // cc::ContextProvider: | 44 // cc::ContextProvider: |
49 bool BindToCurrentThread() override; | 45 bool BindToCurrentThread() override; |
50 void DetachFromThread() override; | 46 void DetachFromThread() override; |
51 Capabilities ContextCapabilities() override; | 47 Capabilities ContextCapabilities() override; |
52 ::gpu::gles2::GLES2Interface* ContextGL() override; | 48 ::gpu::gles2::GLES2Interface* ContextGL() override; |
53 ::gpu::ContextSupport* ContextSupport() override; | 49 ::gpu::ContextSupport* ContextSupport() override; |
54 class GrContext* GrContext() override; | 50 class GrContext* GrContext() override; |
55 void InvalidateGrContext(uint32_t state) override; | 51 void InvalidateGrContext(uint32_t state) override; |
56 void SetupLock() override; | 52 void SetupLock() override; |
57 base::Lock* GetLock() override; | 53 base::Lock* GetLock() override; |
58 void DeleteCachedResources() override; | 54 void DeleteCachedResources() override; |
59 void SetLostContextCallback( | 55 void SetLostContextCallback( |
60 const LostContextCallback& lost_context_callback) override; | 56 const LostContextCallback& lost_context_callback) override; |
61 | 57 |
62 void OnLostContext(); | 58 void OnLostContext(); |
63 void InitializeCapabilities(); | 59 void InitializeCapabilities(); |
64 | 60 |
65 base::ThreadChecker main_thread_checker_; | 61 base::ThreadChecker main_thread_checker_; |
66 base::ThreadChecker context_thread_checker_; | 62 base::ThreadChecker context_thread_checker_; |
67 | 63 |
68 skia::RefPtr<GrGLInterfaceForWebGraphicsContext3D> gr_interface_; | 64 scoped_ptr<gpu_blink::WebGraphicsContext3DInProcessCommandBufferImpl> |
| 65 context3d_; |
69 scoped_ptr<GrContextForWebGraphicsContext3D> gr_context_; | 66 scoped_ptr<GrContextForWebGraphicsContext3D> gr_context_; |
70 | 67 |
71 LostContextCallback lost_context_callback_; | 68 LostContextCallback lost_context_callback_; |
72 | 69 |
73 base::Lock context_lock_; | 70 base::Lock context_lock_; |
74 std::string debug_name_; | 71 std::string debug_name_; |
75 class LostContextCallbackProxy; | 72 class LostContextCallbackProxy; |
76 scoped_ptr<LostContextCallbackProxy> lost_context_callback_proxy_; | 73 scoped_ptr<LostContextCallbackProxy> lost_context_callback_proxy_; |
77 | 74 |
78 cc::ContextProvider::Capabilities capabilities_; | 75 cc::ContextProvider::Capabilities capabilities_; |
79 | 76 |
80 DISALLOW_COPY_AND_ASSIGN(ContextProviderInProcess); | 77 DISALLOW_COPY_AND_ASSIGN(ContextProviderInProcess); |
81 }; | 78 }; |
82 | 79 |
83 } // namespace content | 80 } // namespace content |
84 | 81 |
85 #endif // CONTENT_BROWSER_ANDROID_IN_PROCESS_CONTEXT_PROVIDER_IN_PROCESS_H_ | 82 #endif // CONTENT_BROWSER_ANDROID_IN_PROCESS_CONTEXT_PROVIDER_IN_PROCESS_H_ |
OLD | NEW |