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

Side by Side Diff: content/gpu/gpu_child_thread.cc

Issue 2717233003: gpu: Use mojom API for getting video memory usage. (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
« no previous file with comments | « content/gpu/gpu_child_thread.h ('k') | gpu/ipc/common/BUILD.gn » ('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 (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 <stddef.h> 7 #include <stddef.h>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after
243 DCHECK(!msg->is_sync()); 243 DCHECK(!msg->is_sync());
244 244
245 return ChildThreadImpl::Send(msg); 245 return ChildThreadImpl::Send(msg);
246 } 246 }
247 247
248 bool GpuChildThread::OnControlMessageReceived(const IPC::Message& msg) { 248 bool GpuChildThread::OnControlMessageReceived(const IPC::Message& msg) {
249 bool handled = true; 249 bool handled = true;
250 IPC_BEGIN_MESSAGE_MAP(GpuChildThread, msg) 250 IPC_BEGIN_MESSAGE_MAP(GpuChildThread, msg)
251 IPC_MESSAGE_HANDLER(GpuMsg_Finalize, OnFinalize) 251 IPC_MESSAGE_HANDLER(GpuMsg_Finalize, OnFinalize)
252 IPC_MESSAGE_HANDLER(GpuMsg_CollectGraphicsInfo, OnCollectGraphicsInfo) 252 IPC_MESSAGE_HANDLER(GpuMsg_CollectGraphicsInfo, OnCollectGraphicsInfo)
253 IPC_MESSAGE_HANDLER(GpuMsg_GetVideoMemoryUsageStats,
254 OnGetVideoMemoryUsageStats)
255 IPC_MESSAGE_HANDLER(GpuMsg_Clean, OnClean) 253 IPC_MESSAGE_HANDLER(GpuMsg_Clean, OnClean)
256 IPC_MESSAGE_HANDLER(GpuMsg_Crash, OnCrash) 254 IPC_MESSAGE_HANDLER(GpuMsg_Crash, OnCrash)
257 IPC_MESSAGE_HANDLER(GpuMsg_Hang, OnHang) 255 IPC_MESSAGE_HANDLER(GpuMsg_Hang, OnHang)
258 #if defined(OS_ANDROID) 256 #if defined(OS_ANDROID)
259 IPC_MESSAGE_HANDLER(GpuMsg_JavaCrash, OnJavaCrash) 257 IPC_MESSAGE_HANDLER(GpuMsg_JavaCrash, OnJavaCrash)
260 #endif 258 #endif
261 IPC_MESSAGE_HANDLER(GpuMsg_GpuSwitched, OnGpuSwitched) 259 IPC_MESSAGE_HANDLER(GpuMsg_GpuSwitched, OnGpuSwitched)
262 IPC_MESSAGE_UNHANDLED(handled = false) 260 IPC_MESSAGE_UNHANDLED(handled = false)
263 IPC_END_MESSAGE_MAP() 261 IPC_END_MESSAGE_MAP()
264 262
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
416 Send(new GpuHostMsg_GraphicsInfoCollected(gpu_info_)); 414 Send(new GpuHostMsg_GraphicsInfoCollected(gpu_info_));
417 415
418 #if defined(OS_WIN) 416 #if defined(OS_WIN)
419 if (!in_browser_process_) { 417 if (!in_browser_process_) {
420 // The unsandboxed GPU process fulfilled its duty. Rest in peace. 418 // The unsandboxed GPU process fulfilled its duty. Rest in peace.
421 base::MessageLoop::current()->QuitWhenIdle(); 419 base::MessageLoop::current()->QuitWhenIdle();
422 } 420 }
423 #endif // OS_WIN 421 #endif // OS_WIN
424 } 422 }
425 423
426 void GpuChildThread::OnGetVideoMemoryUsageStats() {
427 gpu::VideoMemoryUsageStats video_memory_usage_stats;
428 if (gpu_channel_manager()) {
429 gpu_channel_manager()->gpu_memory_manager()->GetVideoMemoryUsageStats(
430 &video_memory_usage_stats);
431 }
432 Send(new GpuHostMsg_VideoMemoryUsageStats(video_memory_usage_stats));
433 }
434
435 void GpuChildThread::OnClean() { 424 void GpuChildThread::OnClean() {
436 DVLOG(1) << "GPU: Removing all contexts"; 425 DVLOG(1) << "GPU: Removing all contexts";
437 if (gpu_channel_manager()) 426 if (gpu_channel_manager())
438 gpu_channel_manager()->DestroyAllChannels(); 427 gpu_channel_manager()->DestroyAllChannels();
439 } 428 }
440 429
441 void GpuChildThread::OnCrash() { 430 void GpuChildThread::OnCrash() {
442 DVLOG(1) << "GPU: Simulating GPU crash"; 431 DVLOG(1) << "GPU: Simulating GPU crash";
443 // Good bye, cruel world. 432 // Good bye, cruel world.
444 volatile int* it_s_the_end_of_the_world_as_we_know_it = NULL; 433 volatile int* it_s_the_end_of_the_world_as_we_know_it = NULL;
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
498 487
499 void GpuChildThread::BindServiceFactoryRequest( 488 void GpuChildThread::BindServiceFactoryRequest(
500 service_manager::mojom::ServiceFactoryRequest request) { 489 service_manager::mojom::ServiceFactoryRequest request) {
501 DVLOG(1) << "GPU: Binding service_manager::mojom::ServiceFactoryRequest"; 490 DVLOG(1) << "GPU: Binding service_manager::mojom::ServiceFactoryRequest";
502 DCHECK(service_factory_); 491 DCHECK(service_factory_);
503 service_factory_bindings_.AddBinding(service_factory_.get(), 492 service_factory_bindings_.AddBinding(service_factory_.get(),
504 std::move(request)); 493 std::move(request));
505 } 494 }
506 495
507 } // namespace content 496 } // namespace content
OLDNEW
« no previous file with comments | « content/gpu/gpu_child_thread.h ('k') | gpu/ipc/common/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698