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

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

Issue 2932893002: BrowserMainLoop owns FrameSinkManagerHost (Closed)
Patch Set: Added a comment that works everywhere 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 500 matching lines...) Expand 10 before | Expand all | Expand 10 after
722 ui::ContextFactoryPrivate* 720 ui::ContextFactoryPrivate*
723 GpuProcessTransportFactory::GetContextFactoryPrivate() { 721 GpuProcessTransportFactory::GetContextFactoryPrivate() {
724 return this; 722 return this;
725 } 723 }
726 724
727 cc::FrameSinkId GpuProcessTransportFactory::AllocateFrameSinkId() { 725 cc::FrameSinkId GpuProcessTransportFactory::AllocateFrameSinkId() {
728 return frame_sink_id_allocator_.NextFrameSinkId(); 726 return frame_sink_id_allocator_.NextFrameSinkId();
729 } 727 }
730 728
731 cc::SurfaceManager* GpuProcessTransportFactory::GetSurfaceManager() { 729 cc::SurfaceManager* GpuProcessTransportFactory::GetSurfaceManager() {
732 return frame_sink_manager_host_->surface_manager(); 730 return BrowserMainLoop::GetInstance()
731 ->frame_sink_manager_host()
732 ->surface_manager();
733 } 733 }
734 734
735 viz::FrameSinkManagerHost* 735 viz::FrameSinkManagerHost*
736 GpuProcessTransportFactory::GetFrameSinkManagerHost() { 736 GpuProcessTransportFactory::GetFrameSinkManagerHost() {
737 return frame_sink_manager_host_.get(); 737 return BrowserMainLoop::GetInstance()->frame_sink_manager_host();
738 } 738 }
739 739
740 void GpuProcessTransportFactory::SetDisplayVisible(ui::Compositor* compositor, 740 void GpuProcessTransportFactory::SetDisplayVisible(ui::Compositor* compositor,
741 bool visible) { 741 bool visible) {
742 PerCompositorDataMap::iterator it = per_compositor_data_.find(compositor); 742 PerCompositorDataMap::iterator it = per_compositor_data_.find(compositor);
743 if (it == per_compositor_data_.end()) 743 if (it == per_compositor_data_.end())
744 return; 744 return;
745 PerCompositorData* data = it->second.get(); 745 PerCompositorData* data = it->second.get();
746 DCHECK(data); 746 DCHECK(data);
747 // The compositor will always SetVisible on the Display once it is set up, so 747 // 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
960 shared_vulkan_context_provider_ = 960 shared_vulkan_context_provider_ =
961 cc::VulkanInProcessContextProvider::Create(); 961 cc::VulkanInProcessContextProvider::Create();
962 } 962 }
963 963
964 shared_vulkan_context_provider_initialized_ = true; 964 shared_vulkan_context_provider_initialized_ = true;
965 } 965 }
966 return shared_vulkan_context_provider_; 966 return shared_vulkan_context_provider_;
967 } 967 }
968 968
969 } // namespace content 969 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/compositor/gpu_process_transport_factory.h ('k') | content/browser/compositor/surface_utils.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698