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

Side by Side Diff: services/ui/gpu/gpu_service.cc

Issue 2881813002: Revert of gpu: GPU service scheduler. (Closed)
Patch Set: 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 "services/ui/gpu/gpu_service.h" 5 #include "services/ui/gpu/gpu_service.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/debug/crash_logging.h" 8 #include "base/debug/crash_logging.h"
9 #include "base/lazy_instance.h" 9 #include "base/lazy_instance.h"
10 #include "base/memory/shared_memory.h" 10 #include "base/memory/shared_memory.h"
11 #include "base/message_loop/message_loop.h" 11 #include "base/message_loop/message_loop.h"
12 #include "base/threading/thread_task_runner_handle.h" 12 #include "base/threading/thread_task_runner_handle.h"
13 #include "build/build_config.h" 13 #include "build/build_config.h"
14 #include "cc/output/in_process_context_provider.h" 14 #include "cc/output/in_process_context_provider.h"
15 #include "gpu/command_buffer/client/gpu_memory_buffer_manager.h" 15 #include "gpu/command_buffer/client/gpu_memory_buffer_manager.h"
16 #include "gpu/command_buffer/service/gpu_switches.h" 16 #include "gpu/command_buffer/service/gpu_switches.h"
17 #include "gpu/command_buffer/service/scheduler.h"
18 #include "gpu/command_buffer/service/sync_point_manager.h" 17 #include "gpu/command_buffer/service/sync_point_manager.h"
19 #include "gpu/config/gpu_info_collector.h" 18 #include "gpu/config/gpu_info_collector.h"
20 #include "gpu/config/gpu_switches.h" 19 #include "gpu/config/gpu_switches.h"
21 #include "gpu/config/gpu_util.h" 20 #include "gpu/config/gpu_util.h"
22 #include "gpu/ipc/common/gpu_memory_buffer_support.h" 21 #include "gpu/ipc/common/gpu_memory_buffer_support.h"
23 #include "gpu/ipc/common/memory_stats.h" 22 #include "gpu/ipc/common/memory_stats.h"
24 #include "gpu/ipc/gpu_in_process_thread_service.h" 23 #include "gpu/ipc/gpu_in_process_thread_service.h"
25 #include "gpu/ipc/service/gpu_channel.h" 24 #include "gpu/ipc/service/gpu_channel.h"
26 #include "gpu/ipc/service/gpu_channel_manager.h" 25 #include "gpu/ipc/service/gpu_channel_manager.h"
27 #include "gpu/ipc/service/gpu_memory_buffer_factory.h" 26 #include "gpu/ipc/service/gpu_memory_buffer_factory.h"
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 scoped_refptr<base::SingleThreadTaskRunner> io_runner, 89 scoped_refptr<base::SingleThreadTaskRunner> io_runner,
91 const gpu::GpuFeatureInfo& gpu_feature_info) 90 const gpu::GpuFeatureInfo& gpu_feature_info)
92 : main_runner_(base::ThreadTaskRunnerHandle::Get()), 91 : main_runner_(base::ThreadTaskRunnerHandle::Get()),
93 io_runner_(std::move(io_runner)), 92 io_runner_(std::move(io_runner)),
94 watchdog_thread_(std::move(watchdog_thread)), 93 watchdog_thread_(std::move(watchdog_thread)),
95 gpu_memory_buffer_factory_( 94 gpu_memory_buffer_factory_(
96 gpu::GpuMemoryBufferFactory::CreateNativeType()), 95 gpu::GpuMemoryBufferFactory::CreateNativeType()),
97 gpu_workarounds_(base::CommandLine::ForCurrentProcess()), 96 gpu_workarounds_(base::CommandLine::ForCurrentProcess()),
98 gpu_info_(gpu_info), 97 gpu_info_(gpu_info),
99 gpu_feature_info_(gpu_feature_info), 98 gpu_feature_info_(gpu_feature_info),
99 sync_point_manager_(nullptr),
100 bindings_(base::MakeUnique<mojo::BindingSet<mojom::GpuService>>()), 100 bindings_(base::MakeUnique<mojo::BindingSet<mojom::GpuService>>()),
101 weak_ptr_factory_(this) { 101 weak_ptr_factory_(this) {
102 DCHECK(!io_runner_->BelongsToCurrentThread()); 102 DCHECK(!io_runner_->BelongsToCurrentThread());
103 weak_ptr_ = weak_ptr_factory_.GetWeakPtr(); 103 weak_ptr_ = weak_ptr_factory_.GetWeakPtr();
104 } 104 }
105 105
106 GpuService::~GpuService() { 106 GpuService::~GpuService() {
107 DCHECK(main_runner_->BelongsToCurrentThread()); 107 DCHECK(main_runner_->BelongsToCurrentThread());
108 bind_task_tracker_.TryCancelAll(); 108 bind_task_tracker_.TryCancelAll();
109 logging::SetLogMessageHandler(nullptr); 109 logging::SetLogMessageHandler(nullptr);
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 } 169 }
170 170
171 shutdown_event_ = shutdown_event; 171 shutdown_event_ = shutdown_event;
172 if (!shutdown_event_) { 172 if (!shutdown_event_) {
173 owned_shutdown_event_ = base::MakeUnique<base::WaitableEvent>( 173 owned_shutdown_event_ = base::MakeUnique<base::WaitableEvent>(
174 base::WaitableEvent::ResetPolicy::MANUAL, 174 base::WaitableEvent::ResetPolicy::MANUAL,
175 base::WaitableEvent::InitialState::NOT_SIGNALED); 175 base::WaitableEvent::InitialState::NOT_SIGNALED);
176 shutdown_event_ = owned_shutdown_event_.get(); 176 shutdown_event_ = owned_shutdown_event_.get();
177 } 177 }
178 178
179 if (gpu_preferences_.enable_gpu_scheduler) {
180 scheduler_ = base::MakeUnique<gpu::Scheduler>(
181 base::ThreadTaskRunnerHandle::Get(), sync_point_manager_);
182 }
183
184 // Defer creation of the render thread. This is to prevent it from handling 179 // Defer creation of the render thread. This is to prevent it from handling
185 // IPC messages before the sandbox has been enabled and all other necessary 180 // IPC messages before the sandbox has been enabled and all other necessary
186 // initialization has succeeded. 181 // initialization has succeeded.
187 gpu_channel_manager_.reset(new gpu::GpuChannelManager( 182 gpu_channel_manager_.reset(new gpu::GpuChannelManager(
188 gpu_preferences_, gpu_workarounds_, this, watchdog_thread_.get(), 183 gpu_preferences_, gpu_workarounds_, this, watchdog_thread_.get(),
189 base::ThreadTaskRunnerHandle::Get(), io_runner_, scheduler_.get(), 184 base::ThreadTaskRunnerHandle::Get(), io_runner_, sync_point_manager_,
190 sync_point_manager_, gpu_memory_buffer_factory_.get(), gpu_feature_info_, 185 gpu_memory_buffer_factory_.get(), gpu_feature_info_,
191 std::move(activity_flags))); 186 std::move(activity_flags)));
192 187
193 media_gpu_channel_manager_.reset( 188 media_gpu_channel_manager_.reset(
194 new media::MediaGpuChannelManager(gpu_channel_manager_.get())); 189 new media::MediaGpuChannelManager(gpu_channel_manager_.get()));
195 if (watchdog_thread()) 190 if (watchdog_thread())
196 watchdog_thread()->AddPowerObserver(); 191 watchdog_thread()->AddPowerObserver();
197 } 192 }
198 193
199 void GpuService::Bind(mojom::GpuServiceRequest request) { 194 void GpuService::Bind(mojom::GpuServiceRequest request) {
200 if (main_runner_->BelongsToCurrentThread()) { 195 if (main_runner_->BelongsToCurrentThread()) {
(...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after
505 500
506 void GpuService::Stop(const StopCallback& callback) { 501 void GpuService::Stop(const StopCallback& callback) {
507 DCHECK(io_runner_->BelongsToCurrentThread()); 502 DCHECK(io_runner_->BelongsToCurrentThread());
508 main_runner_->PostTaskAndReply(FROM_HERE, base::Bind([] { 503 main_runner_->PostTaskAndReply(FROM_HERE, base::Bind([] {
509 base::MessageLoop::current()->QuitWhenIdle(); 504 base::MessageLoop::current()->QuitWhenIdle();
510 }), 505 }),
511 callback); 506 callback);
512 } 507 }
513 508
514 } // namespace ui 509 } // namespace ui
OLDNEW
« no previous file with comments | « services/ui/gpu/gpu_service.h ('k') | services/ui/public/cpp/gpu/context_provider_command_buffer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698