| 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 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 266 } | 266 } |
| 267 } | 267 } |
| 268 | 268 |
| 269 scoped_ptr<BrowserCompositorOutputSurface> surface; | 269 scoped_ptr<BrowserCompositorOutputSurface> surface; |
| 270 if (!create_gpu_output_surface) { | 270 if (!create_gpu_output_surface) { |
| 271 surface = make_scoped_ptr(new SoftwareBrowserCompositorOutputSurface( | 271 surface = make_scoped_ptr(new SoftwareBrowserCompositorOutputSurface( |
| 272 CreateSoftwareOutputDevice(compositor.get()), | 272 CreateSoftwareOutputDevice(compositor.get()), |
| 273 compositor->vsync_manager())); | 273 compositor->vsync_manager())); |
| 274 } else { | 274 } else { |
| 275 DCHECK(context_provider); | 275 DCHECK(context_provider); |
| 276 ContextProvider::Capabilities capabilities = |
| 277 context_provider->ContextCapabilities(); |
| 276 if (!data->surface_id) { | 278 if (!data->surface_id) { |
| 277 surface = make_scoped_ptr(new OffscreenBrowserCompositorOutputSurface( | 279 surface = make_scoped_ptr(new OffscreenBrowserCompositorOutputSurface( |
| 278 context_provider, compositor->vsync_manager(), | 280 context_provider, compositor->vsync_manager(), |
| 279 scoped_ptr<BrowserCompositorOverlayCandidateValidator>())); | 281 scoped_ptr<BrowserCompositorOverlayCandidateValidator>())); |
| 280 } else | 282 } else if (capabilities.gpu.surfaceless) { |
| 281 #if defined(USE_OZONE) | |
| 282 if (ui::OzonePlatform::GetInstance() | |
| 283 ->GetOverlayManager() | |
| 284 ->CanShowPrimaryPlaneAsOverlay()) { | |
| 285 surface = | 283 surface = |
| 286 make_scoped_ptr(new GpuSurfacelessBrowserCompositorOutputSurface( | 284 make_scoped_ptr(new GpuSurfacelessBrowserCompositorOutputSurface( |
| 287 context_provider, data->surface_id, compositor->vsync_manager(), | 285 context_provider, data->surface_id, compositor->vsync_manager(), |
| 288 CreateOverlayCandidateValidator(compositor->widget()), GL_RGB, | 286 CreateOverlayCandidateValidator(compositor->widget()), GL_RGB, |
| 289 BrowserGpuMemoryBufferManager::current())); | 287 BrowserGpuMemoryBufferManager::current())); |
| 290 } else | 288 } else { |
| 291 #endif | |
| 292 { | |
| 293 surface = make_scoped_ptr(new GpuBrowserCompositorOutputSurface( | 289 surface = make_scoped_ptr(new GpuBrowserCompositorOutputSurface( |
| 294 context_provider, compositor->vsync_manager(), | 290 context_provider, compositor->vsync_manager(), |
| 295 CreateOverlayCandidateValidator(compositor->widget()))); | 291 CreateOverlayCandidateValidator(compositor->widget()))); |
| 296 } | 292 } |
| 297 } | 293 } |
| 298 | 294 |
| 299 // TODO(piman): Use GpuSurfaceTracker to map ids to surfaces instead of an | 295 // TODO(piman): Use GpuSurfaceTracker to map ids to surfaces instead of an |
| 300 // output_surface_map_ here. | 296 // output_surface_map_ here. |
| 301 output_surface_map_.AddWithID(surface.get(), data->surface_id); | 297 output_surface_map_.AddWithID(surface.get(), data->surface_id); |
| 302 data->surface = surface.get(); | 298 data->surface = surface.get(); |
| (...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 594 FOR_EACH_OBSERVER(ImageTransportFactoryObserver, | 590 FOR_EACH_OBSERVER(ImageTransportFactoryObserver, |
| 595 observer_list_, | 591 observer_list_, |
| 596 OnLostResources()); | 592 OnLostResources()); |
| 597 | 593 |
| 598 // Kill things that use the shared context before killing the shared context. | 594 // Kill things that use the shared context before killing the shared context. |
| 599 lost_gl_helper.reset(); | 595 lost_gl_helper.reset(); |
| 600 lost_shared_main_thread_contexts = NULL; | 596 lost_shared_main_thread_contexts = NULL; |
| 601 } | 597 } |
| 602 | 598 |
| 603 } // namespace content | 599 } // namespace content |
| OLD | NEW |