Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(46)

Side by Side Diff: content/browser/compositor/gpu_process_transport_factory.cc

Issue 2932893002: BrowserMainLoop owns FrameSinkManagerHost (Closed)
Patch Set: updated Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 16 matching lines...) Expand all
27 #include "cc/scheduler/begin_frame_source.h" 27 #include "cc/scheduler/begin_frame_source.h"
28 #include "cc/scheduler/delay_based_time_source.h" 28 #include "cc/scheduler/delay_based_time_source.h"
29 #include "cc/surfaces/direct_compositor_frame_sink.h" 29 #include "cc/surfaces/direct_compositor_frame_sink.h"
30 #include "cc/surfaces/display.h" 30 #include "cc/surfaces/display.h"
31 #include "cc/surfaces/display_scheduler.h" 31 #include "cc/surfaces/display_scheduler.h"
32 #include "cc/surfaces/surface_manager.h" 32 #include "cc/surfaces/surface_manager.h"
33 #include "components/viz/display_compositor/compositor_overlay_candidate_validat or.h" 33 #include "components/viz/display_compositor/compositor_overlay_candidate_validat or.h"
34 #include "components/viz/display_compositor/gl_helper.h" 34 #include "components/viz/display_compositor/gl_helper.h"
35 #include "components/viz/display_compositor/host_shared_bitmap_manager.h" 35 #include "components/viz/display_compositor/host_shared_bitmap_manager.h"
36 #include "components/viz/host/frame_sink_manager_host.h" 36 #include "components/viz/host/frame_sink_manager_host.h"
37 #include "content/browser/browser_main_loop.h"
37 #include "content/browser/compositor/browser_compositor_output_surface.h" 38 #include "content/browser/compositor/browser_compositor_output_surface.h"
38 #include "content/browser/compositor/gpu_browser_compositor_output_surface.h" 39 #include "content/browser/compositor/gpu_browser_compositor_output_surface.h"
39 #include "content/browser/compositor/gpu_surfaceless_browser_compositor_output_s urface.h" 40 #include "content/browser/compositor/gpu_surfaceless_browser_compositor_output_s urface.h"
40 #include "content/browser/compositor/offscreen_browser_compositor_output_surface .h" 41 #include "content/browser/compositor/offscreen_browser_compositor_output_surface .h"
41 #include "content/browser/compositor/reflector_impl.h" 42 #include "content/browser/compositor/reflector_impl.h"
42 #include "content/browser/compositor/software_browser_compositor_output_surface. h" 43 #include "content/browser/compositor/software_browser_compositor_output_surface. h"
43 #include "content/browser/gpu/browser_gpu_memory_buffer_manager.h" 44 #include "content/browser/gpu/browser_gpu_memory_buffer_manager.h"
44 #include "content/browser/gpu/gpu_data_manager_impl.h" 45 #include "content/browser/gpu/gpu_data_manager_impl.h"
45 #include "content/browser/renderer_host/render_widget_host_impl.h" 46 #include "content/browser/renderer_host/render_widget_host_impl.h"
46 #include "content/common/gpu_stream_constants.h" 47 #include "content/common/gpu_stream_constants.h"
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
199 }; 200 };
200 201
201 GpuProcessTransportFactory::GpuProcessTransportFactory() 202 GpuProcessTransportFactory::GpuProcessTransportFactory()
202 : frame_sink_id_allocator_(kDefaultClientId), 203 : frame_sink_id_allocator_(kDefaultClientId),
203 renderer_settings_( 204 renderer_settings_(
204 ui::CreateRendererSettings(&gpu::GetImageTextureTarget)), 205 ui::CreateRendererSettings(&gpu::GetImageTextureTarget)),
205 task_graph_runner_(new cc::SingleThreadTaskGraphRunner), 206 task_graph_runner_(new cc::SingleThreadTaskGraphRunner),
206 callback_factory_(this) { 207 callback_factory_(this) {
207 cc::SetClientNameForMetrics("Browser"); 208 cc::SetClientNameForMetrics("Browser");
208 209
209 frame_sink_manager_host_ = base::MakeUnique<viz::FrameSinkManagerHost>();
210 frame_sink_manager_host_->ConnectToFrameSinkManager();
211
212 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); 210 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
213 if (command_line->HasSwitch(switches::kDisableGpuVsync)) { 211 if (command_line->HasSwitch(switches::kDisableGpuVsync)) {
214 std::string display_vsync_string = 212 std::string display_vsync_string =
215 command_line->GetSwitchValueASCII(switches::kDisableGpuVsync); 213 command_line->GetSwitchValueASCII(switches::kDisableGpuVsync);
216 // See comments in gl_switches about this flag. The browser compositor 214 // See comments in gl_switches about this flag. The browser compositor
217 // is only unthrottled when "gpu" or no switch value is passed, as it 215 // is only unthrottled when "gpu" or no switch value is passed, as it
218 // is driven directly by the display compositor. 216 // is driven directly by the display compositor.
219 if (display_vsync_string != "beginframe") { 217 if (display_vsync_string != "beginframe") {
220 disable_display_vsync_ = true; 218 disable_display_vsync_ = true;
221 } 219 }
(...skipping 485 matching lines...) Expand 10 before | Expand all | Expand 10 after
707 ui::ContextFactoryPrivate* 705 ui::ContextFactoryPrivate*
708 GpuProcessTransportFactory::GetContextFactoryPrivate() { 706 GpuProcessTransportFactory::GetContextFactoryPrivate() {
709 return this; 707 return this;
710 } 708 }
711 709
712 cc::FrameSinkId GpuProcessTransportFactory::AllocateFrameSinkId() { 710 cc::FrameSinkId GpuProcessTransportFactory::AllocateFrameSinkId() {
713 return frame_sink_id_allocator_.NextFrameSinkId(); 711 return frame_sink_id_allocator_.NextFrameSinkId();
714 } 712 }
715 713
716 cc::SurfaceManager* GpuProcessTransportFactory::GetSurfaceManager() { 714 cc::SurfaceManager* GpuProcessTransportFactory::GetSurfaceManager() {
717 return frame_sink_manager_host_->surface_manager(); 715 return BrowserMainLoop::GetInstance()
716 ->frame_sink_manager_host()
717 ->surface_manager();
718 } 718 }
719 719
720 viz::FrameSinkManagerHost* 720 viz::FrameSinkManagerHost*
721 GpuProcessTransportFactory::GetFrameSinkManagerHost() { 721 GpuProcessTransportFactory::GetFrameSinkManagerHost() {
722 return frame_sink_manager_host_.get(); 722 return BrowserMainLoop::GetInstance()->frame_sink_manager_host();
723 } 723 }
724 724
725 void GpuProcessTransportFactory::SetDisplayVisible(ui::Compositor* compositor, 725 void GpuProcessTransportFactory::SetDisplayVisible(ui::Compositor* compositor,
726 bool visible) { 726 bool visible) {
727 PerCompositorDataMap::iterator it = per_compositor_data_.find(compositor); 727 PerCompositorDataMap::iterator it = per_compositor_data_.find(compositor);
728 if (it == per_compositor_data_.end()) 728 if (it == per_compositor_data_.end())
729 return; 729 return;
730 PerCompositorData* data = it->second.get(); 730 PerCompositorData* data = it->second.get();
731 DCHECK(data); 731 DCHECK(data);
732 // The compositor will always SetVisible on the Display once it is set up, so 732 // The compositor will always SetVisible on the Display once it is set up, so
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after
945 shared_vulkan_context_provider_ = 945 shared_vulkan_context_provider_ =
946 cc::VulkanInProcessContextProvider::Create(); 946 cc::VulkanInProcessContextProvider::Create();
947 } 947 }
948 948
949 shared_vulkan_context_provider_initialized_ = true; 949 shared_vulkan_context_provider_initialized_ = true;
950 } 950 }
951 return shared_vulkan_context_provider_; 951 return shared_vulkan_context_provider_;
952 } 952 }
953 953
954 } // namespace content 954 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698