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 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
214 cause, base::Bind(&GpuProcessTransportFactory::EstablishedGpuChannel, | 214 cause, base::Bind(&GpuProcessTransportFactory::EstablishedGpuChannel, |
215 callback_factory_.GetWeakPtr(), compositor, | 215 callback_factory_.GetWeakPtr(), compositor, |
216 create_gpu_output_surface, num_attempts + 1)); | 216 create_gpu_output_surface, num_attempts + 1)); |
217 return; | 217 return; |
218 } | 218 } |
219 } | 219 } |
220 | 220 |
221 scoped_ptr<BrowserCompositorOutputSurface> surface; | 221 scoped_ptr<BrowserCompositorOutputSurface> surface; |
222 if (!create_gpu_output_surface) { | 222 if (!create_gpu_output_surface) { |
223 surface = make_scoped_ptr(new SoftwareBrowserCompositorOutputSurface( | 223 surface = make_scoped_ptr(new SoftwareBrowserCompositorOutputSurface( |
224 CreateSoftwareOutputDevice(compositor.get()), | 224 CreateSoftwareOutputDevice(compositor.get()))); |
225 compositor->vsync_manager())); | |
226 } else { | 225 } else { |
227 DCHECK(context_provider); | 226 DCHECK(context_provider); |
228 #if defined(USE_OZONE) | 227 #if defined(USE_OZONE) |
229 if (ui::SurfaceFactoryOzone::GetInstance() | 228 if (ui::SurfaceFactoryOzone::GetInstance() |
230 ->CanShowPrimaryPlaneAsOverlay()) { | 229 ->CanShowPrimaryPlaneAsOverlay()) { |
231 surface = | 230 surface = |
232 make_scoped_ptr(new GpuSurfacelessBrowserCompositorOutputSurface( | 231 make_scoped_ptr(new GpuSurfacelessBrowserCompositorOutputSurface( |
233 context_provider, data->surface_id, compositor->vsync_manager(), | 232 context_provider, data->surface_id, |
234 CreateOverlayCandidateValidator(compositor->widget()), GL_RGB, | 233 CreateOverlayCandidateValidator(compositor->widget()), GL_RGB, |
235 BrowserGpuMemoryBufferManager::current())); | 234 BrowserGpuMemoryBufferManager::current())); |
236 } else | 235 } else |
237 #endif | 236 #endif |
238 { | 237 { |
239 surface = make_scoped_ptr(new GpuBrowserCompositorOutputSurface( | 238 surface = make_scoped_ptr(new GpuBrowserCompositorOutputSurface( |
240 context_provider, compositor->vsync_manager(), | 239 context_provider, |
241 CreateOverlayCandidateValidator(compositor->widget()))); | 240 CreateOverlayCandidateValidator(compositor->widget()))); |
242 } | 241 } |
243 } | 242 } |
244 | 243 |
245 // TODO(piman): Use GpuSurfaceTracker to map ids to surfaces instead of an | 244 // TODO(piman): Use GpuSurfaceTracker to map ids to surfaces instead of an |
246 // output_surface_map_ here. | 245 // output_surface_map_ here. |
247 output_surface_map_.AddWithID(surface.get(), data->surface_id); | 246 output_surface_map_.AddWithID(surface.get(), data->surface_id); |
248 data->surface = surface.get(); | 247 data->surface = surface.get(); |
249 if (data->reflector) | 248 if (data->reflector) |
250 data->reflector->OnSourceSurfaceReady(data->surface); | 249 data->reflector->OnSourceSurfaceReady(data->surface); |
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
522 FOR_EACH_OBSERVER(ImageTransportFactoryObserver, | 521 FOR_EACH_OBSERVER(ImageTransportFactoryObserver, |
523 observer_list_, | 522 observer_list_, |
524 OnLostResources()); | 523 OnLostResources()); |
525 | 524 |
526 // Kill things that use the shared context before killing the shared context. | 525 // Kill things that use the shared context before killing the shared context. |
527 lost_gl_helper.reset(); | 526 lost_gl_helper.reset(); |
528 lost_shared_main_thread_contexts = NULL; | 527 lost_shared_main_thread_contexts = NULL; |
529 } | 528 } |
530 | 529 |
531 } // namespace content | 530 } // namespace content |
OLD | NEW |