| 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 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 216 if (!context_provider.get()) { | 216 if (!context_provider.get()) { |
| 217 display_surface = | 217 display_surface = |
| 218 make_scoped_ptr(new SoftwareBrowserCompositorOutputSurface( | 218 make_scoped_ptr(new SoftwareBrowserCompositorOutputSurface( |
| 219 output_surface_proxy_, | 219 output_surface_proxy_, |
| 220 CreateSoftwareOutputDevice(compositor.get()), | 220 CreateSoftwareOutputDevice(compositor.get()), |
| 221 data->surface_id, | 221 data->surface_id, |
| 222 &output_surface_map_, | 222 &output_surface_map_, |
| 223 compositor->vsync_manager())); | 223 compositor->vsync_manager())); |
| 224 } else { | 224 } else { |
| 225 display_surface = make_scoped_ptr(new GpuBrowserCompositorOutputSurface( | 225 display_surface = make_scoped_ptr(new GpuBrowserCompositorOutputSurface( |
| 226 context_provider, | 226 context_provider, NULL, data->surface_id, &output_surface_map_, |
| 227 data->surface_id, | |
| 228 &output_surface_map_, | |
| 229 compositor->vsync_manager(), | 227 compositor->vsync_manager(), |
| 230 CreateOverlayCandidateValidator(compositor->widget()))); | 228 CreateOverlayCandidateValidator(compositor->widget()))); |
| 231 } | 229 } |
| 232 scoped_ptr<OnscreenDisplayClient> display_client(new OnscreenDisplayClient( | 230 scoped_ptr<OnscreenDisplayClient> display_client(new OnscreenDisplayClient( |
| 233 display_surface.Pass(), manager, compositor->GetRendererSettings(), | 231 display_surface.Pass(), manager, compositor->GetRendererSettings(), |
| 234 compositor->task_runner())); | 232 compositor->task_runner())); |
| 235 | 233 |
| 236 scoped_ptr<SurfaceDisplayOutputSurface> output_surface( | 234 scoped_ptr<SurfaceDisplayOutputSurface> output_surface( |
| 237 new SurfaceDisplayOutputSurface( | 235 new SurfaceDisplayOutputSurface(manager, |
| 238 manager, compositor->surface_id_allocator(), context_provider)); | 236 compositor->surface_id_allocator(), |
| 237 context_provider, NULL)); |
| 239 display_client->set_surface_output_surface(output_surface.get()); | 238 display_client->set_surface_output_surface(output_surface.get()); |
| 240 output_surface->set_display_client(display_client.get()); | 239 output_surface->set_display_client(display_client.get()); |
| 241 display_client->display()->Resize(compositor->size()); | 240 display_client->display()->Resize(compositor->size()); |
| 242 data->display_client = display_client.Pass(); | 241 data->display_client = display_client.Pass(); |
| 243 compositor->SetOutputSurface(output_surface.Pass()); | 242 compositor->SetOutputSurface(output_surface.Pass()); |
| 244 return; | 243 return; |
| 245 } | 244 } |
| 246 | 245 |
| 247 if (!context_provider.get()) { | 246 if (!context_provider.get()) { |
| 248 if (compositor_thread_.get()) { | 247 if (compositor_thread_.get()) { |
| (...skipping 18 matching lines...) Expand all Loading... |
| 267 surface.reset(new GpuSurfacelessBrowserCompositorOutputSurface( | 266 surface.reset(new GpuSurfacelessBrowserCompositorOutputSurface( |
| 268 context_provider, data->surface_id, &output_surface_map_, | 267 context_provider, data->surface_id, &output_surface_map_, |
| 269 compositor->vsync_manager(), | 268 compositor->vsync_manager(), |
| 270 CreateOverlayCandidateValidator(compositor->widget()), GL_RGB, | 269 CreateOverlayCandidateValidator(compositor->widget()), GL_RGB, |
| 271 compositor_thread_ != nullptr, | 270 compositor_thread_ != nullptr, |
| 272 BrowserGpuMemoryBufferManager::current())); | 271 BrowserGpuMemoryBufferManager::current())); |
| 273 } | 272 } |
| 274 #endif | 273 #endif |
| 275 if (!surface) | 274 if (!surface) |
| 276 surface.reset(new GpuBrowserCompositorOutputSurface( | 275 surface.reset(new GpuBrowserCompositorOutputSurface( |
| 277 context_provider, | 276 context_provider, NULL, data->surface_id, &output_surface_map_, |
| 278 data->surface_id, | |
| 279 &output_surface_map_, | |
| 280 compositor->vsync_manager(), | 277 compositor->vsync_manager(), |
| 281 CreateOverlayCandidateValidator(compositor->widget()))); | 278 CreateOverlayCandidateValidator(compositor->widget()))); |
| 282 | 279 |
| 283 if (data->reflector.get()) | 280 if (data->reflector.get()) |
| 284 data->reflector->ReattachToOutputSurfaceFromMainThread(surface.get()); | 281 data->reflector->ReattachToOutputSurfaceFromMainThread(surface.get()); |
| 285 | 282 |
| 286 compositor->SetOutputSurface(surface.Pass()); | 283 compositor->SetOutputSurface(surface.Pass()); |
| 287 } | 284 } |
| 288 | 285 |
| 289 scoped_refptr<ui::Reflector> GpuProcessTransportFactory::CreateReflector( | 286 scoped_refptr<ui::Reflector> GpuProcessTransportFactory::CreateReflector( |
| (...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 537 FOR_EACH_OBSERVER(ImageTransportFactoryObserver, | 534 FOR_EACH_OBSERVER(ImageTransportFactoryObserver, |
| 538 observer_list_, | 535 observer_list_, |
| 539 OnLostResources()); | 536 OnLostResources()); |
| 540 | 537 |
| 541 // Kill things that use the shared context before killing the shared context. | 538 // Kill things that use the shared context before killing the shared context. |
| 542 lost_gl_helper.reset(); | 539 lost_gl_helper.reset(); |
| 543 lost_shared_main_thread_contexts = NULL; | 540 lost_shared_main_thread_contexts = NULL; |
| 544 } | 541 } |
| 545 | 542 |
| 546 } // namespace content | 543 } // namespace content |
| OLD | NEW |