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 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
270 cause, base::Bind(&GpuProcessTransportFactory::EstablishedGpuChannel, | 270 cause, base::Bind(&GpuProcessTransportFactory::EstablishedGpuChannel, |
271 callback_factory_.GetWeakPtr(), compositor, | 271 callback_factory_.GetWeakPtr(), compositor, |
272 create_gpu_output_surface, num_attempts + 1)); | 272 create_gpu_output_surface, num_attempts + 1)); |
273 return; | 273 return; |
274 } | 274 } |
275 } | 275 } |
276 | 276 |
277 scoped_ptr<BrowserCompositorOutputSurface> surface; | 277 scoped_ptr<BrowserCompositorOutputSurface> surface; |
278 if (!create_gpu_output_surface) { | 278 if (!create_gpu_output_surface) { |
279 surface = make_scoped_ptr(new SoftwareBrowserCompositorOutputSurface( | 279 surface = make_scoped_ptr(new SoftwareBrowserCompositorOutputSurface( |
280 CreateSoftwareOutputDevice(compositor.get()))); | 280 CreateSoftwareOutputDevice(compositor.get()), |
| 281 compositor->vsync_manager())); |
281 } else { | 282 } else { |
282 DCHECK(context_provider); | 283 DCHECK(context_provider); |
283 #if defined(USE_OZONE) | 284 #if defined(USE_OZONE) |
284 if (ui::SurfaceFactoryOzone::GetInstance() | 285 if (ui::SurfaceFactoryOzone::GetInstance() |
285 ->CanShowPrimaryPlaneAsOverlay()) { | 286 ->CanShowPrimaryPlaneAsOverlay()) { |
286 surface = | 287 surface = |
287 make_scoped_ptr(new GpuSurfacelessBrowserCompositorOutputSurface( | 288 make_scoped_ptr(new GpuSurfacelessBrowserCompositorOutputSurface( |
288 context_provider, data->surface_id, | 289 context_provider, data->surface_id, compositor->vsync_manager(), |
289 CreateOverlayCandidateValidator(compositor->widget()), GL_RGB, | 290 CreateOverlayCandidateValidator(compositor->widget()), GL_RGB, |
290 BrowserGpuMemoryBufferManager::current())); | 291 BrowserGpuMemoryBufferManager::current())); |
291 } else | 292 } else |
292 #endif | 293 #endif |
293 { | 294 { |
294 surface = make_scoped_ptr(new GpuBrowserCompositorOutputSurface( | 295 surface = make_scoped_ptr(new GpuBrowserCompositorOutputSurface( |
295 context_provider, | 296 context_provider, compositor->vsync_manager(), |
296 CreateOverlayCandidateValidator(compositor->widget()))); | 297 CreateOverlayCandidateValidator(compositor->widget()))); |
297 } | 298 } |
298 } | 299 } |
299 | 300 |
300 // TODO(piman): Use GpuSurfaceTracker to map ids to surfaces instead of an | 301 // TODO(piman): Use GpuSurfaceTracker to map ids to surfaces instead of an |
301 // output_surface_map_ here. | 302 // output_surface_map_ here. |
302 output_surface_map_.AddWithID(surface.get(), data->surface_id); | 303 output_surface_map_.AddWithID(surface.get(), data->surface_id); |
303 data->surface = surface.get(); | 304 data->surface = surface.get(); |
304 if (data->reflector) | 305 if (data->reflector) |
305 data->reflector->OnSourceSurfaceReady(data->surface); | 306 data->reflector->OnSourceSurfaceReady(data->surface); |
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
585 FOR_EACH_OBSERVER(ImageTransportFactoryObserver, | 586 FOR_EACH_OBSERVER(ImageTransportFactoryObserver, |
586 observer_list_, | 587 observer_list_, |
587 OnLostResources()); | 588 OnLostResources()); |
588 | 589 |
589 // Kill things that use the shared context before killing the shared context. | 590 // Kill things that use the shared context before killing the shared context. |
590 lost_gl_helper.reset(); | 591 lost_gl_helper.reset(); |
591 lost_shared_main_thread_contexts = NULL; | 592 lost_shared_main_thread_contexts = NULL; |
592 } | 593 } |
593 | 594 |
594 } // namespace content | 595 } // namespace content |
OLD | NEW |