| 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 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 192 | 192 |
| 193 GpuProcessTransportFactory::GpuProcessTransportFactory() | 193 GpuProcessTransportFactory::GpuProcessTransportFactory() |
| 194 : frame_sink_id_allocator_(kDefaultClientId), | 194 : frame_sink_id_allocator_(kDefaultClientId), |
| 195 task_graph_runner_(new cc::SingleThreadTaskGraphRunner), | 195 task_graph_runner_(new cc::SingleThreadTaskGraphRunner), |
| 196 callback_factory_(this) { | 196 callback_factory_(this) { |
| 197 cc::SetClientNameForMetrics("Browser"); | 197 cc::SetClientNameForMetrics("Browser"); |
| 198 | 198 |
| 199 frame_sink_manager_host_ = base::MakeUnique<FrameSinkManagerHost>(); | 199 frame_sink_manager_host_ = base::MakeUnique<FrameSinkManagerHost>(); |
| 200 frame_sink_manager_host_->ConnectToFrameSinkManager(); | 200 frame_sink_manager_host_->ConnectToFrameSinkManager(); |
| 201 | 201 |
| 202 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); |
| 203 if (command_line->HasSwitch(switches::kDisableGpuVsync)) { |
| 204 std::string display_vsync_string = |
| 205 command_line->GetSwitchValueASCII(switches::kDisableGpuVsync); |
| 206 // See comments in gl_switches about this flag. The browser compositor |
| 207 // is only unthrottled when "gpu" or no switch value is passed, as it |
| 208 // is driven directly by the display compositor. |
| 209 if (display_vsync_string != "beginframe") { |
| 210 disable_display_vsync_ = true; |
| 211 } |
| 212 } |
| 213 |
| 202 task_graph_runner_->Start("CompositorTileWorker1", | 214 task_graph_runner_->Start("CompositorTileWorker1", |
| 203 base::SimpleThread::Options()); | 215 base::SimpleThread::Options()); |
| 204 #if defined(OS_WIN) | 216 #if defined(OS_WIN) |
| 205 software_backing_.reset(new OutputDeviceBacking); | 217 software_backing_.reset(new OutputDeviceBacking); |
| 206 #endif | 218 #endif |
| 207 } | 219 } |
| 208 | 220 |
| 209 GpuProcessTransportFactory::~GpuProcessTransportFactory() { | 221 GpuProcessTransportFactory::~GpuProcessTransportFactory() { |
| 210 DCHECK(per_compositor_data_.empty()); | 222 DCHECK(per_compositor_data_.empty()); |
| 211 | 223 |
| (...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 544 } | 556 } |
| 545 | 557 |
| 546 data->display_output_surface = display_output_surface.get(); | 558 data->display_output_surface = display_output_surface.get(); |
| 547 if (data->reflector) | 559 if (data->reflector) |
| 548 data->reflector->OnSourceSurfaceReady(data->display_output_surface); | 560 data->reflector->OnSourceSurfaceReady(data->display_output_surface); |
| 549 | 561 |
| 550 std::unique_ptr<cc::SyntheticBeginFrameSource> synthetic_begin_frame_source; | 562 std::unique_ptr<cc::SyntheticBeginFrameSource> synthetic_begin_frame_source; |
| 551 std::unique_ptr<GpuVSyncBeginFrameSource> gpu_vsync_begin_frame_source; | 563 std::unique_ptr<GpuVSyncBeginFrameSource> gpu_vsync_begin_frame_source; |
| 552 | 564 |
| 553 if (!begin_frame_source) { | 565 if (!begin_frame_source) { |
| 554 if (!compositor->GetRendererSettings().disable_display_vsync) { | 566 if (!disable_display_vsync_) { |
| 555 if (gpu_vsync_control && IsGpuVSyncSignalSupported()) { | 567 if (gpu_vsync_control && IsGpuVSyncSignalSupported()) { |
| 556 gpu_vsync_begin_frame_source = | 568 gpu_vsync_begin_frame_source = |
| 557 base::MakeUnique<GpuVSyncBeginFrameSource>(gpu_vsync_control); | 569 base::MakeUnique<GpuVSyncBeginFrameSource>(gpu_vsync_control); |
| 558 begin_frame_source = gpu_vsync_begin_frame_source.get(); | 570 begin_frame_source = gpu_vsync_begin_frame_source.get(); |
| 559 } else { | 571 } else { |
| 560 synthetic_begin_frame_source = | 572 synthetic_begin_frame_source = |
| 561 base::MakeUnique<cc::DelayBasedBeginFrameSource>( | 573 base::MakeUnique<cc::DelayBasedBeginFrameSource>( |
| 562 base::MakeUnique<cc::DelayBasedTimeSource>( | 574 base::MakeUnique<cc::DelayBasedTimeSource>( |
| 563 compositor->task_runner().get())); | 575 compositor->task_runner().get())); |
| 564 begin_frame_source = synthetic_begin_frame_source.get(); | 576 begin_frame_source = synthetic_begin_frame_source.get(); |
| (...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 931 shared_vulkan_context_provider_ = | 943 shared_vulkan_context_provider_ = |
| 932 cc::VulkanInProcessContextProvider::Create(); | 944 cc::VulkanInProcessContextProvider::Create(); |
| 933 } | 945 } |
| 934 | 946 |
| 935 shared_vulkan_context_provider_initialized_ = true; | 947 shared_vulkan_context_provider_initialized_ = true; |
| 936 } | 948 } |
| 937 return shared_vulkan_context_provider_; | 949 return shared_vulkan_context_provider_; |
| 938 } | 950 } |
| 939 | 951 |
| 940 } // namespace content | 952 } // namespace content |
| OLD | NEW |