OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/gpu/gpu_child_thread.h" | 5 #include "content/gpu/gpu_child_thread.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/lazy_instance.h" | 8 #include "base/lazy_instance.h" |
9 #include "base/threading/worker_pool.h" | 9 #include "base/threading/worker_pool.h" |
10 #include "build/build_config.h" | 10 #include "build/build_config.h" |
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
175 return supported_types[0]; | 175 return supported_types[0]; |
176 } | 176 } |
177 | 177 |
178 void GpuChildThread::Shutdown() { | 178 void GpuChildThread::Shutdown() { |
179 ChildThreadImpl::Shutdown(); | 179 ChildThreadImpl::Shutdown(); |
180 logging::SetLogMessageHandler(NULL); | 180 logging::SetLogMessageHandler(NULL); |
181 } | 181 } |
182 | 182 |
183 void GpuChildThread::Init(const base::Time& process_start_time) { | 183 void GpuChildThread::Init(const base::Time& process_start_time) { |
184 process_start_time_ = process_start_time; | 184 process_start_time_ = process_start_time; |
| 185 |
| 186 process_control_.reset(new GpuProcessControlImpl()); |
| 187 service_registry()->AddService(base::Bind( |
| 188 &GpuChildThread::BindProcessControlRequest, base::Unretained(this))); |
185 } | 189 } |
186 | 190 |
187 bool GpuChildThread::Send(IPC::Message* msg) { | 191 bool GpuChildThread::Send(IPC::Message* msg) { |
188 // The GPU process must never send a synchronous IPC message to the browser | 192 // The GPU process must never send a synchronous IPC message to the browser |
189 // process. This could result in deadlock. | 193 // process. This could result in deadlock. |
190 DCHECK(!msg->is_sync()); | 194 DCHECK(!msg->is_sync()); |
191 | 195 |
192 return ChildThreadImpl::Send(msg); | 196 return ChildThreadImpl::Send(msg); |
193 } | 197 } |
194 | 198 |
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
367 watchdog_thread_->Stop(); | 371 watchdog_thread_->Stop(); |
368 } | 372 } |
369 } | 373 } |
370 | 374 |
371 void GpuChildThread::OnGpuSwitched() { | 375 void GpuChildThread::OnGpuSwitched() { |
372 DVLOG(1) << "GPU: GPU has switched"; | 376 DVLOG(1) << "GPU: GPU has switched"; |
373 // Notify observers in the GPU process. | 377 // Notify observers in the GPU process. |
374 ui::GpuSwitchingManager::GetInstance()->NotifyGpuSwitched(); | 378 ui::GpuSwitchingManager::GetInstance()->NotifyGpuSwitched(); |
375 } | 379 } |
376 | 380 |
| 381 void GpuChildThread::BindProcessControlRequest( |
| 382 mojo::InterfaceRequest<ProcessControl> request) { |
| 383 DCHECK(process_control_); |
| 384 process_control_bindings_.AddBinding(process_control_.get(), request.Pass()); |
| 385 } |
| 386 |
377 } // namespace content | 387 } // namespace content |
OLD | NEW |