| 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" |
| 11 #include "base/location.h" | 11 #include "base/location.h" |
| 12 #include "base/message_loop/message_loop.h" | 12 #include "base/message_loop/message_loop.h" |
| 13 #include "base/metrics/histogram.h" | 13 #include "base/metrics/histogram.h" |
| 14 #include "base/threading/thread.h" | 14 #include "base/threading/thread.h" |
| 15 #include "cc/output/compositor_frame.h" | 15 #include "cc/output/compositor_frame.h" |
| 16 #include "cc/output/output_surface.h" | 16 #include "cc/output/output_surface.h" |
| 17 #include "cc/surfaces/surface_manager.h" | 17 #include "cc/surfaces/surface_manager.h" |
| 18 #include "content/browser/compositor/browser_compositor_output_surface.h" | 18 #include "content/browser/compositor/browser_compositor_output_surface.h" |
| 19 #include "content/browser/compositor/browser_compositor_output_surface_proxy.h" | 19 #include "content/browser/compositor/browser_compositor_output_surface_proxy.h" |
| 20 #include "content/browser/compositor/gpu_browser_compositor_output_surface.h" | 20 #include "content/browser/compositor/gpu_browser_compositor_output_surface.h" |
| 21 #include "content/browser/compositor/gpu_surfaceless_browser_compositor_output_s
urface.h" |
| 21 #include "content/browser/compositor/onscreen_display_client.h" | 22 #include "content/browser/compositor/onscreen_display_client.h" |
| 22 #include "content/browser/compositor/reflector_impl.h" | 23 #include "content/browser/compositor/reflector_impl.h" |
| 23 #include "content/browser/compositor/software_browser_compositor_output_surface.
h" | 24 #include "content/browser/compositor/software_browser_compositor_output_surface.
h" |
| 24 #include "content/browser/compositor/surface_display_output_surface.h" | 25 #include "content/browser/compositor/surface_display_output_surface.h" |
| 25 #include "content/browser/gpu/browser_gpu_channel_host_factory.h" | 26 #include "content/browser/gpu/browser_gpu_channel_host_factory.h" |
| 26 #include "content/browser/gpu/gpu_data_manager_impl.h" | 27 #include "content/browser/gpu/gpu_data_manager_impl.h" |
| 27 #include "content/browser/gpu/gpu_surface_tracker.h" | 28 #include "content/browser/gpu/gpu_surface_tracker.h" |
| 28 #include "content/browser/renderer_host/render_widget_host_impl.h" | 29 #include "content/browser/renderer_host/render_widget_host_impl.h" |
| 29 #include "content/common/gpu/client/context_provider_command_buffer.h" | 30 #include "content/common/gpu/client/context_provider_command_buffer.h" |
| 30 #include "content/common/gpu/client/gl_helper.h" | 31 #include "content/common/gpu/client/gl_helper.h" |
| (...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 225 scoped_ptr<SoftwareBrowserCompositorOutputSurface> surface( | 226 scoped_ptr<SoftwareBrowserCompositorOutputSurface> surface( |
| 226 new SoftwareBrowserCompositorOutputSurface( | 227 new SoftwareBrowserCompositorOutputSurface( |
| 227 output_surface_proxy_, | 228 output_surface_proxy_, |
| 228 CreateSoftwareOutputDevice(compositor), | 229 CreateSoftwareOutputDevice(compositor), |
| 229 per_compositor_data_[compositor]->surface_id, | 230 per_compositor_data_[compositor]->surface_id, |
| 230 &output_surface_map_, | 231 &output_surface_map_, |
| 231 compositor->vsync_manager())); | 232 compositor->vsync_manager())); |
| 232 return surface.PassAs<cc::OutputSurface>(); | 233 return surface.PassAs<cc::OutputSurface>(); |
| 233 } | 234 } |
| 234 | 235 |
| 235 scoped_ptr<BrowserCompositorOutputSurface> surface( | 236 scoped_ptr<BrowserCompositorOutputSurface> surface; |
| 236 new GpuBrowserCompositorOutputSurface( | 237 #if defined(USE_OZONE) |
| 237 context_provider, | 238 if (ui::SurfaceFactoryOzone::GetInstance()->CanShowPrimaryPlaneAsOverlay()) { |
| 238 per_compositor_data_[compositor]->surface_id, | 239 surface.reset(new GpuSurfacelessBrowserCompositorOutputSurface( |
| 239 &output_surface_map_, | 240 context_provider, |
| 240 compositor->vsync_manager(), | 241 per_compositor_data_[compositor]->surface_id, |
| 241 CreateOverlayCandidateValidator(compositor->widget()))); | 242 &output_surface_map_, |
| 243 compositor->vsync_manager(), |
| 244 CreateOverlayCandidateValidator(compositor->widget()), |
| 245 GL_RGB8_OES)); |
| 246 } |
| 247 #endif |
| 248 if (!surface) |
| 249 surface.reset(new GpuBrowserCompositorOutputSurface( |
| 250 context_provider, |
| 251 per_compositor_data_[compositor]->surface_id, |
| 252 &output_surface_map_, |
| 253 compositor->vsync_manager(), |
| 254 CreateOverlayCandidateValidator(compositor->widget()))); |
| 255 |
| 242 if (data->reflector.get()) | 256 if (data->reflector.get()) |
| 243 data->reflector->ReattachToOutputSurfaceFromMainThread(surface.get()); | 257 data->reflector->ReattachToOutputSurfaceFromMainThread(surface.get()); |
| 244 | 258 |
| 245 return surface.PassAs<cc::OutputSurface>(); | 259 return surface.PassAs<cc::OutputSurface>(); |
| 246 } | 260 } |
| 247 | 261 |
| 248 scoped_refptr<ui::Reflector> GpuProcessTransportFactory::CreateReflector( | 262 scoped_refptr<ui::Reflector> GpuProcessTransportFactory::CreateReflector( |
| 249 ui::Compositor* source, | 263 ui::Compositor* source, |
| 250 ui::Layer* target) { | 264 ui::Layer* target) { |
| 251 PerCompositorData* data = per_compositor_data_[source]; | 265 PerCompositorData* data = per_compositor_data_[source]; |
| (...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 460 FOR_EACH_OBSERVER(ImageTransportFactoryObserver, | 474 FOR_EACH_OBSERVER(ImageTransportFactoryObserver, |
| 461 observer_list_, | 475 observer_list_, |
| 462 OnLostResources()); | 476 OnLostResources()); |
| 463 | 477 |
| 464 // Kill things that use the shared context before killing the shared context. | 478 // Kill things that use the shared context before killing the shared context. |
| 465 lost_gl_helper.reset(); | 479 lost_gl_helper.reset(); |
| 466 lost_shared_main_thread_contexts = NULL; | 480 lost_shared_main_thread_contexts = NULL; |
| 467 } | 481 } |
| 468 | 482 |
| 469 } // namespace content | 483 } // namespace content |
| OLD | NEW |