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

Unified Diff: blimp/client/compositor/blimp_context_provider.h

Issue 1295243003: Initial commit of the blimp/ folder and target (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address final nits. Created 5 years, 3 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 side-by-side diff with in-line comments
Download patch
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..922ae4db7320dd049601c7170fa5ce9d3ae47820 100644
--- a/android_webview/browser/aw_render_thread_context_provider.h
+++ b/blimp/client/compositor/blimp_context_provider.h
@@ -2,41 +2,29 @@
// 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"
-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(
+ gfx::AcceleratedWidget widget);
- private:
- AwRenderThreadContextProvider(
- scoped_refptr<gfx::GLSurface> surface,
- scoped_refptr<gpu::InProcessCommandBuffer::Service> service);
- ~AwRenderThreadContextProvider() override;
-
- // cc::ContextProvider:
+ // cc::ContextProvider implementation.
bool BindToCurrentThread() override;
+ void DetachFromThread() override;
Capabilities ContextCapabilities() override;
gpu::gles2::GLES2Interface* ContextGL() override;
gpu::ContextSupport* ContextSupport() override;
@@ -53,10 +41,17 @@ class AwRenderThreadContextProvider : public cc::ContextProvider {
const MemoryPolicyChangedCallback& memory_policy_changed_callback)
override;
+ protected:
+ explicit BlimpContextProvider(gfx::AcceleratedWidget widget);
+ ~BlimpContextProvider() override;
+
+ private:
void OnLostContext();
base::ThreadChecker main_thread_checker_;
+ base::ThreadChecker context_thread_checker_;
+ base::Lock context_lock_;
scoped_ptr<gpu::GLInProcessContext> context_;
skia::RefPtr<class GrContext> gr_context_;
@@ -64,13 +59,12 @@ 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_

Powered by Google App Engine
This is Rietveld 408576698