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