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 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 15 matching lines...) Expand all Loading... |
26 #include "cc/scheduler/begin_frame_source.h" | 26 #include "cc/scheduler/begin_frame_source.h" |
27 #include "cc/scheduler/delay_based_time_source.h" | 27 #include "cc/scheduler/delay_based_time_source.h" |
28 #include "cc/surfaces/direct_compositor_frame_sink.h" | 28 #include "cc/surfaces/direct_compositor_frame_sink.h" |
29 #include "cc/surfaces/display.h" | 29 #include "cc/surfaces/display.h" |
30 #include "cc/surfaces/display_scheduler.h" | 30 #include "cc/surfaces/display_scheduler.h" |
31 #include "cc/surfaces/surface_manager.h" | 31 #include "cc/surfaces/surface_manager.h" |
32 #include "components/display_compositor/compositor_overlay_candidate_validator.h
" | 32 #include "components/display_compositor/compositor_overlay_candidate_validator.h
" |
33 #include "components/display_compositor/gl_helper.h" | 33 #include "components/display_compositor/gl_helper.h" |
34 #include "components/display_compositor/host_shared_bitmap_manager.h" | 34 #include "components/display_compositor/host_shared_bitmap_manager.h" |
35 #include "content/browser/compositor/browser_compositor_output_surface.h" | 35 #include "content/browser/compositor/browser_compositor_output_surface.h" |
| 36 #include "content/browser/compositor/frame_sink_manager_host.h" |
36 #include "content/browser/compositor/gpu_browser_compositor_output_surface.h" | 37 #include "content/browser/compositor/gpu_browser_compositor_output_surface.h" |
37 #include "content/browser/compositor/gpu_surfaceless_browser_compositor_output_s
urface.h" | 38 #include "content/browser/compositor/gpu_surfaceless_browser_compositor_output_s
urface.h" |
38 #include "content/browser/compositor/offscreen_browser_compositor_output_surface
.h" | 39 #include "content/browser/compositor/offscreen_browser_compositor_output_surface
.h" |
39 #include "content/browser/compositor/reflector_impl.h" | 40 #include "content/browser/compositor/reflector_impl.h" |
40 #include "content/browser/compositor/software_browser_compositor_output_surface.
h" | 41 #include "content/browser/compositor/software_browser_compositor_output_surface.
h" |
41 #include "content/browser/gpu/browser_gpu_memory_buffer_manager.h" | 42 #include "content/browser/gpu/browser_gpu_memory_buffer_manager.h" |
42 #include "content/browser/gpu/gpu_data_manager_impl.h" | 43 #include "content/browser/gpu/gpu_data_manager_impl.h" |
43 #include "content/browser/renderer_host/render_widget_host_impl.h" | 44 #include "content/browser/renderer_host/render_widget_host_impl.h" |
44 #include "content/public/common/content_switches.h" | 45 #include "content/public/common/content_switches.h" |
45 #include "gpu/GLES2/gl2extchromium.h" | 46 #include "gpu/GLES2/gl2extchromium.h" |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
188 std::unique_ptr<cc::Display> display; | 189 std::unique_ptr<cc::Display> display; |
189 bool output_is_secure = false; | 190 bool output_is_secure = false; |
190 }; | 191 }; |
191 | 192 |
192 GpuProcessTransportFactory::GpuProcessTransportFactory() | 193 GpuProcessTransportFactory::GpuProcessTransportFactory() |
193 : frame_sink_id_allocator_(kDefaultClientId), | 194 : frame_sink_id_allocator_(kDefaultClientId), |
194 task_graph_runner_(new cc::SingleThreadTaskGraphRunner), | 195 task_graph_runner_(new cc::SingleThreadTaskGraphRunner), |
195 callback_factory_(this) { | 196 callback_factory_(this) { |
196 cc::SetClientNameForMetrics("Browser"); | 197 cc::SetClientNameForMetrics("Browser"); |
197 | 198 |
198 surface_manager_ = base::WrapUnique(new cc::SurfaceManager); | 199 frame_sink_manager_host_ = base::MakeUnique<FrameSinkManagerHost>(); |
199 | 200 |
200 task_graph_runner_->Start("CompositorTileWorker1", | 201 task_graph_runner_->Start("CompositorTileWorker1", |
201 base::SimpleThread::Options()); | 202 base::SimpleThread::Options()); |
202 #if defined(OS_WIN) | 203 #if defined(OS_WIN) |
203 software_backing_.reset(new OutputDeviceBacking); | 204 software_backing_.reset(new OutputDeviceBacking); |
204 #endif | 205 #endif |
205 } | 206 } |
206 | 207 |
207 GpuProcessTransportFactory::~GpuProcessTransportFactory() { | 208 GpuProcessTransportFactory::~GpuProcessTransportFactory() { |
208 DCHECK(per_compositor_data_.empty()); | 209 DCHECK(per_compositor_data_.empty()); |
(...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
591 // until we have reset |data->display|. | 592 // until we have reset |data->display|. |
592 data->synthetic_begin_frame_source = std::move(synthetic_begin_frame_source); | 593 data->synthetic_begin_frame_source = std::move(synthetic_begin_frame_source); |
593 data->gpu_vsync_begin_frame_source = std::move(gpu_vsync_begin_frame_source); | 594 data->gpu_vsync_begin_frame_source = std::move(gpu_vsync_begin_frame_source); |
594 | 595 |
595 // The |delegated_output_surface| is given back to the compositor, it | 596 // The |delegated_output_surface| is given back to the compositor, it |
596 // delegates to the Display as its root surface. Importantly, it shares the | 597 // delegates to the Display as its root surface. Importantly, it shares the |
597 // same ContextProvider as the Display's output surface. | 598 // same ContextProvider as the Display's output surface. |
598 auto compositor_frame_sink = | 599 auto compositor_frame_sink = |
599 vulkan_context_provider | 600 vulkan_context_provider |
600 ? base::MakeUnique<cc::DirectCompositorFrameSink>( | 601 ? base::MakeUnique<cc::DirectCompositorFrameSink>( |
601 compositor->frame_sink_id(), surface_manager_.get(), | 602 compositor->frame_sink_id(), GetSurfaceManager(), |
602 data->display.get(), | 603 data->display.get(), |
603 static_cast<scoped_refptr<cc::VulkanContextProvider>>( | 604 static_cast<scoped_refptr<cc::VulkanContextProvider>>( |
604 vulkan_context_provider)) | 605 vulkan_context_provider)) |
605 : base::MakeUnique<cc::DirectCompositorFrameSink>( | 606 : base::MakeUnique<cc::DirectCompositorFrameSink>( |
606 compositor->frame_sink_id(), surface_manager_.get(), | 607 compositor->frame_sink_id(), GetSurfaceManager(), |
607 data->display.get(), context_provider, | 608 data->display.get(), context_provider, |
608 shared_worker_context_provider_, GetGpuMemoryBufferManager(), | 609 shared_worker_context_provider_, GetGpuMemoryBufferManager(), |
609 display_compositor::HostSharedBitmapManager::current()); | 610 display_compositor::HostSharedBitmapManager::current()); |
610 data->display->Resize(compositor->size()); | 611 data->display->Resize(compositor->size()); |
611 data->display->SetOutputIsSecure(data->output_is_secure); | 612 data->display->SetOutputIsSecure(data->output_is_secure); |
612 compositor->SetCompositorFrameSink(std::move(compositor_frame_sink)); | 613 compositor->SetCompositorFrameSink(std::move(compositor_frame_sink)); |
613 } | 614 } |
614 | 615 |
615 std::unique_ptr<ui::Reflector> GpuProcessTransportFactory::CreateReflector( | 616 std::unique_ptr<ui::Reflector> GpuProcessTransportFactory::CreateReflector( |
616 ui::Compositor* source_compositor, | 617 ui::Compositor* source_compositor, |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
786 ui::ContextFactoryObserver* observer) { | 787 ui::ContextFactoryObserver* observer) { |
787 observer_list_.AddObserver(observer); | 788 observer_list_.AddObserver(observer); |
788 } | 789 } |
789 | 790 |
790 void GpuProcessTransportFactory::RemoveObserver( | 791 void GpuProcessTransportFactory::RemoveObserver( |
791 ui::ContextFactoryObserver* observer) { | 792 ui::ContextFactoryObserver* observer) { |
792 observer_list_.RemoveObserver(observer); | 793 observer_list_.RemoveObserver(observer); |
793 } | 794 } |
794 | 795 |
795 cc::SurfaceManager* GpuProcessTransportFactory::GetSurfaceManager() { | 796 cc::SurfaceManager* GpuProcessTransportFactory::GetSurfaceManager() { |
796 return surface_manager_.get(); | 797 return frame_sink_manager_host_->surface_manager(); |
| 798 } |
| 799 |
| 800 FrameSinkManagerHost* GpuProcessTransportFactory::GetFrameSinkManagerHost() { |
| 801 return frame_sink_manager_host_.get(); |
797 } | 802 } |
798 | 803 |
799 display_compositor::GLHelper* GpuProcessTransportFactory::GetGLHelper() { | 804 display_compositor::GLHelper* GpuProcessTransportFactory::GetGLHelper() { |
800 if (!gl_helper_ && !per_compositor_data_.empty()) { | 805 if (!gl_helper_ && !per_compositor_data_.empty()) { |
801 scoped_refptr<cc::ContextProvider> provider = | 806 scoped_refptr<cc::ContextProvider> provider = |
802 SharedMainThreadContextProvider(); | 807 SharedMainThreadContextProvider(); |
803 if (provider.get()) | 808 if (provider.get()) |
804 gl_helper_.reset(new display_compositor::GLHelper( | 809 gl_helper_.reset(new display_compositor::GLHelper( |
805 provider->ContextGL(), provider->ContextSupport())); | 810 provider->ContextGL(), provider->ContextSupport())); |
806 } | 811 } |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
924 shared_vulkan_context_provider_ = | 929 shared_vulkan_context_provider_ = |
925 cc::VulkanInProcessContextProvider::Create(); | 930 cc::VulkanInProcessContextProvider::Create(); |
926 } | 931 } |
927 | 932 |
928 shared_vulkan_context_provider_initialized_ = true; | 933 shared_vulkan_context_provider_initialized_ = true; |
929 } | 934 } |
930 return shared_vulkan_context_provider_; | 935 return shared_vulkan_context_provider_; |
931 } | 936 } |
932 | 937 |
933 } // namespace content | 938 } // namespace content |
OLD | NEW |