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