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