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

Unified Diff: content/browser/android/in_process/synchronous_compositor_factory_impl.cc

Issue 266353003: aw: Ubercomp mega patch (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 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: content/browser/android/in_process/synchronous_compositor_factory_impl.cc
diff --git a/content/browser/android/in_process/synchronous_compositor_factory_impl.cc b/content/browser/android/in_process/synchronous_compositor_factory_impl.cc
index 62aa33e256462bc2c671714f1c9649b053edfb55..ba4b894de1747dcf81356362e1495f4acc190746 100644
--- a/content/browser/android/in_process/synchronous_compositor_factory_impl.cc
+++ b/content/browser/android/in_process/synchronous_compositor_factory_impl.cc
@@ -179,13 +179,27 @@ scoped_refptr<ContextProviderWebContext> SynchronousCompositorFactoryImpl::
scoped_refptr<cc::ContextProvider> SynchronousCompositorFactoryImpl::
CreateOnscreenContextProviderForCompositorThread(
scoped_refptr<gfx::GLSurface> surface) {
- DCHECK(surface);
DCHECK(service_);
- if (!share_context_.get())
- share_context_ = CreateContext(NULL, service_, NULL);
+
+ // TODO(boliu): This sucks. Find a better way.
+ gpu::GLInProcessContext* share_context = NULL;
+ {
+ base::AutoLock lock(num_hardware_compositor_lock_);
+ share_context = share_context_.get();
+ }
+ if (!share_context) {
+ scoped_ptr<gpu::GLInProcessContext> context = CreateContext(NULL, service_, NULL);
+ {
+ base::AutoLock lock(num_hardware_compositor_lock_);
+ if (!share_context_.get())
+ share_context_ = context.Pass();
+ share_context = share_context_.get();
+ }
+ }
+
return webkit::gpu::ContextProviderInProcess::Create(
- WrapContext(CreateContext(surface, service_, share_context_.get())),
+ WrapContext(CreateContext(surface, service_, share_context)),
"Compositor-Onscreen");
}

Powered by Google App Engine
This is Rietveld 408576698