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

Side by Side Diff: content/browser/gpu/gpu_process_host.cc

Issue 2772193006: gpu: Replace GpuMsg_GpuSwitched with mojom api. (Closed)
Patch Set: Created 3 years, 8 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/common/gpu_host_messages.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 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
184 DIED_SECOND_TIME, 184 DIED_SECOND_TIME,
185 DIED_THIRD_TIME, 185 DIED_THIRD_TIME,
186 DIED_FOURTH_TIME, 186 DIED_FOURTH_TIME,
187 GPU_PROCESS_LIFETIME_EVENT_MAX = 100 187 GPU_PROCESS_LIFETIME_EVENT_MAX = 100
188 }; 188 };
189 189
190 // Indexed by GpuProcessKind. There is one of each kind maximum. This array may 190 // Indexed by GpuProcessKind. There is one of each kind maximum. This array may
191 // only be accessed from the IO thread. 191 // only be accessed from the IO thread.
192 GpuProcessHost* g_gpu_process_hosts[GpuProcessHost::GPU_PROCESS_KIND_COUNT]; 192 GpuProcessHost* g_gpu_process_hosts[GpuProcessHost::GPU_PROCESS_KIND_COUNT];
193 193
194 void SendGpuProcessMessage(GpuProcessHost::GpuProcessKind kind,
195 bool force_create,
196 IPC::Message* message) {
197 GpuProcessHost* host = GpuProcessHost::Get(kind, force_create);
198 if (host) {
199 host->Send(message);
200 } else {
201 delete message;
202 }
203 }
204
205 void RunCallbackOnIO(GpuProcessHost::GpuProcessKind kind, 194 void RunCallbackOnIO(GpuProcessHost::GpuProcessKind kind,
206 bool force_create, 195 bool force_create,
207 const base::Callback<void(GpuProcessHost*)>& callback) { 196 const base::Callback<void(GpuProcessHost*)>& callback) {
208 GpuProcessHost* host = GpuProcessHost::Get(kind, force_create); 197 GpuProcessHost* host = GpuProcessHost::Get(kind, force_create);
209 callback.Run(host); 198 callback.Run(host);
210 } 199 }
211 200
212 #if defined(USE_OZONE) 201 #if defined(USE_OZONE)
213 void SendGpuProcessMessageByHostId(int host_id, IPC::Message* message) { 202 void SendGpuProcessMessageByHostId(int host_id, IPC::Message* message) {
214 GpuProcessHost* host = GpuProcessHost::FromID(host_id); 203 GpuProcessHost* host = GpuProcessHost::FromID(host_id);
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after
436 if (host && ValidateHost(host)) 425 if (host && ValidateHost(host))
437 handles.push_back(host->process_->GetProcess().Handle()); 426 handles.push_back(host->process_->GetProcess().Handle());
438 } 427 }
439 BrowserThread::PostTask( 428 BrowserThread::PostTask(
440 BrowserThread::UI, 429 BrowserThread::UI,
441 FROM_HERE, 430 FROM_HERE,
442 base::Bind(callback, handles)); 431 base::Bind(callback, handles));
443 } 432 }
444 433
445 // static 434 // static
446 void GpuProcessHost::SendOnIO(GpuProcessKind kind,
447 bool force_create,
448 IPC::Message* message) {
449 #if !defined(OS_WIN)
450 DCHECK_NE(kind, GpuProcessHost::GPU_PROCESS_KIND_UNSANDBOXED);
451 #endif
452 if (!BrowserThread::PostTask(
453 BrowserThread::IO, FROM_HERE,
454 base::Bind(&SendGpuProcessMessage, kind, force_create, message))) {
455 delete message;
456 }
457 }
458
459 // static
460 void GpuProcessHost::CallOnIO( 435 void GpuProcessHost::CallOnIO(
461 GpuProcessKind kind, 436 GpuProcessKind kind,
462 bool force_create, 437 bool force_create,
463 const base::Callback<void(GpuProcessHost*)>& callback) { 438 const base::Callback<void(GpuProcessHost*)>& callback) {
464 #if !defined(OS_WIN) 439 #if !defined(OS_WIN)
465 DCHECK_NE(kind, GpuProcessHost::GPU_PROCESS_KIND_UNSANDBOXED); 440 DCHECK_NE(kind, GpuProcessHost::GPU_PROCESS_KIND_UNSANDBOXED);
466 #endif 441 #endif
467 BrowserThread::PostTask( 442 BrowserThread::PostTask(
468 BrowserThread::IO, FROM_HERE, 443 BrowserThread::IO, FROM_HERE,
469 base::Bind(&RunCallbackOnIO, kind, force_create, callback)); 444 base::Bind(&RunCallbackOnIO, kind, force_create, callback));
(...skipping 761 matching lines...) Expand 10 before | Expand all | Expand 10 after
1231 GetShaderCacheFactorySingleton()->Get(client_id); 1206 GetShaderCacheFactorySingleton()->Get(client_id);
1232 if (!cache.get()) 1207 if (!cache.get())
1233 return; 1208 return;
1234 1209
1235 cache->set_shader_loaded_callback(base::Bind(&HostLoadedShader, host_id_)); 1210 cache->set_shader_loaded_callback(base::Bind(&HostLoadedShader, host_id_));
1236 1211
1237 client_id_to_shader_cache_[client_id] = cache; 1212 client_id_to_shader_cache_[client_id] = cache;
1238 } 1213 }
1239 1214
1240 } // namespace content 1215 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/gpu/gpu_process_host.h ('k') | content/common/gpu_host_messages.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698