| 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/onscreen_display_client.h" |
| 18 #include "cc/surfaces/surface_display_output_surface.h" |
| 17 #include "cc/surfaces/surface_manager.h" | 19 #include "cc/surfaces/surface_manager.h" |
| 18 #include "content/browser/compositor/browser_compositor_output_surface.h" | 20 #include "content/browser/compositor/browser_compositor_output_surface.h" |
| 19 #include "content/browser/compositor/browser_compositor_output_surface_proxy.h" | 21 #include "content/browser/compositor/browser_compositor_output_surface_proxy.h" |
| 20 #include "content/browser/compositor/gpu_browser_compositor_output_surface.h" | 22 #include "content/browser/compositor/gpu_browser_compositor_output_surface.h" |
| 21 #include "content/browser/compositor/gpu_surfaceless_browser_compositor_output_s
urface.h" | 23 #include "content/browser/compositor/gpu_surfaceless_browser_compositor_output_s
urface.h" |
| 22 #include "content/browser/compositor/onscreen_display_client.h" | |
| 23 #include "content/browser/compositor/reflector_impl.h" | 24 #include "content/browser/compositor/reflector_impl.h" |
| 24 #include "content/browser/compositor/software_browser_compositor_output_surface.
h" | 25 #include "content/browser/compositor/software_browser_compositor_output_surface.
h" |
| 25 #include "content/browser/compositor/surface_display_output_surface.h" | |
| 26 #include "content/browser/gpu/browser_gpu_channel_host_factory.h" | 26 #include "content/browser/gpu/browser_gpu_channel_host_factory.h" |
| 27 #include "content/browser/gpu/browser_gpu_memory_buffer_manager.h" | 27 #include "content/browser/gpu/browser_gpu_memory_buffer_manager.h" |
| 28 #include "content/browser/gpu/compositor_util.h" | 28 #include "content/browser/gpu/compositor_util.h" |
| 29 #include "content/browser/gpu/gpu_data_manager_impl.h" | 29 #include "content/browser/gpu/gpu_data_manager_impl.h" |
| 30 #include "content/browser/gpu/gpu_surface_tracker.h" | 30 #include "content/browser/gpu/gpu_surface_tracker.h" |
| 31 #include "content/browser/renderer_host/render_widget_host_impl.h" | 31 #include "content/browser/renderer_host/render_widget_host_impl.h" |
| 32 #include "content/common/gpu/client/context_provider_command_buffer.h" | 32 #include "content/common/gpu/client/context_provider_command_buffer.h" |
| 33 #include "content/common/gpu/client/gl_helper.h" | 33 #include "content/common/gpu/client/gl_helper.h" |
| 34 #include "content/common/gpu/client/gpu_channel_host.h" | 34 #include "content/common/gpu/client/gpu_channel_host.h" |
| 35 #include "content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h" | 35 #include "content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h" |
| (...skipping 23 matching lines...) Expand all Loading... |
| 59 #endif | 59 #endif |
| 60 | 60 |
| 61 using cc::ContextProvider; | 61 using cc::ContextProvider; |
| 62 using gpu::gles2::GLES2Interface; | 62 using gpu::gles2::GLES2Interface; |
| 63 | 63 |
| 64 namespace content { | 64 namespace content { |
| 65 | 65 |
| 66 struct GpuProcessTransportFactory::PerCompositorData { | 66 struct GpuProcessTransportFactory::PerCompositorData { |
| 67 int surface_id; | 67 int surface_id; |
| 68 scoped_refptr<ReflectorImpl> reflector; | 68 scoped_refptr<ReflectorImpl> reflector; |
| 69 scoped_ptr<OnscreenDisplayClient> display_client; | 69 scoped_ptr<cc::OnscreenDisplayClient> display_client; |
| 70 }; | 70 }; |
| 71 | 71 |
| 72 GpuProcessTransportFactory::GpuProcessTransportFactory() | 72 GpuProcessTransportFactory::GpuProcessTransportFactory() |
| 73 : next_surface_id_namespace_(1u), | 73 : next_surface_id_namespace_(1u), |
| 74 callback_factory_(this) { | 74 callback_factory_(this) { |
| 75 output_surface_proxy_ = new BrowserCompositorOutputSurfaceProxy( | 75 output_surface_proxy_ = new BrowserCompositorOutputSurfaceProxy( |
| 76 &output_surface_map_); | 76 &output_surface_map_); |
| 77 #if defined(OS_CHROMEOS) | 77 #if defined(OS_CHROMEOS) |
| 78 bool use_thread = !base::CommandLine::ForCurrentProcess()->HasSwitch( | 78 bool use_thread = !base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 79 switches::kUIDisableThreadedCompositing); | 79 switches::kUIDisableThreadedCompositing); |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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, |
| 227 data->surface_id, | 227 data->surface_id, |
| 228 &output_surface_map_, | 228 &output_surface_map_, |
| 229 compositor->vsync_manager(), | 229 compositor->vsync_manager(), |
| 230 CreateOverlayCandidateValidator(compositor->widget()))); | 230 CreateOverlayCandidateValidator(compositor->widget()))); |
| 231 } | 231 } |
| 232 scoped_ptr<OnscreenDisplayClient> display_client(new OnscreenDisplayClient( | 232 scoped_ptr<cc::OnscreenDisplayClient> display_client( |
| 233 display_surface.Pass(), manager, compositor->GetRendererSettings(), | 233 new cc::OnscreenDisplayClient( |
| 234 compositor->task_runner())); | 234 display_surface.Pass(), manager, HostSharedBitmapManager::current(), |
| 235 BrowserGpuMemoryBufferManager::current(), |
| 236 compositor->GetRendererSettings(), compositor->task_runner())); |
| 235 | 237 |
| 236 scoped_ptr<SurfaceDisplayOutputSurface> output_surface( | 238 scoped_ptr<cc::SurfaceDisplayOutputSurface> output_surface( |
| 237 new SurfaceDisplayOutputSurface( | 239 new cc::SurfaceDisplayOutputSurface( |
| 238 manager, compositor->surface_id_allocator(), context_provider)); | 240 manager, compositor->surface_id_allocator(), context_provider)); |
| 239 display_client->set_surface_output_surface(output_surface.get()); | 241 display_client->set_surface_output_surface(output_surface.get()); |
| 240 output_surface->set_display_client(display_client.get()); | 242 output_surface->set_display_client(display_client.get()); |
| 241 display_client->display()->Resize(compositor->size()); | 243 display_client->display()->Resize(compositor->size()); |
| 242 data->display_client = display_client.Pass(); | 244 data->display_client = display_client.Pass(); |
| 243 compositor->SetOutputSurface(output_surface.Pass()); | 245 compositor->SetOutputSurface(output_surface.Pass()); |
| 244 return; | 246 return; |
| 245 } | 247 } |
| 246 | 248 |
| 247 if (!context_provider.get()) { | 249 if (!context_provider.get()) { |
| (...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 537 FOR_EACH_OBSERVER(ImageTransportFactoryObserver, | 539 FOR_EACH_OBSERVER(ImageTransportFactoryObserver, |
| 538 observer_list_, | 540 observer_list_, |
| 539 OnLostResources()); | 541 OnLostResources()); |
| 540 | 542 |
| 541 // Kill things that use the shared context before killing the shared context. | 543 // Kill things that use the shared context before killing the shared context. |
| 542 lost_gl_helper.reset(); | 544 lost_gl_helper.reset(); |
| 543 lost_shared_main_thread_contexts = NULL; | 545 lost_shared_main_thread_contexts = NULL; |
| 544 } | 546 } |
| 545 | 547 |
| 546 } // namespace content | 548 } // namespace content |
| OLD | NEW |