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

Side by Side Diff: content/browser/compositor/gpu_process_transport_factory.cc

Issue 138903025: Read compositor VSync information from platform, when possible (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 287efe04 Rebase, oshima@ nits. 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/compositor/gpu_process_transport_factory.h" 5 #include "content/browser/compositor/gpu_process_transport_factory.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
210 LOG(FATAL) << "Failed to create UI context, but can't use software" 210 LOG(FATAL) << "Failed to create UI context, but can't use software"
211 " compositing with browser threaded compositing. Aborting."; 211 " compositing with browser threaded compositing. Aborting.";
212 } 212 }
213 213
214 scoped_ptr<SoftwareBrowserCompositorOutputSurface> surface( 214 scoped_ptr<SoftwareBrowserCompositorOutputSurface> surface(
215 new SoftwareBrowserCompositorOutputSurface( 215 new SoftwareBrowserCompositorOutputSurface(
216 output_surface_proxy_, 216 output_surface_proxy_,
217 CreateSoftwareOutputDevice(compositor), 217 CreateSoftwareOutputDevice(compositor),
218 per_compositor_data_[compositor]->surface_id, 218 per_compositor_data_[compositor]->surface_id,
219 &output_surface_map_, 219 &output_surface_map_,
220 base::MessageLoopProxy::current().get(), 220 compositor->vsync_manager()));
221 compositor->AsWeakPtr()));
222 return surface.PassAs<cc::OutputSurface>(); 221 return surface.PassAs<cc::OutputSurface>();
223 } 222 }
224 223
225 scoped_refptr<base::SingleThreadTaskRunner> compositor_thread_task_runner = 224 scoped_refptr<base::SingleThreadTaskRunner> compositor_thread_task_runner =
226 ui::Compositor::GetCompositorMessageLoop(); 225 ui::Compositor::GetCompositorMessageLoop();
227 if (!compositor_thread_task_runner.get()) 226 if (!compositor_thread_task_runner.get())
228 compositor_thread_task_runner = base::MessageLoopProxy::current(); 227 compositor_thread_task_runner = base::MessageLoopProxy::current();
229 228
230 // Here we know the GpuProcessHost has been set up, because we created a 229 // Here we know the GpuProcessHost has been set up, because we created a
231 // context. 230 // context.
232 output_surface_proxy_->ConnectToGpuProcessHost( 231 output_surface_proxy_->ConnectToGpuProcessHost(
233 compositor_thread_task_runner.get()); 232 compositor_thread_task_runner.get());
234 233
235 scoped_ptr<BrowserCompositorOutputSurface> surface( 234 scoped_ptr<BrowserCompositorOutputSurface> surface(
236 new GpuBrowserCompositorOutputSurface( 235 new GpuBrowserCompositorOutputSurface(
237 context_provider, 236 context_provider,
238 per_compositor_data_[compositor]->surface_id, 237 per_compositor_data_[compositor]->surface_id,
239 &output_surface_map_, 238 &output_surface_map_,
240 base::MessageLoopProxy::current().get(), 239 compositor->vsync_manager()));
241 compositor->AsWeakPtr()));
242 if (data->reflector.get()) { 240 if (data->reflector.get()) {
243 data->reflector->CreateSharedTexture(); 241 data->reflector->CreateSharedTexture();
244 data->reflector->AttachToOutputSurface(surface.get()); 242 data->reflector->AttachToOutputSurface(surface.get());
245 } 243 }
246 244
247 return surface.PassAs<cc::OutputSurface>(); 245 return surface.PassAs<cc::OutputSurface>();
248 } 246 }
249 247
250 scoped_refptr<ui::Reflector> GpuProcessTransportFactory::CreateReflector( 248 scoped_refptr<ui::Reflector> GpuProcessTransportFactory::CreateReflector(
251 ui::Compositor* source, 249 ui::Compositor* source,
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after
481 observer_list_, 479 observer_list_,
482 OnLostResources()); 480 OnLostResources());
483 481
484 // Kill things that use the shared context before killing the shared context. 482 // Kill things that use the shared context before killing the shared context.
485 lost_gl_helper.reset(); 483 lost_gl_helper.reset();
486 lost_offscreen_compositor_contexts = NULL; 484 lost_offscreen_compositor_contexts = NULL;
487 lost_shared_main_thread_contexts = NULL; 485 lost_shared_main_thread_contexts = NULL;
488 } 486 }
489 487
490 } // namespace content 488 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698