Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(84)

Side by Side Diff: android_webview/browser/aw_render_thread_context_provider.h

Issue 1083843002: android_webview: Remove dependency on webkit's ContextProviderInProcess. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: for real Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 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 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 UI_COMPOSITOR_TEST_IN_PROCESS_CONTEXT_PROVIDER_H_ 5 #ifndef ANDROID_WEBVIEW_BROWSER_AW_RENDER_THREAD_CONTEXT_PROVIDER_H_
6 #define UI_COMPOSITOR_TEST_IN_PROCESS_CONTEXT_PROVIDER_H_ 6 #define ANDROID_WEBVIEW_BROWSER_AW_RENDER_THREAD_CONTEXT_PROVIDER_H_
7
8 #include <string>
9 7
10 #include "base/macros.h" 8 #include "base/macros.h"
11 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
12 #include "base/synchronization/lock.h" 10 #include "base/synchronization/lock.h"
13 #include "base/threading/thread_checker.h" 11 #include "base/threading/thread_checker.h"
14 #include "cc/output/context_provider.h" 12 #include "cc/output/context_provider.h"
15 #include "gpu/command_buffer/common/gles2_cmd_utils.h" 13 #include "gpu/command_buffer/service/in_process_command_buffer.h"
16 #include "skia/ext/refptr.h" 14 #include "skia/ext/refptr.h"
17 #include "ui/gfx/native_widget_types.h" 15
16 namespace gfx {
17 class GLSurface;
18 }
18 19
19 namespace gpu { 20 namespace gpu {
20 class GLInProcessContext; 21 class GLInProcessContext;
21 } 22 }
22 23
23 namespace ui { 24 namespace android_webview {
24 25
25 class InProcessContextProvider : public cc::ContextProvider { 26 class AwRenderThreadContextProvider : public cc::ContextProvider {
26 public: 27 public:
27 static scoped_refptr<InProcessContextProvider> Create( 28 static scoped_refptr<AwRenderThreadContextProvider> Create(
28 const gpu::gles2::ContextCreationAttribHelper& attribs, 29 scoped_refptr<gfx::GLSurface> surface,
29 bool lose_context_when_out_of_memory, 30 scoped_refptr<gpu::InProcessCommandBuffer::Service> service);
30 gfx::AcceleratedWidget window,
31 const std::string& debug_name);
32
33 // Uses default attributes for creating an offscreen context.
34 static scoped_refptr<InProcessContextProvider> CreateOffscreen(
35 bool lose_context_when_out_of_memory);
36 31
37 private: 32 private:
38 InProcessContextProvider( 33 AwRenderThreadContextProvider(
39 const gpu::gles2::ContextCreationAttribHelper& attribs, 34 scoped_refptr<gfx::GLSurface> surface,
40 bool lose_context_when_out_of_memory, 35 scoped_refptr<gpu::InProcessCommandBuffer::Service> service);
41 gfx::AcceleratedWidget window, 36 ~AwRenderThreadContextProvider() override;
42 const std::string& debug_name);
43 ~InProcessContextProvider() override;
44 37
45 // cc::ContextProvider: 38 // cc::ContextProvider:
46 bool BindToCurrentThread() override; 39 bool BindToCurrentThread() override;
47 Capabilities ContextCapabilities() override; 40 Capabilities ContextCapabilities() override;
48 gpu::gles2::GLES2Interface* ContextGL() override; 41 gpu::gles2::GLES2Interface* ContextGL() override;
49 gpu::ContextSupport* ContextSupport() override; 42 gpu::ContextSupport* ContextSupport() override;
50 class GrContext* GrContext() override; 43 class GrContext* GrContext() override;
51 void SetupLock() override; 44 void SetupLock() override;
52 base::Lock* GetLock() override; 45 base::Lock* GetLock() override;
53 bool IsContextLost() override; 46 bool IsContextLost() override;
54 void VerifyContexts() override; 47 void VerifyContexts() override;
55 void DeleteCachedResources() override; 48 void DeleteCachedResources() override;
56 bool DestroyedOnMainThread() override; 49 bool DestroyedOnMainThread() override;
57 void SetLostContextCallback( 50 void SetLostContextCallback(
58 const LostContextCallback& lost_context_callback) override; 51 const LostContextCallback& lost_context_callback) override;
59 void SetMemoryPolicyChangedCallback( 52 void SetMemoryPolicyChangedCallback(
60 const MemoryPolicyChangedCallback& memory_policy_changed_callback) 53 const MemoryPolicyChangedCallback& memory_policy_changed_callback)
61 override; 54 override;
62 55
63 void OnLostContext(); 56 void OnLostContext();
64 57
65 base::ThreadChecker main_thread_checker_; 58 base::ThreadChecker main_thread_checker_;
66 base::ThreadChecker context_thread_checker_;
67 59
68 scoped_ptr<gpu::GLInProcessContext> context_; 60 scoped_ptr<gpu::GLInProcessContext> context_;
69 skia::RefPtr<class GrContext> gr_context_; 61 skia::RefPtr<class GrContext> gr_context_;
70 62
71 gpu::gles2::ContextCreationAttribHelper attribs_;
72 bool lose_context_when_out_of_memory_;
73 gfx::AcceleratedWidget window_;
74 std::string debug_name_;
75 cc::ContextProvider::Capabilities capabilities_; 63 cc::ContextProvider::Capabilities capabilities_;
76 64
77 LostContextCallback lost_context_callback_; 65 LostContextCallback lost_context_callback_;
78 66
79 base::Lock destroyed_lock_;
80 bool destroyed_; 67 bool destroyed_;
81 68
82 base::Lock context_lock_; 69 base::Lock context_lock_;
83 70
84 DISALLOW_COPY_AND_ASSIGN(InProcessContextProvider); 71 DISALLOW_COPY_AND_ASSIGN(AwRenderThreadContextProvider);
85 }; 72 };
86 73
87 } // namespace ui 74 } // namespace android_webview
88 75
89 #endif // UI_COMPOSITOR_TEST_IN_PROCESS_CONTEXT_PROVIDER_H_ 76 #endif // ANDROID_WEBVIEW_BROWSER_AW_RENDER_THREAD_CONTEXT_PROVIDER_H_
OLDNEW
« no previous file with comments | « android_webview/browser/DEPS ('k') | android_webview/browser/aw_render_thread_context_provider.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698