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

Side by Side Diff: content/browser/gpu/gpu_process_host.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/browser/gpu/gpu_process_host.h ('k') | content/browser/gpu/gpu_process_host_ui_shim.h » ('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/browser/gpu/gpu_process_host.h" 5 #include "content/browser/gpu/gpu_process_host.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <list> 10 #include <list>
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 bool force_create, 189 bool force_create,
190 IPC::Message* message) { 190 IPC::Message* message) {
191 GpuProcessHost* host = GpuProcessHost::Get(kind, force_create); 191 GpuProcessHost* host = GpuProcessHost::Get(kind, force_create);
192 if (host) { 192 if (host) {
193 host->Send(message); 193 host->Send(message);
194 } else { 194 } else {
195 delete message; 195 delete message;
196 } 196 }
197 } 197 }
198 198
199 void RunCallbackOnIO(GpuProcessHost::GpuProcessKind kind,
200 bool force_create,
201 const base::Callback<void(GpuProcessHost*)>& callback) {
202 GpuProcessHost* host = GpuProcessHost::Get(kind, force_create);
203 if (host)
204 callback.Run(host);
205 }
206
199 #if defined(USE_OZONE) 207 #if defined(USE_OZONE)
200 void SendGpuProcessMessageByHostId(int host_id, IPC::Message* message) { 208 void SendGpuProcessMessageByHostId(int host_id, IPC::Message* message) {
201 GpuProcessHost* host = GpuProcessHost::FromID(host_id); 209 GpuProcessHost* host = GpuProcessHost::FromID(host_id);
202 if (host) { 210 if (host) {
203 host->Send(message); 211 host->Send(message);
204 } else { 212 } else {
205 delete message; 213 delete message;
206 } 214 }
207 } 215 }
208 #endif 216 #endif
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after
420 void GpuProcessHost::SendOnIO(GpuProcessKind kind, 428 void GpuProcessHost::SendOnIO(GpuProcessKind kind,
421 bool force_create, 429 bool force_create,
422 IPC::Message* message) { 430 IPC::Message* message) {
423 if (!BrowserThread::PostTask( 431 if (!BrowserThread::PostTask(
424 BrowserThread::IO, FROM_HERE, 432 BrowserThread::IO, FROM_HERE,
425 base::Bind(&SendGpuProcessMessage, kind, force_create, message))) { 433 base::Bind(&SendGpuProcessMessage, kind, force_create, message))) {
426 delete message; 434 delete message;
427 } 435 }
428 } 436 }
429 437
438 // static
439 void GpuProcessHost::CallOnIO(
440 GpuProcessKind kind,
441 bool force_create,
442 const base::Callback<void(GpuProcessHost*)>& callback) {
443 BrowserThread::PostTask(
444 BrowserThread::IO, FROM_HERE,
445 base::Bind(&RunCallbackOnIO, kind, force_create, callback));
446 }
447
430 service_manager::InterfaceProvider* GpuProcessHost::GetRemoteInterfaces() { 448 service_manager::InterfaceProvider* GpuProcessHost::GetRemoteInterfaces() {
431 return process_->child_connection()->GetRemoteInterfaces(); 449 return process_->child_connection()->GetRemoteInterfaces();
432 } 450 }
433 451
434 // static 452 // static
435 GpuProcessHost* GpuProcessHost::FromID(int host_id) { 453 GpuProcessHost* GpuProcessHost::FromID(int host_id) {
436 DCHECK_CURRENTLY_ON(BrowserThread::IO); 454 DCHECK_CURRENTLY_ON(BrowserThread::IO);
437 455
438 for (int i = 0; i < GPU_PROCESS_KIND_COUNT; ++i) { 456 for (int i = 0; i < GPU_PROCESS_KIND_COUNT; ++i) {
439 GpuProcessHost* host = g_gpu_process_hosts[i]; 457 GpuProcessHost* host = g_gpu_process_hosts[i];
(...skipping 752 matching lines...) Expand 10 before | Expand all | Expand 10 after
1192 GetShaderCacheFactorySingleton()->Get(client_id); 1210 GetShaderCacheFactorySingleton()->Get(client_id);
1193 if (!cache.get()) 1211 if (!cache.get())
1194 return; 1212 return;
1195 1213
1196 cache->set_shader_loaded_callback(base::Bind(&HostLoadedShader, host_id_)); 1214 cache->set_shader_loaded_callback(base::Bind(&HostLoadedShader, host_id_));
1197 1215
1198 client_id_to_shader_cache_[client_id] = cache; 1216 client_id_to_shader_cache_[client_id] = cache;
1199 } 1217 }
1200 1218
1201 } // namespace content 1219 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/gpu/gpu_process_host.h ('k') | content/browser/gpu/gpu_process_host_ui_shim.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698