Index: content/browser/android/in_process/synchronous_compositor_impl.cc |
diff --git a/content/browser/android/in_process/synchronous_compositor_impl.cc b/content/browser/android/in_process/synchronous_compositor_impl.cc |
index 041511ea0bb65fb22f4d2e5d4a0a7205e0a0d57d..74048d86c84ed5ac477cfc8432c5f0e56d7bf02c 100644 |
--- a/content/browser/android/in_process/synchronous_compositor_impl.cc |
+++ b/content/browser/android/in_process/synchronous_compositor_impl.cc |
@@ -66,10 +66,16 @@ class SynchronousCompositorFactoryImpl : public SynchronousCompositorFactory { |
} |
virtual scoped_refptr<cc::ContextProvider> |
- GetOffscreenContextProviderForMainThread() OVERRIDE { |
- NOTIMPLEMENTED() |
- << "Synchronous compositor does not support main thread context yet."; |
- return scoped_refptr<cc::ContextProvider>(); |
+ GetOffscreenContextProviderForMainThread() OVERRIDE { |
+ if (!offscreen_context_for_main_thread_.get() || |
+ offscreen_context_for_main_thread_->DestroyedOnMainThread()) { |
+ offscreen_context_for_main_thread_ = |
+ webkit::gpu::ContextProviderInProcess::Create(); |
+ if (offscreen_context_for_main_thread_.get() && |
+ !offscreen_context_for_main_thread_->BindToCurrentThread()) |
+ offscreen_context_for_main_thread_ = NULL; |
+ } |
+ return offscreen_context_for_main_thread_; |
} |
// This is called on both renderer main thread (offscreen context creation |
@@ -95,6 +101,7 @@ class SynchronousCompositorFactoryImpl : public SynchronousCompositorFactory { |
// Only guards construction of |offscreen_context_for_compositor_thread_|, |
// not usage. |
base::Lock offscreen_context_for_compositor_thread_creation_lock_; |
+ scoped_refptr<cc::ContextProvider> offscreen_context_for_main_thread_; |
scoped_refptr<cc::ContextProvider> offscreen_context_for_compositor_thread_; |
}; |