| 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 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 240 cause, base::Bind(&GpuProcessTransportFactory::EstablishedGpuChannel, | 240 cause, base::Bind(&GpuProcessTransportFactory::EstablishedGpuChannel, |
| 241 callback_factory_.GetWeakPtr(), compositor, | 241 callback_factory_.GetWeakPtr(), compositor, |
| 242 create_gpu_output_surface, num_attempts + 1)); | 242 create_gpu_output_surface, num_attempts + 1)); |
| 243 return; | 243 return; |
| 244 } | 244 } |
| 245 } | 245 } |
| 246 | 246 |
| 247 scoped_ptr<BrowserCompositorOutputSurface> surface; | 247 scoped_ptr<BrowserCompositorOutputSurface> surface; |
| 248 if (!create_gpu_output_surface) { | 248 if (!create_gpu_output_surface) { |
| 249 surface = make_scoped_ptr(new SoftwareBrowserCompositorOutputSurface( | 249 surface = make_scoped_ptr(new SoftwareBrowserCompositorOutputSurface( |
| 250 CreateSoftwareOutputDevice(compositor.get()), | 250 CreateSoftwareOutputDevice(compositor.get()))); |
| 251 compositor->vsync_manager())); | |
| 252 } else { | 251 } else { |
| 253 DCHECK(context_provider); | 252 DCHECK(context_provider); |
| 254 #if defined(USE_OZONE) | 253 #if defined(USE_OZONE) |
| 255 if (ui::SurfaceFactoryOzone::GetInstance() | 254 if (ui::SurfaceFactoryOzone::GetInstance() |
| 256 ->CanShowPrimaryPlaneAsOverlay()) { | 255 ->CanShowPrimaryPlaneAsOverlay()) { |
| 257 surface = | 256 surface = |
| 258 make_scoped_ptr(new GpuSurfacelessBrowserCompositorOutputSurface( | 257 make_scoped_ptr(new GpuSurfacelessBrowserCompositorOutputSurface( |
| 259 context_provider, data->surface_id, compositor->vsync_manager(), | 258 context_provider, data->surface_id, |
| 260 CreateOverlayCandidateValidator(compositor->widget()), GL_RGB, | 259 CreateOverlayCandidateValidator(compositor->widget()), GL_RGB, |
| 261 BrowserGpuMemoryBufferManager::current())); | 260 BrowserGpuMemoryBufferManager::current())); |
| 262 } else | 261 } else |
| 263 #endif | 262 #endif |
| 264 { | 263 { |
| 265 surface = make_scoped_ptr(new GpuBrowserCompositorOutputSurface( | 264 surface = make_scoped_ptr(new GpuBrowserCompositorOutputSurface( |
| 266 context_provider, compositor->vsync_manager(), | 265 context_provider, |
| 267 CreateOverlayCandidateValidator(compositor->widget()))); | 266 CreateOverlayCandidateValidator(compositor->widget()))); |
| 268 } | 267 } |
| 269 } | 268 } |
| 270 | 269 |
| 271 // TODO(piman): Use GpuSurfaceTracker to map ids to surfaces instead of an | 270 // TODO(piman): Use GpuSurfaceTracker to map ids to surfaces instead of an |
| 272 // output_surface_map_ here. | 271 // output_surface_map_ here. |
| 273 output_surface_map_.AddWithID(surface.get(), data->surface_id); | 272 output_surface_map_.AddWithID(surface.get(), data->surface_id); |
| 274 data->surface = surface.get(); | 273 data->surface = surface.get(); |
| 275 if (data->reflector) | 274 if (data->reflector) |
| 276 data->reflector->OnSourceSurfaceReady(data->surface); | 275 data->reflector->OnSourceSurfaceReady(data->surface); |
| (...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 552 FOR_EACH_OBSERVER(ImageTransportFactoryObserver, | 551 FOR_EACH_OBSERVER(ImageTransportFactoryObserver, |
| 553 observer_list_, | 552 observer_list_, |
| 554 OnLostResources()); | 553 OnLostResources()); |
| 555 | 554 |
| 556 // Kill things that use the shared context before killing the shared context. | 555 // Kill things that use the shared context before killing the shared context. |
| 557 lost_gl_helper.reset(); | 556 lost_gl_helper.reset(); |
| 558 lost_shared_main_thread_contexts = NULL; | 557 lost_shared_main_thread_contexts = NULL; |
| 559 } | 558 } |
| 560 | 559 |
| 561 } // namespace content | 560 } // namespace content |
| OLD | NEW |