| 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 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 media::GpuVideoEncodeAccelerator::GetSupportedProfiles(gpu_preferences_); | 102 media::GpuVideoEncodeAccelerator::GetSupportedProfiles(gpu_preferences_); |
| 103 gpu_info_.jpeg_decode_accelerator_supported = | 103 gpu_info_.jpeg_decode_accelerator_supported = |
| 104 media::GpuJpegDecodeAcceleratorFactoryProvider:: | 104 media::GpuJpegDecodeAcceleratorFactoryProvider:: |
| 105 IsAcceleratedJpegDecodeSupported(); | 105 IsAcceleratedJpegDecodeSupported(); |
| 106 // Record initialization only after collecting the GPU info because that can | 106 // Record initialization only after collecting the GPU info because that can |
| 107 // take a significant amount of time. | 107 // take a significant amount of time. |
| 108 gpu_info_.initialization_time = base::Time::Now() - start_time_; | 108 gpu_info_.initialization_time = base::Time::Now() - start_time_; |
| 109 } | 109 } |
| 110 | 110 |
| 111 void GpuService::InitializeWithHost(mojom::GpuHostPtr gpu_host, | 111 void GpuService::InitializeWithHost(mojom::GpuHostPtr gpu_host, |
| 112 const gpu::GpuPreferences& preferences, | |
| 113 gpu::GpuProcessActivityFlags activity_flags, | 112 gpu::GpuProcessActivityFlags activity_flags, |
| 114 gpu::SyncPointManager* sync_point_manager, | 113 gpu::SyncPointManager* sync_point_manager, |
| 115 base::WaitableEvent* shutdown_event) { | 114 base::WaitableEvent* shutdown_event) { |
| 116 gpu_host->DidInitialize(gpu_info_); | 115 gpu_host->DidInitialize(gpu_info_, gpu_feature_info_); |
| 117 gpu_host_ = | 116 gpu_host_ = |
| 118 mojom::ThreadSafeGpuHostPtr::Create(gpu_host.PassInterface(), io_runner_); | 117 mojom::ThreadSafeGpuHostPtr::Create(gpu_host.PassInterface(), io_runner_); |
| 119 if (!in_host_process_) { | 118 if (!in_host_process_) { |
| 120 // The global callback is reset from the dtor. So Unretained() here is safe. | 119 // The global callback is reset from the dtor. So Unretained() here is safe. |
| 121 // Note that the callback can be called from any thread. Consequently, the | 120 // Note that the callback can be called from any thread. Consequently, the |
| 122 // callback cannot use a WeakPtr. | 121 // callback cannot use a WeakPtr. |
| 123 g_log_callback.Get() = | 122 g_log_callback.Get() = |
| 124 base::Bind(&GpuService::RecordLogMessage, base::Unretained(this)); | 123 base::Bind(&GpuService::RecordLogMessage, base::Unretained(this)); |
| 125 logging::SetLogMessageHandler(GpuLogMessageHandler); | 124 logging::SetLogMessageHandler(GpuLogMessageHandler); |
| 126 } | 125 } |
| (...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 370 NOTREACHED() << "Java exception not supported on this platform."; | 369 NOTREACHED() << "Java exception not supported on this platform."; |
| 371 #endif | 370 #endif |
| 372 } | 371 } |
| 373 | 372 |
| 374 void GpuService::Stop(const StopCallback& callback) { | 373 void GpuService::Stop(const StopCallback& callback) { |
| 375 base::MessageLoop::current()->QuitWhenIdle(); | 374 base::MessageLoop::current()->QuitWhenIdle(); |
| 376 callback.Run(); | 375 callback.Run(); |
| 377 } | 376 } |
| 378 | 377 |
| 379 } // namespace ui | 378 } // namespace ui |
| OLD | NEW |