| OLD | NEW |
| 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" |
| (...skipping 416 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 427 } | 427 } |
| 428 #if defined(OS_ANDROID) | 428 #if defined(OS_ANDROID) |
| 429 if (!gpu_channel_manager_) | 429 if (!gpu_channel_manager_) |
| 430 return; | 430 return; |
| 431 gpu_channel_manager_->WakeUpGpu(); | 431 gpu_channel_manager_->WakeUpGpu(); |
| 432 #else | 432 #else |
| 433 NOTREACHED() << "WakeUpGpu() not supported on this platform."; | 433 NOTREACHED() << "WakeUpGpu() not supported on this platform."; |
| 434 #endif | 434 #endif |
| 435 } | 435 } |
| 436 | 436 |
| 437 void GpuService::GpuSwitched() { |
| 438 DVLOG(1) << "GPU: GPU has switched"; |
| 439 if (!in_host_process_) |
| 440 ui::GpuSwitchingManager::GetInstance()->NotifyGpuSwitched(); |
| 441 } |
| 442 |
| 437 void GpuService::DestroyAllChannels() { | 443 void GpuService::DestroyAllChannels() { |
| 438 if (io_runner_->BelongsToCurrentThread()) { | 444 if (io_runner_->BelongsToCurrentThread()) { |
| 439 main_runner_->PostTask( | 445 main_runner_->PostTask( |
| 440 FROM_HERE, base::Bind(&GpuService::DestroyAllChannels, weak_ptr_)); | 446 FROM_HERE, base::Bind(&GpuService::DestroyAllChannels, weak_ptr_)); |
| 441 return; | 447 return; |
| 442 } | 448 } |
| 443 if (!gpu_channel_manager_) | 449 if (!gpu_channel_manager_) |
| 444 return; | 450 return; |
| 445 DVLOG(1) << "GPU: Removing all contexts"; | 451 DVLOG(1) << "GPU: Removing all contexts"; |
| 446 gpu_channel_manager_->DestroyAllChannels(); | 452 gpu_channel_manager_->DestroyAllChannels(); |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 479 | 485 |
| 480 void GpuService::Stop(const StopCallback& callback) { | 486 void GpuService::Stop(const StopCallback& callback) { |
| 481 DCHECK(io_runner_->BelongsToCurrentThread()); | 487 DCHECK(io_runner_->BelongsToCurrentThread()); |
| 482 main_runner_->PostTaskAndReply(FROM_HERE, base::Bind([] { | 488 main_runner_->PostTaskAndReply(FROM_HERE, base::Bind([] { |
| 483 base::MessageLoop::current()->QuitWhenIdle(); | 489 base::MessageLoop::current()->QuitWhenIdle(); |
| 484 }), | 490 }), |
| 485 callback); | 491 callback); |
| 486 } | 492 } |
| 487 | 493 |
| 488 } // namespace ui | 494 } // namespace ui |
| OLD | NEW |