Chromium Code Reviews| Index: blimp/client/compositor/blimp_context_provider.h |
| diff --git a/android_webview/browser/aw_render_thread_context_provider.h b/blimp/client/compositor/blimp_context_provider.h |
| similarity index 60% |
| copy from android_webview/browser/aw_render_thread_context_provider.h |
| copy to blimp/client/compositor/blimp_context_provider.h |
| index 24c1463ecd81628528e85827f9ee56fa4dad41f3..ad3d4487389cfef42a89418aa98158b0644f845d 100644 |
| --- a/android_webview/browser/aw_render_thread_context_provider.h |
| +++ b/blimp/client/compositor/blimp_context_provider.h |
| @@ -2,41 +2,32 @@ |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| -#ifndef ANDROID_WEBVIEW_BROWSER_AW_RENDER_THREAD_CONTEXT_PROVIDER_H_ |
| -#define ANDROID_WEBVIEW_BROWSER_AW_RENDER_THREAD_CONTEXT_PROVIDER_H_ |
| +#ifndef BLIMP_CLIENT_COMPOSITOR_BLIMP_CONTEXT_PROVIDER_H_ |
| +#define BLIMP_CLIENT_COMPOSITOR_BLIMP_CONTEXT_PROVIDER_H_ |
| #include "base/macros.h" |
| #include "base/memory/scoped_ptr.h" |
| #include "base/synchronization/lock.h" |
| #include "base/threading/thread_checker.h" |
| #include "cc/output/context_provider.h" |
| -#include "gpu/command_buffer/service/in_process_command_buffer.h" |
| +#include "gpu/command_buffer/client/gl_in_process_context.h" |
| #include "skia/ext/refptr.h" |
| +#include "ui/gl/gl_surface.h" |
| +#include "ui/gl/gl_surface.h" |
| -namespace gfx { |
| -class GLSurface; |
| -} |
| +namespace blimp { |
| -namespace gpu { |
| -class GLInProcessContext; |
| -} |
| - |
| -namespace android_webview { |
| - |
| -class AwRenderThreadContextProvider : public cc::ContextProvider { |
| +// Helper class to provide a graphics context for the compositor. |
| +class BlimpContextProvider : public cc::ContextProvider { |
| public: |
| - static scoped_refptr<AwRenderThreadContextProvider> Create( |
| - scoped_refptr<gfx::GLSurface> surface, |
| - scoped_refptr<gpu::InProcessCommandBuffer::Service> service); |
| + static scoped_refptr<BlimpContextProvider> Create( |
|
Wez
2015/08/27 02:01:52
n00b: cc::ContextProvider is ref-counted? *sob*
David Trainor- moved to gerrit
2015/08/28 01:23:47
:'(
|
| + gfx::AcceleratedWidget widget); |
| - private: |
| - AwRenderThreadContextProvider( |
| - scoped_refptr<gfx::GLSurface> surface, |
| - scoped_refptr<gpu::InProcessCommandBuffer::Service> service); |
| - ~AwRenderThreadContextProvider() override; |
| + void OnLostContext(); |
| - // cc::ContextProvider: |
| + // cc::ContextProvider ------------------------------------------------------- |
| bool BindToCurrentThread() override; |
| + void DetachFromThread() override; |
| Capabilities ContextCapabilities() override; |
| gpu::gles2::GLES2Interface* ContextGL() override; |
| gpu::ContextSupport* ContextSupport() override; |
| @@ -53,9 +44,13 @@ class AwRenderThreadContextProvider : public cc::ContextProvider { |
| const MemoryPolicyChangedCallback& memory_policy_changed_callback) |
| override; |
| - void OnLostContext(); |
| + protected: |
| + explicit BlimpContextProvider(gfx::AcceleratedWidget widget); |
| + ~BlimpContextProvider() override; |
| + private: |
| base::ThreadChecker main_thread_checker_; |
| + base::ThreadChecker context_thread_checker_; |
| scoped_ptr<gpu::GLInProcessContext> context_; |
| skia::RefPtr<class GrContext> gr_context_; |
| @@ -64,13 +59,14 @@ class AwRenderThreadContextProvider : public cc::ContextProvider { |
| LostContextCallback lost_context_callback_; |
| + base::Lock destroyed_lock_; |
| bool destroyed_; |
| base::Lock context_lock_; |
| - DISALLOW_COPY_AND_ASSIGN(AwRenderThreadContextProvider); |
| + DISALLOW_COPY_AND_ASSIGN(BlimpContextProvider); |
| }; |
| -} // namespace android_webview |
| +} // namespace blimp |
| -#endif // ANDROID_WEBVIEW_BROWSER_AW_RENDER_THREAD_CONTEXT_PROVIDER_H_ |
| +#endif // BLIMP_CLIENT_COMPOSITOR_BLIMP_CONTEXT_PROVIDER_H_ |