OLD | NEW |
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 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
273 cause, base::Bind(&GpuProcessTransportFactory::EstablishedGpuChannel, | 273 cause, base::Bind(&GpuProcessTransportFactory::EstablishedGpuChannel, |
274 callback_factory_.GetWeakPtr(), compositor, | 274 callback_factory_.GetWeakPtr(), compositor, |
275 create_gpu_output_surface, num_attempts + 1)); | 275 create_gpu_output_surface, num_attempts + 1)); |
276 return; | 276 return; |
277 } | 277 } |
278 } | 278 } |
279 | 279 |
280 scoped_ptr<BrowserCompositorOutputSurface> surface; | 280 scoped_ptr<BrowserCompositorOutputSurface> surface; |
281 if (!create_gpu_output_surface) { | 281 if (!create_gpu_output_surface) { |
282 surface = make_scoped_ptr(new SoftwareBrowserCompositorOutputSurface( | 282 surface = make_scoped_ptr(new SoftwareBrowserCompositorOutputSurface( |
283 CreateSoftwareOutputDevice(compositor.get()))); | 283 CreateSoftwareOutputDevice(compositor.get()), |
| 284 compositor->vsync_manager())); |
284 } else { | 285 } else { |
285 DCHECK(context_provider); | 286 DCHECK(context_provider); |
286 if (!data->surface_id) { | 287 if (!data->surface_id) { |
287 surface = make_scoped_ptr(new OffscreenBrowserCompositorOutputSurface( | 288 surface = make_scoped_ptr(new OffscreenBrowserCompositorOutputSurface( |
288 context_provider, | 289 context_provider, compositor->vsync_manager(), |
289 scoped_ptr<BrowserCompositorOverlayCandidateValidator>())); | 290 scoped_ptr<BrowserCompositorOverlayCandidateValidator>())); |
290 } else | 291 } else |
291 #if defined(USE_OZONE) | 292 #if defined(USE_OZONE) |
292 if (ui::SurfaceFactoryOzone::GetInstance() | 293 if (ui::SurfaceFactoryOzone::GetInstance() |
293 ->CanShowPrimaryPlaneAsOverlay()) { | 294 ->CanShowPrimaryPlaneAsOverlay()) { |
294 surface = | 295 surface = |
295 make_scoped_ptr(new GpuSurfacelessBrowserCompositorOutputSurface( | 296 make_scoped_ptr(new GpuSurfacelessBrowserCompositorOutputSurface( |
296 context_provider, data->surface_id, | 297 context_provider, data->surface_id, compositor->vsync_manager(), |
297 CreateOverlayCandidateValidator(compositor->widget()), GL_RGB, | 298 CreateOverlayCandidateValidator(compositor->widget()), GL_RGB, |
298 BrowserGpuMemoryBufferManager::current())); | 299 BrowserGpuMemoryBufferManager::current())); |
299 } else | 300 } else |
300 #endif | 301 #endif |
301 { | 302 { |
302 surface = make_scoped_ptr(new GpuBrowserCompositorOutputSurface( | 303 surface = make_scoped_ptr(new GpuBrowserCompositorOutputSurface( |
303 context_provider, | 304 context_provider, compositor->vsync_manager(), |
304 CreateOverlayCandidateValidator(compositor->widget()))); | 305 CreateOverlayCandidateValidator(compositor->widget()))); |
305 } | 306 } |
306 } | 307 } |
307 | 308 |
308 // TODO(piman): Use GpuSurfaceTracker to map ids to surfaces instead of an | 309 // TODO(piman): Use GpuSurfaceTracker to map ids to surfaces instead of an |
309 // output_surface_map_ here. | 310 // output_surface_map_ here. |
310 output_surface_map_.AddWithID(surface.get(), data->surface_id); | 311 output_surface_map_.AddWithID(surface.get(), data->surface_id); |
311 data->surface = surface.get(); | 312 data->surface = surface.get(); |
312 if (data->reflector) | 313 if (data->reflector) |
313 data->reflector->OnSourceSurfaceReady(data->surface); | 314 data->reflector->OnSourceSurfaceReady(data->surface); |
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
598 FOR_EACH_OBSERVER(ImageTransportFactoryObserver, | 599 FOR_EACH_OBSERVER(ImageTransportFactoryObserver, |
599 observer_list_, | 600 observer_list_, |
600 OnLostResources()); | 601 OnLostResources()); |
601 | 602 |
602 // Kill things that use the shared context before killing the shared context. | 603 // Kill things that use the shared context before killing the shared context. |
603 lost_gl_helper.reset(); | 604 lost_gl_helper.reset(); |
604 lost_shared_main_thread_contexts = NULL; | 605 lost_shared_main_thread_contexts = NULL; |
605 } | 606 } |
606 | 607 |
607 } // namespace content | 608 } // namespace content |
OLD | NEW |