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

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

Issue 2723013004: gpu: Replace more chrome ipc with mojom API. (Closed)
Patch Set: Created 3 years, 9 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/memory/shared_memory.h" 9 #include "base/memory/shared_memory.h"
10 #include "base/threading/thread_task_runner_handle.h" 10 #include "base/threading/thread_task_runner_handle.h"
(...skipping 18 matching lines...) Expand all
29 #include "media/gpu/ipc/service/gpu_video_encode_accelerator.h" 29 #include "media/gpu/ipc/service/gpu_video_encode_accelerator.h"
30 #include "media/gpu/ipc/service/media_gpu_channel_manager.h" 30 #include "media/gpu/ipc/service/media_gpu_channel_manager.h"
31 #include "mojo/public/cpp/bindings/strong_binding.h" 31 #include "mojo/public/cpp/bindings/strong_binding.h"
32 #include "ui/gl/gl_implementation.h" 32 #include "ui/gl/gl_implementation.h"
33 #include "ui/gl/gl_switches.h" 33 #include "ui/gl/gl_switches.h"
34 #include "ui/gl/gpu_switching_manager.h" 34 #include "ui/gl/gpu_switching_manager.h"
35 #include "ui/gl/init/gl_factory.h" 35 #include "ui/gl/init/gl_factory.h"
36 #include "url/gurl.h" 36 #include "url/gurl.h"
37 37
38 #if defined(OS_ANDROID) 38 #if defined(OS_ANDROID)
39 #include "base/android/throw_uncaught_exception.h"
39 #include "media/gpu/avda_codec_allocator.h" 40 #include "media/gpu/avda_codec_allocator.h"
40 #endif 41 #endif
41 42
42 namespace ui { 43 namespace ui {
43 44
44 GpuService::GpuService(const gpu::GPUInfo& gpu_info, 45 GpuService::GpuService(const gpu::GPUInfo& gpu_info,
45 std::unique_ptr<gpu::GpuWatchdogThread> watchdog_thread, 46 std::unique_ptr<gpu::GpuWatchdogThread> watchdog_thread,
46 gpu::GpuMemoryBufferFactory* gpu_memory_buffer_factory, 47 gpu::GpuMemoryBufferFactory* gpu_memory_buffer_factory,
47 scoped_refptr<base::SingleThreadTaskRunner> io_runner, 48 scoped_refptr<base::SingleThreadTaskRunner> io_runner,
48 const gpu::GpuFeatureInfo& gpu_feature_info) 49 const gpu::GpuFeatureInfo& gpu_feature_info)
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
229 void GpuService::WakeUpGpu() { 230 void GpuService::WakeUpGpu() {
230 #if defined(OS_ANDROID) 231 #if defined(OS_ANDROID)
231 if (!gpu_channel_manager_) 232 if (!gpu_channel_manager_)
232 return; 233 return;
233 gpu_channel_manager_->WakeUpGpu(); 234 gpu_channel_manager_->WakeUpGpu();
234 #else 235 #else
235 NOTREACHED() << "WakeUpGpu() not supported on this platform."; 236 NOTREACHED() << "WakeUpGpu() not supported on this platform.";
236 #endif 237 #endif
237 } 238 }
238 239
240 void GpuService::DestroyAllChannels() {
241 if (!gpu_channel_manager_)
242 return;
243 DVLOG(1) << "GPU: Removing all contexts";
244 gpu_channel_manager_->DestroyAllChannels();
245 }
246
247 void GpuService::Crash() {
248 DVLOG(1) << "GPU: Simulating GPU crash";
249 // Good bye, cruel world.
250 volatile int* it_s_the_end_of_the_world_as_we_know_it = NULL;
251 *it_s_the_end_of_the_world_as_we_know_it = 0xdead;
252 }
253
254 void GpuService::Hang() {
255 DVLOG(1) << "GPU: Simulating GPU hang";
256 for (;;) {
257 // Do not sleep here. The GPU watchdog timer tracks the amount of user
258 // time this thread is using and it doesn't use much while calling Sleep.
259 }
260 }
261
262 void GpuService::ThrowJavaException() {
263 #if defined(OS_ANDROID)
264 base::android::ThrowUncaughtException();
265 #else
266 NOTREACHED() << "Java exception not supported on this platform.";
267 #endif
268 }
269
239 } // namespace ui 270 } // namespace ui
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698