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 10 matching lines...) Expand all Loading... |
21 #include "cc/base/histograms.h" | 21 #include "cc/base/histograms.h" |
22 #include "cc/output/texture_mailbox_deleter.h" | 22 #include "cc/output/texture_mailbox_deleter.h" |
23 #include "cc/output/vulkan_in_process_context_provider.h" | 23 #include "cc/output/vulkan_in_process_context_provider.h" |
24 #include "cc/raster/single_thread_task_graph_runner.h" | 24 #include "cc/raster/single_thread_task_graph_runner.h" |
25 #include "cc/raster/task_graph_runner.h" | 25 #include "cc/raster/task_graph_runner.h" |
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/framesink_manager.h" |
31 #include "cc/surfaces/surface_manager.h" | 32 #include "cc/surfaces/surface_manager.h" |
32 #include "components/display_compositor/compositor_overlay_candidate_validator.h
" | 33 #include "components/display_compositor/compositor_overlay_candidate_validator.h
" |
33 #include "components/display_compositor/gl_helper.h" | 34 #include "components/display_compositor/gl_helper.h" |
34 #include "content/browser/compositor/browser_compositor_output_surface.h" | 35 #include "content/browser/compositor/browser_compositor_output_surface.h" |
35 #include "content/browser/compositor/gpu_browser_compositor_output_surface.h" | 36 #include "content/browser/compositor/gpu_browser_compositor_output_surface.h" |
36 #include "content/browser/compositor/gpu_surfaceless_browser_compositor_output_s
urface.h" | 37 #include "content/browser/compositor/gpu_surfaceless_browser_compositor_output_s
urface.h" |
37 #include "content/browser/compositor/offscreen_browser_compositor_output_surface
.h" | 38 #include "content/browser/compositor/offscreen_browser_compositor_output_surface
.h" |
38 #include "content/browser/compositor/reflector_impl.h" | 39 #include "content/browser/compositor/reflector_impl.h" |
39 #include "content/browser/compositor/software_browser_compositor_output_surface.
h" | 40 #include "content/browser/compositor/software_browser_compositor_output_surface.
h" |
40 #include "content/browser/gpu/browser_gpu_memory_buffer_manager.h" | 41 #include "content/browser/gpu/browser_gpu_memory_buffer_manager.h" |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
173 std::unique_ptr<cc::Display> display; | 174 std::unique_ptr<cc::Display> display; |
174 bool output_is_secure = false; | 175 bool output_is_secure = false; |
175 }; | 176 }; |
176 | 177 |
177 GpuProcessTransportFactory::GpuProcessTransportFactory() | 178 GpuProcessTransportFactory::GpuProcessTransportFactory() |
178 : task_graph_runner_(new cc::SingleThreadTaskGraphRunner), | 179 : task_graph_runner_(new cc::SingleThreadTaskGraphRunner), |
179 callback_factory_(this) { | 180 callback_factory_(this) { |
180 cc::SetClientNameForMetrics("Browser"); | 181 cc::SetClientNameForMetrics("Browser"); |
181 | 182 |
182 surface_manager_ = base::WrapUnique(new cc::SurfaceManager); | 183 surface_manager_ = base::WrapUnique(new cc::SurfaceManager); |
| 184 framesink_manager_ = base::WrapUnique(new cc::FrameSinkManager); |
183 | 185 |
184 task_graph_runner_->Start("CompositorTileWorker1", | 186 task_graph_runner_->Start("CompositorTileWorker1", |
185 base::SimpleThread::Options()); | 187 base::SimpleThread::Options()); |
186 #if defined(OS_WIN) | 188 #if defined(OS_WIN) |
187 software_backing_.reset(new OutputDeviceBacking); | 189 software_backing_.reset(new OutputDeviceBacking); |
188 #endif | 190 #endif |
189 } | 191 } |
190 | 192 |
191 GpuProcessTransportFactory::~GpuProcessTransportFactory() { | 193 GpuProcessTransportFactory::~GpuProcessTransportFactory() { |
192 DCHECK(per_compositor_data_.empty()); | 194 DCHECK(per_compositor_data_.empty()); |
(...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
582 // until we have reset |data->display|. | 584 // until we have reset |data->display|. |
583 data->begin_frame_source = std::move(synthetic_begin_frame_source); | 585 data->begin_frame_source = std::move(synthetic_begin_frame_source); |
584 | 586 |
585 // The |delegated_output_surface| is given back to the compositor, it | 587 // The |delegated_output_surface| is given back to the compositor, it |
586 // delegates to the Display as its root surface. Importantly, it shares the | 588 // delegates to the Display as its root surface. Importantly, it shares the |
587 // same ContextProvider as the Display's output surface. | 589 // same ContextProvider as the Display's output surface. |
588 auto compositor_frame_sink = | 590 auto compositor_frame_sink = |
589 vulkan_context_provider | 591 vulkan_context_provider |
590 ? base::MakeUnique<cc::DirectCompositorFrameSink>( | 592 ? base::MakeUnique<cc::DirectCompositorFrameSink>( |
591 compositor->frame_sink_id(), surface_manager_.get(), | 593 compositor->frame_sink_id(), surface_manager_.get(), |
592 data->display.get(), | 594 framesink_manager_.get(), data->display.get(), |
593 static_cast<scoped_refptr<cc::VulkanContextProvider>>( | 595 static_cast<scoped_refptr<cc::VulkanContextProvider>>( |
594 vulkan_context_provider)) | 596 vulkan_context_provider)) |
595 : base::MakeUnique<cc::DirectCompositorFrameSink>( | 597 : base::MakeUnique<cc::DirectCompositorFrameSink>( |
596 compositor->frame_sink_id(), surface_manager_.get(), | 598 compositor->frame_sink_id(), surface_manager_.get(), |
597 data->display.get(), context_provider, | 599 framesink_manager_.get(), data->display.get(), context_provider, |
598 shared_worker_context_provider_, GetGpuMemoryBufferManager(), | 600 shared_worker_context_provider_, GetGpuMemoryBufferManager(), |
599 HostSharedBitmapManager::current()); | 601 HostSharedBitmapManager::current()); |
600 data->display->Resize(compositor->size()); | 602 data->display->Resize(compositor->size()); |
601 data->display->SetOutputIsSecure(data->output_is_secure); | 603 data->display->SetOutputIsSecure(data->output_is_secure); |
602 compositor->SetCompositorFrameSink(std::move(compositor_frame_sink)); | 604 compositor->SetCompositorFrameSink(std::move(compositor_frame_sink)); |
603 } | 605 } |
604 | 606 |
605 std::unique_ptr<ui::Reflector> GpuProcessTransportFactory::CreateReflector( | 607 std::unique_ptr<ui::Reflector> GpuProcessTransportFactory::CreateReflector( |
606 ui::Compositor* source_compositor, | 608 ui::Compositor* source_compositor, |
607 ui::Layer* target_layer) { | 609 ui::Layer* target_layer) { |
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
779 | 781 |
780 void GpuProcessTransportFactory::RemoveObserver( | 782 void GpuProcessTransportFactory::RemoveObserver( |
781 ui::ContextFactoryObserver* observer) { | 783 ui::ContextFactoryObserver* observer) { |
782 observer_list_.RemoveObserver(observer); | 784 observer_list_.RemoveObserver(observer); |
783 } | 785 } |
784 | 786 |
785 cc::SurfaceManager* GpuProcessTransportFactory::GetSurfaceManager() { | 787 cc::SurfaceManager* GpuProcessTransportFactory::GetSurfaceManager() { |
786 return surface_manager_.get(); | 788 return surface_manager_.get(); |
787 } | 789 } |
788 | 790 |
| 791 cc::FrameSinkManager* GpuProcessTransportFactory::GetFrameSinkManager() { |
| 792 return framesink_manager_.get(); |
| 793 } |
| 794 |
789 display_compositor::GLHelper* GpuProcessTransportFactory::GetGLHelper() { | 795 display_compositor::GLHelper* GpuProcessTransportFactory::GetGLHelper() { |
790 if (!gl_helper_ && !per_compositor_data_.empty()) { | 796 if (!gl_helper_ && !per_compositor_data_.empty()) { |
791 scoped_refptr<cc::ContextProvider> provider = | 797 scoped_refptr<cc::ContextProvider> provider = |
792 SharedMainThreadContextProvider(); | 798 SharedMainThreadContextProvider(); |
793 if (provider.get()) | 799 if (provider.get()) |
794 gl_helper_.reset(new display_compositor::GLHelper( | 800 gl_helper_.reset(new display_compositor::GLHelper( |
795 provider->ContextGL(), provider->ContextSupport())); | 801 provider->ContextGL(), provider->ContextSupport())); |
796 } | 802 } |
797 return gl_helper_.get(); | 803 return gl_helper_.get(); |
798 } | 804 } |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
914 shared_vulkan_context_provider_ = | 920 shared_vulkan_context_provider_ = |
915 cc::VulkanInProcessContextProvider::Create(); | 921 cc::VulkanInProcessContextProvider::Create(); |
916 } | 922 } |
917 | 923 |
918 shared_vulkan_context_provider_initialized_ = true; | 924 shared_vulkan_context_provider_initialized_ = true; |
919 } | 925 } |
920 return shared_vulkan_context_provider_; | 926 return shared_vulkan_context_provider_; |
921 } | 927 } |
922 | 928 |
923 } // namespace content | 929 } // namespace content |
OLD | NEW |