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.
5 #ifndef CONTENT_BROWSER_ANDROID_IN_PROCESS_CONTEXT_PROVIDER_IN_PROCESS_H_
6 #define CONTENT_BROWSER_ANDROID_IN_PROCESS_CONTEXT_PROVIDER_IN_PROCESS_H_
10 #include "base/macros.h"
11 #include "base/memory/scoped_ptr.h"
12 #include "base/synchronization/lock.h"
13 #include "base/threading/thread_checker.h"
14 #include "cc/blink/context_provider_web_context.h"
16 namespace blink
{ class WebGraphicsContext3D
; }
19 class WebGraphicsContext3DInProcessCommandBufferImpl
;
24 class GrContextForWebGraphicsContext3D
;
26 class ContextProviderInProcess
27 : NON_EXPORTED_BASE(public cc_blink::ContextProviderWebContext
) {
29 static scoped_refptr
<ContextProviderInProcess
> Create(
30 scoped_ptr
<gpu_blink::WebGraphicsContext3DInProcessCommandBufferImpl
>
32 const std::string
& debug_name
);
35 ContextProviderInProcess(
36 scoped_ptr
<gpu_blink::WebGraphicsContext3DInProcessCommandBufferImpl
>
38 const std::string
& debug_name
);
39 ~ContextProviderInProcess() override
;
41 // cc_blink::ContextProviderWebContext:
42 blink::WebGraphicsContext3D
* WebContext3D() override
;
44 // cc::ContextProvider:
45 bool BindToCurrentThread() override
;
46 void DetachFromThread() override
;
47 Capabilities
ContextCapabilities() override
;
48 ::gpu::gles2::GLES2Interface
* ContextGL() override
;
49 ::gpu::ContextSupport
* ContextSupport() override
;
50 class GrContext
* GrContext() override
;
51 void InvalidateGrContext(uint32_t state
) override
;
52 void SetupLock() override
;
53 base::Lock
* GetLock() override
;
54 void VerifyContexts() override
;
55 void DeleteCachedResources() override
;
56 bool DestroyedOnMainThread() override
;
57 void SetLostContextCallback(
58 const LostContextCallback
& lost_context_callback
) override
;
59 void SetMemoryPolicyChangedCallback(
60 const MemoryPolicyChangedCallback
& memory_policy_changed_callback
)
64 void InitializeCapabilities();
66 base::ThreadChecker main_thread_checker_
;
67 base::ThreadChecker context_thread_checker_
;
69 scoped_ptr
<gpu_blink::WebGraphicsContext3DInProcessCommandBufferImpl
>
71 scoped_ptr
<GrContextForWebGraphicsContext3D
> gr_context_
;
73 LostContextCallback lost_context_callback_
;
75 base::Lock destroyed_lock_
;
78 base::Lock context_lock_
;
79 std::string debug_name_
;
80 class LostContextCallbackProxy
;
81 scoped_ptr
<LostContextCallbackProxy
> lost_context_callback_proxy_
;
83 cc::ContextProvider::Capabilities capabilities_
;
85 DISALLOW_COPY_AND_ASSIGN(ContextProviderInProcess
);
88 } // namespace content
90 #endif // CONTENT_BROWSER_ANDROID_IN_PROCESS_CONTEXT_PROVIDER_IN_PROCESS_H_