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