Returning scoped_ptr instead of raw pointer in SpdySessionPoolInfoToValue() in net/
[chromium-blink-merge.git] / android_webview / browser / aw_render_thread_context_provider.h
blob7501a1b39baa4a977a563f733fabf9dcc7c62a8a
1 // Copyright 2015 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 ANDROID_WEBVIEW_BROWSER_AW_RENDER_THREAD_CONTEXT_PROVIDER_H_
6 #define ANDROID_WEBVIEW_BROWSER_AW_RENDER_THREAD_CONTEXT_PROVIDER_H_
8 #include "base/macros.h"
9 #include "base/memory/scoped_ptr.h"
10 #include "base/synchronization/lock.h"
11 #include "base/threading/thread_checker.h"
12 #include "cc/output/context_provider.h"
13 #include "gpu/command_buffer/service/in_process_command_buffer.h"
14 #include "skia/ext/refptr.h"
16 namespace gfx {
17 class GLSurface;
20 namespace gpu {
21 class GLInProcessContext;
24 namespace android_webview {
26 class AwRenderThreadContextProvider : public cc::ContextProvider {
27 public:
28 static scoped_refptr<AwRenderThreadContextProvider> Create(
29 scoped_refptr<gfx::GLSurface> surface,
30 scoped_refptr<gpu::InProcessCommandBuffer::Service> service);
32 private:
33 AwRenderThreadContextProvider(
34 scoped_refptr<gfx::GLSurface> surface,
35 scoped_refptr<gpu::InProcessCommandBuffer::Service> service);
36 ~AwRenderThreadContextProvider() override;
38 // cc::ContextProvider:
39 bool BindToCurrentThread() override;
40 Capabilities ContextCapabilities() override;
41 gpu::gles2::GLES2Interface* ContextGL() override;
42 gpu::ContextSupport* ContextSupport() override;
43 class GrContext* GrContext() override;
44 void InvalidateGrContext(uint32_t state) override;
45 void SetupLock() override;
46 base::Lock* GetLock() override;
47 bool IsContextLost() override;
48 void VerifyContexts() override;
49 void DeleteCachedResources() override;
50 bool DestroyedOnMainThread() override;
51 void SetLostContextCallback(
52 const LostContextCallback& lost_context_callback) override;
53 void SetMemoryPolicyChangedCallback(
54 const MemoryPolicyChangedCallback& memory_policy_changed_callback)
55 override;
57 void OnLostContext();
59 base::ThreadChecker main_thread_checker_;
61 scoped_ptr<gpu::GLInProcessContext> context_;
62 skia::RefPtr<class GrContext> gr_context_;
64 cc::ContextProvider::Capabilities capabilities_;
66 LostContextCallback lost_context_callback_;
68 bool destroyed_;
70 base::Lock context_lock_;
72 DISALLOW_COPY_AND_ASSIGN(AwRenderThreadContextProvider);
75 } // namespace android_webview
77 #endif // ANDROID_WEBVIEW_BROWSER_AW_RENDER_THREAD_CONTEXT_PROVIDER_H_