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

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

Issue 2879463002: Initialize RendererSettings in ContextFactory (Closed)
Patch Set: const RendererSettings Created 3 years, 7 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"
11 #include "base/command_line.h" 11 #include "base/command_line.h"
12 #include "base/location.h" 12 #include "base/location.h"
13 #include "base/memory/ptr_util.h" 13 #include "base/memory/ptr_util.h"
14 #include "base/metrics/histogram_macros.h" 14 #include "base/metrics/histogram_macros.h"
15 #include "base/profiler/scoped_tracker.h" 15 #include "base/profiler/scoped_tracker.h"
16 #include "base/single_thread_task_runner.h" 16 #include "base/single_thread_task_runner.h"
17 #include "base/threading/simple_thread.h" 17 #include "base/threading/simple_thread.h"
18 #include "base/threading/thread.h" 18 #include "base/threading/thread.h"
19 #include "base/threading/thread_task_runner_handle.h" 19 #include "base/threading/thread_task_runner_handle.h"
20 #include "build/build_config.h" 20 #include "build/build_config.h"
21 #include "cc/base/histograms.h" 21 #include "cc/base/histograms.h"
22 #include "cc/base/switches.h"
22 #include "cc/output/texture_mailbox_deleter.h" 23 #include "cc/output/texture_mailbox_deleter.h"
23 #include "cc/output/vulkan_in_process_context_provider.h" 24 #include "cc/output/vulkan_in_process_context_provider.h"
24 #include "cc/raster/single_thread_task_graph_runner.h" 25 #include "cc/raster/single_thread_task_graph_runner.h"
25 #include "cc/raster/task_graph_runner.h" 26 #include "cc/raster/task_graph_runner.h"
26 #include "cc/scheduler/begin_frame_source.h" 27 #include "cc/scheduler/begin_frame_source.h"
27 #include "cc/scheduler/delay_based_time_source.h" 28 #include "cc/scheduler/delay_based_time_source.h"
28 #include "cc/surfaces/direct_compositor_frame_sink.h" 29 #include "cc/surfaces/direct_compositor_frame_sink.h"
29 #include "cc/surfaces/display.h" 30 #include "cc/surfaces/display.h"
30 #include "cc/surfaces/display_scheduler.h" 31 #include "cc/surfaces/display_scheduler.h"
31 #include "cc/surfaces/surface_manager.h" 32 #include "cc/surfaces/surface_manager.h"
(...skipping 18 matching lines...) Expand all
50 #include "gpu/command_buffer/common/mailbox.h" 51 #include "gpu/command_buffer/common/mailbox.h"
51 #include "gpu/ipc/client/gpu_channel_host.h" 52 #include "gpu/ipc/client/gpu_channel_host.h"
52 #include "gpu/ipc/host/gpu_memory_buffer_support.h" 53 #include "gpu/ipc/host/gpu_memory_buffer_support.h"
53 #include "gpu/vulkan/features.h" 54 #include "gpu/vulkan/features.h"
54 #include "services/service_manager/runner/common/client_util.h" 55 #include "services/service_manager/runner/common/client_util.h"
55 #include "services/ui/public/cpp/gpu/context_provider_command_buffer.h" 56 #include "services/ui/public/cpp/gpu/context_provider_command_buffer.h"
56 #include "third_party/khronos/GLES2/gl2.h" 57 #include "third_party/khronos/GLES2/gl2.h"
57 #include "ui/compositor/compositor.h" 58 #include "ui/compositor/compositor.h"
58 #include "ui/compositor/compositor_constants.h" 59 #include "ui/compositor/compositor_constants.h"
59 #include "ui/compositor/compositor_switches.h" 60 #include "ui/compositor/compositor_switches.h"
61 #include "ui/compositor/compositor_util.h"
60 #include "ui/compositor/layer.h" 62 #include "ui/compositor/layer.h"
63 #include "ui/display/display_switches.h"
61 #include "ui/display/types/display_snapshot.h" 64 #include "ui/display/types/display_snapshot.h"
62 #include "ui/gfx/geometry/size.h" 65 #include "ui/gfx/geometry/size.h"
63 #include "ui/gfx/switches.h" 66 #include "ui/gfx/switches.h"
64 #include "ui/gl/gl_switches.h" 67 #include "ui/gl/gl_switches.h"
65 68
66 #if defined(USE_AURA) 69 #if defined(USE_AURA)
67 #include "content/public/common/service_manager_connection.h" 70 #include "content/public/common/service_manager_connection.h"
68 #include "ui/aura/window_tree_host.h" 71 #include "ui/aura/window_tree_host.h"
69 #endif 72 #endif
70 73
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 // valid but not both at the same time. 193 // valid but not both at the same time.
191 std::unique_ptr<cc::SyntheticBeginFrameSource> synthetic_begin_frame_source; 194 std::unique_ptr<cc::SyntheticBeginFrameSource> synthetic_begin_frame_source;
192 std::unique_ptr<GpuVSyncBeginFrameSource> gpu_vsync_begin_frame_source; 195 std::unique_ptr<GpuVSyncBeginFrameSource> gpu_vsync_begin_frame_source;
193 ReflectorImpl* reflector = nullptr; 196 ReflectorImpl* reflector = nullptr;
194 std::unique_ptr<cc::Display> display; 197 std::unique_ptr<cc::Display> display;
195 bool output_is_secure = false; 198 bool output_is_secure = false;
196 }; 199 };
197 200
198 GpuProcessTransportFactory::GpuProcessTransportFactory() 201 GpuProcessTransportFactory::GpuProcessTransportFactory()
199 : frame_sink_id_allocator_(kDefaultClientId), 202 : frame_sink_id_allocator_(kDefaultClientId),
203 renderer_settings_(
204 ui::CreateRendererSettings(&gpu::GetImageTextureTarget)),
200 task_graph_runner_(new cc::SingleThreadTaskGraphRunner), 205 task_graph_runner_(new cc::SingleThreadTaskGraphRunner),
201 callback_factory_(this) { 206 callback_factory_(this) {
202 cc::SetClientNameForMetrics("Browser"); 207 cc::SetClientNameForMetrics("Browser");
203 208
204 frame_sink_manager_host_ = base::MakeUnique<FrameSinkManagerHost>(); 209 frame_sink_manager_host_ = base::MakeUnique<FrameSinkManagerHost>();
205 frame_sink_manager_host_->ConnectToFrameSinkManager(); 210 frame_sink_manager_host_->ConnectToFrameSinkManager();
206 211
207 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); 212 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
208 if (command_line->HasSwitch(switches::kDisableGpuVsync)) { 213 if (command_line->HasSwitch(switches::kDisableGpuVsync)) {
209 std::string display_vsync_string = 214 std::string display_vsync_string =
(...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after
594 compositor->widget()); 599 compositor->widget());
595 #endif 600 #endif
596 601
597 std::unique_ptr<cc::DisplayScheduler> scheduler(new cc::DisplayScheduler( 602 std::unique_ptr<cc::DisplayScheduler> scheduler(new cc::DisplayScheduler(
598 compositor->task_runner().get(), 603 compositor->task_runner().get(),
599 display_output_surface->capabilities().max_frames_pending)); 604 display_output_surface->capabilities().max_frames_pending));
600 605
601 // The Display owns and uses the |display_output_surface| created above. 606 // The Display owns and uses the |display_output_surface| created above.
602 data->display = base::MakeUnique<cc::Display>( 607 data->display = base::MakeUnique<cc::Display>(
603 display_compositor::HostSharedBitmapManager::current(), 608 display_compositor::HostSharedBitmapManager::current(),
604 GetGpuMemoryBufferManager(), compositor->GetRendererSettings(), 609 GetGpuMemoryBufferManager(), renderer_settings_,
605 compositor->frame_sink_id(), begin_frame_source, 610 compositor->frame_sink_id(), begin_frame_source,
606 std::move(display_output_surface), std::move(scheduler), 611 std::move(display_output_surface), std::move(scheduler),
607 base::MakeUnique<cc::TextureMailboxDeleter>( 612 base::MakeUnique<cc::TextureMailboxDeleter>(
608 compositor->task_runner().get())); 613 compositor->task_runner().get()));
609 // Note that we are careful not to destroy prior BeginFrameSource objects 614 // Note that we are careful not to destroy prior BeginFrameSource objects
610 // until we have reset |data->display|. 615 // until we have reset |data->display|.
611 data->synthetic_begin_frame_source = std::move(synthetic_begin_frame_source); 616 data->synthetic_begin_frame_source = std::move(synthetic_begin_frame_source);
612 data->gpu_vsync_begin_frame_source = std::move(gpu_vsync_begin_frame_source); 617 data->gpu_vsync_begin_frame_source = std::move(gpu_vsync_begin_frame_source);
613 618
614 // The |delegated_output_surface| is given back to the compositor, it 619 // The |delegated_output_surface| is given back to the compositor, it
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
688 #if defined(OS_WIN) 693 #if defined(OS_WIN)
689 gfx::RenderingWindowManager::GetInstance()->UnregisterParent( 694 gfx::RenderingWindowManager::GetInstance()->UnregisterParent(
690 compositor->widget()); 695 compositor->widget());
691 #endif 696 #endif
692 } 697 }
693 698
694 double GpuProcessTransportFactory::GetRefreshRate() const { 699 double GpuProcessTransportFactory::GetRefreshRate() const {
695 return 60.0; 700 return 60.0;
696 } 701 }
697 702
698 uint32_t GpuProcessTransportFactory::GetImageTextureTarget(
699 gfx::BufferFormat format,
700 gfx::BufferUsage usage) {
701 return gpu::GetImageTextureTarget(format, usage);
702 }
703
704 gpu::GpuMemoryBufferManager* 703 gpu::GpuMemoryBufferManager*
705 GpuProcessTransportFactory::GetGpuMemoryBufferManager() { 704 GpuProcessTransportFactory::GetGpuMemoryBufferManager() {
706 return gpu_channel_factory_->GetGpuMemoryBufferManager(); 705 return gpu_channel_factory_->GetGpuMemoryBufferManager();
707 } 706 }
708 707
709 cc::TaskGraphRunner* GpuProcessTransportFactory::GetTaskGraphRunner() { 708 cc::TaskGraphRunner* GpuProcessTransportFactory::GetTaskGraphRunner() {
710 return task_graph_runner_.get(); 709 return task_graph_runner_.get();
711 } 710 }
712 711
713 ui::ContextFactory* GpuProcessTransportFactory::GetContextFactory() { 712 ui::ContextFactory* GpuProcessTransportFactory::GetContextFactory() {
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
796 PerCompositorDataMap::iterator it = per_compositor_data_.find(compositor); 795 PerCompositorDataMap::iterator it = per_compositor_data_.find(compositor);
797 if (it == per_compositor_data_.end()) 796 if (it == per_compositor_data_.end())
798 return; 797 return;
799 PerCompositorData* data = it->second.get(); 798 PerCompositorData* data = it->second.get();
800 DCHECK(data); 799 DCHECK(data);
801 data->output_is_secure = secure; 800 data->output_is_secure = secure;
802 if (data->display) 801 if (data->display)
803 data->display->SetOutputIsSecure(secure); 802 data->display->SetOutputIsSecure(secure);
804 } 803 }
805 804
805 const cc::RendererSettings& GpuProcessTransportFactory::GetRendererSettings()
806 const {
807 return renderer_settings_;
808 }
809
806 void GpuProcessTransportFactory::AddObserver( 810 void GpuProcessTransportFactory::AddObserver(
807 ui::ContextFactoryObserver* observer) { 811 ui::ContextFactoryObserver* observer) {
808 observer_list_.AddObserver(observer); 812 observer_list_.AddObserver(observer);
809 } 813 }
810 814
811 void GpuProcessTransportFactory::RemoveObserver( 815 void GpuProcessTransportFactory::RemoveObserver(
812 ui::ContextFactoryObserver* observer) { 816 ui::ContextFactoryObserver* observer) {
813 observer_list_.RemoveObserver(observer); 817 observer_list_.RemoveObserver(observer);
814 } 818 }
815 819
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
950 shared_vulkan_context_provider_ = 954 shared_vulkan_context_provider_ =
951 cc::VulkanInProcessContextProvider::Create(); 955 cc::VulkanInProcessContextProvider::Create();
952 } 956 }
953 957
954 shared_vulkan_context_provider_initialized_ = true; 958 shared_vulkan_context_provider_initialized_ = true;
955 } 959 }
956 return shared_vulkan_context_provider_; 960 return shared_vulkan_context_provider_;
957 } 961 }
958 962
959 } // namespace content 963 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/compositor/gpu_process_transport_factory.h ('k') | ui/aura/mus/mus_context_factory.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698