| 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 WEBKIT_COMMON_GPU_CONTEXT_PROVIDER_IN_PROCESS_H_ | 5 #ifndef ANDROID_WEBVIEW_BROWSER_CONTEXT_PROVIDER_IN_PROCESS_H_ |
| 6 #define WEBKIT_COMMON_GPU_CONTEXT_PROVIDER_IN_PROCESS_H_ | 6 #define ANDROID_WEBVIEW_BROWSER_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 "webkit/common/gpu/webkit_gpu_export.h" | 15 #include "skia/ext/refptr.h" |
| 16 | 16 |
| 17 namespace blink { class WebGraphicsContext3D; } | 17 namespace blink { class WebGraphicsContext3D; } |
| 18 | 18 |
| 19 namespace gpu_blink { | 19 namespace gpu_blink { |
| 20 class WebGraphicsContext3DInProcessCommandBufferImpl; | 20 class WebGraphicsContext3DInProcessCommandBufferImpl; |
| 21 } | 21 } |
| 22 | 22 |
| 23 namespace webkit { | 23 namespace android_webview { |
| 24 namespace gpu { | |
| 25 class GrContextForWebGraphicsContext3D; | |
| 26 | 24 |
| 27 class WEBKIT_GPU_EXPORT ContextProviderInProcess | 25 class ContextProviderInProcess |
| 28 : NON_EXPORTED_BASE(public cc_blink::ContextProviderWebContext) { | 26 : NON_EXPORTED_BASE(public cc_blink::ContextProviderWebContext) { |
| 29 public: | 27 public: |
| 30 static scoped_refptr<ContextProviderInProcess> Create( | 28 static scoped_refptr<ContextProviderInProcess> Create( |
| 31 scoped_ptr<gpu_blink::WebGraphicsContext3DInProcessCommandBufferImpl> | 29 scoped_ptr<gpu_blink::WebGraphicsContext3DInProcessCommandBufferImpl> |
| 32 context3d, | 30 context3d, |
| 33 const std::string& debug_name); | 31 const std::string& debug_name); |
| 34 | 32 |
| 35 // Uses default attributes for creating an offscreen context. | |
| 36 static scoped_refptr<ContextProviderInProcess> CreateOffscreen( | |
| 37 bool lose_context_when_out_of_memory); | |
| 38 | |
| 39 private: | 33 private: |
| 40 ContextProviderInProcess( | 34 ContextProviderInProcess( |
| 41 scoped_ptr<gpu_blink::WebGraphicsContext3DInProcessCommandBufferImpl> | 35 scoped_ptr<gpu_blink::WebGraphicsContext3DInProcessCommandBufferImpl> |
| 42 context3d, | 36 context3d, |
| 43 const std::string& debug_name); | 37 const std::string& debug_name); |
| 44 ~ContextProviderInProcess() override; | 38 ~ContextProviderInProcess() override; |
| 45 | 39 |
| 46 // cc_blink::ContextProviderWebContext: | 40 // cc_blink::ContextProviderWebContext: |
| 47 blink::WebGraphicsContext3D* WebContext3D() override; | 41 blink::WebGraphicsContext3D* WebContext3D() override; |
| 48 | 42 |
| (...skipping 17 matching lines...) Expand all Loading... |
| 66 override; | 60 override; |
| 67 | 61 |
| 68 void OnLostContext(); | 62 void OnLostContext(); |
| 69 void InitializeCapabilities(); | 63 void InitializeCapabilities(); |
| 70 | 64 |
| 71 base::ThreadChecker main_thread_checker_; | 65 base::ThreadChecker main_thread_checker_; |
| 72 base::ThreadChecker context_thread_checker_; | 66 base::ThreadChecker context_thread_checker_; |
| 73 | 67 |
| 74 scoped_ptr<gpu_blink::WebGraphicsContext3DInProcessCommandBufferImpl> | 68 scoped_ptr<gpu_blink::WebGraphicsContext3DInProcessCommandBufferImpl> |
| 75 context3d_; | 69 context3d_; |
| 76 scoped_ptr<GrContextForWebGraphicsContext3D> gr_context_; | 70 skia::RefPtr<class GrContext> gr_context_; |
| 77 | 71 |
| 78 LostContextCallback lost_context_callback_; | 72 LostContextCallback lost_context_callback_; |
| 79 | 73 |
| 80 base::Lock destroyed_lock_; | 74 base::Lock destroyed_lock_; |
| 81 bool destroyed_; | 75 bool destroyed_; |
| 82 | 76 |
| 83 base::Lock context_lock_; | 77 base::Lock context_lock_; |
| 84 std::string debug_name_; | 78 std::string debug_name_; |
| 85 class LostContextCallbackProxy; | 79 class LostContextCallbackProxy; |
| 86 scoped_ptr<LostContextCallbackProxy> lost_context_callback_proxy_; | 80 scoped_ptr<LostContextCallbackProxy> lost_context_callback_proxy_; |
| 87 | 81 |
| 88 cc::ContextProvider::Capabilities capabilities_; | 82 cc::ContextProvider::Capabilities capabilities_; |
| 89 | 83 |
| 90 DISALLOW_COPY_AND_ASSIGN(ContextProviderInProcess); | 84 DISALLOW_COPY_AND_ASSIGN(ContextProviderInProcess); |
| 91 }; | 85 }; |
| 92 | 86 |
| 93 } // namespace gpu | 87 } // namespace android_webview |
| 94 } // namespace webkit | |
| 95 | 88 |
| 96 #endif // WEBKIT_COMMON_GPU_CONTEXT_PROVIDER_IN_PROCESS_H_ | 89 #endif // ANDROID_WEBVIEW_BROWSER_CONTEXT_PROVIDER_IN_PROCESS_H_ |
| OLD | NEW |