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

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

Issue 2723013004: gpu: Replace more chrome ipc with mojom API. (Closed)
Patch Set: tot merge 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
« no previous file with comments | « services/ui/gpu/gpu_service.h ('k') | services/ui/gpu/interfaces/gpu_service.mojom » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
227 void GpuService::WakeUpGpu() { 228 void GpuService::WakeUpGpu() {
228 #if defined(OS_ANDROID) 229 #if defined(OS_ANDROID)
229 if (!gpu_channel_manager_) 230 if (!gpu_channel_manager_)
230 return; 231 return;
231 gpu_channel_manager_->WakeUpGpu(); 232 gpu_channel_manager_->WakeUpGpu();
232 #else 233 #else
233 NOTREACHED() << "WakeUpGpu() not supported on this platform."; 234 NOTREACHED() << "WakeUpGpu() not supported on this platform.";
234 #endif 235 #endif
235 } 236 }
236 237
238 void GpuService::DestroyAllChannels() {
239 if (!gpu_channel_manager_)
240 return;
241 DVLOG(1) << "GPU: Removing all contexts";
242 gpu_channel_manager_->DestroyAllChannels();
243 }
244
245 void GpuService::Crash() {
246 DVLOG(1) << "GPU: Simulating GPU crash";
247 // Good bye, cruel world.
248 volatile int* it_s_the_end_of_the_world_as_we_know_it = NULL;
249 *it_s_the_end_of_the_world_as_we_know_it = 0xdead;
250 }
251
252 void GpuService::Hang() {
253 DVLOG(1) << "GPU: Simulating GPU hang";
254 for (;;) {
255 // Do not sleep here. The GPU watchdog timer tracks the amount of user
256 // time this thread is using and it doesn't use much while calling Sleep.
257 }
258 }
259
260 void GpuService::ThrowJavaException() {
261 #if defined(OS_ANDROID)
262 base::android::ThrowUncaughtException();
263 #else
264 NOTREACHED() << "Java exception not supported on this platform.";
265 #endif
266 }
267
237 } // namespace ui 268 } // namespace ui
OLDNEW
« no previous file with comments | « services/ui/gpu/gpu_service.h ('k') | services/ui/gpu/interfaces/gpu_service.mojom » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698