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

Side by Side Diff: content/browser/android/in_process/synchronous_compositor_impl.cc

Issue 143023005: Support multiple service instances with GLInProcessContext (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 10 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 | Annotate | Revision Log
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 #include "content/browser/android/in_process/synchronous_compositor_impl.h" 5 #include "content/browser/android/in_process/synchronous_compositor_impl.h"
6 6
7 #include "base/lazy_instance.h" 7 #include "base/lazy_instance.h"
8 #include "base/message_loop/message_loop.h" 8 #include "base/message_loop/message_loop.h"
9 #include "cc/input/input_handler.h" 9 #include "cc/input/input_handler.h"
10 #include "cc/input/layer_scroll_offset_delegate.h" 10 #include "cc/input/layer_scroll_offset_delegate.h"
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 compositor_client_->DidDestroyCompositor(this); 75 compositor_client_->DidDestroyCompositor(this);
76 SetInputHandler(NULL); 76 SetInputHandler(NULL);
77 } 77 }
78 78
79 void SynchronousCompositorImpl::SetClient( 79 void SynchronousCompositorImpl::SetClient(
80 SynchronousCompositorClient* compositor_client) { 80 SynchronousCompositorClient* compositor_client) {
81 DCHECK(CalledOnValidThread()); 81 DCHECK(CalledOnValidThread());
82 compositor_client_ = compositor_client; 82 compositor_client_ = compositor_client;
83 } 83 }
84 84
85 // static
86 void SynchronousCompositor::SetGpuService(
87 scoped_refptr<gpu::InProcessCommandBuffer::Service> service) {
88 g_factory.Get().SetDeferredGpuService(service);
89 }
90
85 bool SynchronousCompositorImpl::InitializeHwDraw( 91 bool SynchronousCompositorImpl::InitializeHwDraw(
86 scoped_refptr<gfx::GLSurface> surface) { 92 scoped_refptr<gfx::GLSurface> surface) {
87 DCHECK(CalledOnValidThread()); 93 DCHECK(CalledOnValidThread());
88 DCHECK(output_surface_); 94 DCHECK(output_surface_);
89 bool success = output_surface_->InitializeHwDraw( 95
90 surface, 96 // Create contexts in this order so that the share group gets passed
91 g_factory.Get().GetOffscreenContextProviderForCompositorThread()); 97 // along correctly.
98 scoped_refptr<cc::ContextProvider> offscreen_context =
99 g_factory.Get().GetOffscreenContextProviderForCompositorThread();
100 scoped_refptr<cc::ContextProvider> onscreen_context =
101 g_factory.Get().CreateOnscreenContextProviderForCompositorThread(surface);
102
103 bool success =
104 output_surface_->InitializeHwDraw(onscreen_context, offscreen_context);
105
92 if (success) 106 if (success)
93 g_factory.Get().CompositorInitializedHardwareDraw(); 107 g_factory.Get().CompositorInitializedHardwareDraw();
94 return success; 108 return success;
95 } 109 }
96 110
97 void SynchronousCompositorImpl::ReleaseHwDraw() { 111 void SynchronousCompositorImpl::ReleaseHwDraw() {
98 DCHECK(CalledOnValidThread()); 112 DCHECK(CalledOnValidThread());
99 DCHECK(output_surface_); 113 DCHECK(output_surface_);
100 output_surface_->ReleaseHwDraw(); 114 output_surface_->ReleaseHwDraw();
101 g_factory.Get().CompositorReleasedHardwareDraw(); 115 g_factory.Get().CompositorReleasedHardwareDraw();
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
268 g_factory.Get(); // Ensure it's initialized. 282 g_factory.Get(); // Ensure it's initialized.
269 SynchronousCompositorImpl::CreateForWebContents(contents); 283 SynchronousCompositorImpl::CreateForWebContents(contents);
270 } 284 }
271 if (SynchronousCompositorImpl* instance = 285 if (SynchronousCompositorImpl* instance =
272 SynchronousCompositorImpl::FromWebContents(contents)) { 286 SynchronousCompositorImpl::FromWebContents(contents)) {
273 instance->SetClient(client); 287 instance->SetClient(client);
274 } 288 }
275 } 289 }
276 290
277 } // namespace content 291 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698