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

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

Issue 780133002: Add optimization for CHROMIUM_subscribe_uniform extension. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years 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 (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 "base/base64.h" 7 #include "base/base64.h"
8 #include "base/base_switches.h" 8 #include "base/base_switches.h"
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 CauseForGpuLaunch cause, 134 CauseForGpuLaunch cause,
135 IPC::Message* message) { 135 IPC::Message* message) {
136 GpuProcessHost* host = GpuProcessHost::Get(kind, cause); 136 GpuProcessHost* host = GpuProcessHost::Get(kind, cause);
137 if (host) { 137 if (host) {
138 host->Send(message); 138 host->Send(message);
139 } else { 139 } else {
140 delete message; 140 delete message;
141 } 141 }
142 } 142 }
143 143
144 void SendGpuProcessUpdateValueStateMessage(int client_id,
145 unsigned int target,
146 const gpu::ValueState& state) {
147 GpuProcessHost* host = GpuProcessHost::Get(
148 GpuProcessHost::GPU_PROCESS_KIND_SANDBOXED,
149 CAUSE_FOR_GPU_LAUNCH_NO_LAUNCH);
150 if (host)
151 host->SendUpdateValueState(client_id, target, state);
152 }
153
144 // NOTE: changes to this class need to be reviewed by the security team. 154 // NOTE: changes to this class need to be reviewed by the security team.
145 class GpuSandboxedProcessLauncherDelegate 155 class GpuSandboxedProcessLauncherDelegate
146 : public SandboxedProcessLauncherDelegate { 156 : public SandboxedProcessLauncherDelegate {
147 public: 157 public:
148 GpuSandboxedProcessLauncherDelegate(base::CommandLine* cmd_line, 158 GpuSandboxedProcessLauncherDelegate(base::CommandLine* cmd_line,
149 ChildProcessHost* host) 159 ChildProcessHost* host)
150 #if defined(OS_WIN) 160 #if defined(OS_WIN)
151 : cmd_line_(cmd_line) {} 161 : cmd_line_(cmd_line) {}
152 #elif defined(OS_POSIX) 162 #elif defined(OS_POSIX)
153 : ipc_fd_(host->TakeClientFileDescriptor()) {} 163 : ipc_fd_(host->TakeClientFileDescriptor()) {}
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
342 CauseForGpuLaunch cause, 352 CauseForGpuLaunch cause,
343 IPC::Message* message) { 353 IPC::Message* message) {
344 if (!BrowserThread::PostTask( 354 if (!BrowserThread::PostTask(
345 BrowserThread::IO, FROM_HERE, 355 BrowserThread::IO, FROM_HERE,
346 base::Bind( 356 base::Bind(
347 &SendGpuProcessMessage, kind, cause, message))) { 357 &SendGpuProcessMessage, kind, cause, message))) {
348 delete message; 358 delete message;
349 } 359 }
350 } 360 }
351 361
362 //static
363 void GpuProcessHost::SendUpdateValueStateOnIO(int client_id,
364 unsigned int target,
365 const gpu::ValueState& state) {
366 BrowserThread::PostTask(
367 BrowserThread::IO, FROM_HERE,
Tom Sepez 2014/12/04 22:08:10 nit: indentation.
orglofch 2014/12/04 23:37:10 Done.
368 base::Bind(&SendGpuProcessUpdateValueStateMessage,
369 client_id, target, state));
370 }
371
352 GpuMainThreadFactoryFunction g_gpu_main_thread_factory = NULL; 372 GpuMainThreadFactoryFunction g_gpu_main_thread_factory = NULL;
353 373
354 void GpuProcessHost::RegisterGpuMainThreadFactory( 374 void GpuProcessHost::RegisterGpuMainThreadFactory(
355 GpuMainThreadFactoryFunction create) { 375 GpuMainThreadFactoryFunction create) {
356 g_gpu_main_thread_factory = create; 376 g_gpu_main_thread_factory = create;
357 } 377 }
358 378
359 // static 379 // static
360 GpuProcessHost* GpuProcessHost::FromID(int host_id) { 380 GpuProcessHost* GpuProcessHost::FromID(int host_id) {
361 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 381 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after
575 IPC_MESSAGE_HANDLER(GpuHostMsg_GpuMemoryUmaStats, 595 IPC_MESSAGE_HANDLER(GpuHostMsg_GpuMemoryUmaStats,
576 OnGpuMemoryUmaStatsReceived) 596 OnGpuMemoryUmaStatsReceived)
577 #if defined(OS_MACOSX) 597 #if defined(OS_MACOSX)
578 IPC_MESSAGE_HANDLER_GENERIC(GpuHostMsg_AcceleratedSurfaceBuffersSwapped, 598 IPC_MESSAGE_HANDLER_GENERIC(GpuHostMsg_AcceleratedSurfaceBuffersSwapped,
579 OnAcceleratedSurfaceBuffersSwapped(message)) 599 OnAcceleratedSurfaceBuffersSwapped(message))
580 #endif 600 #endif
581 IPC_MESSAGE_HANDLER(GpuHostMsg_DestroyChannel, 601 IPC_MESSAGE_HANDLER(GpuHostMsg_DestroyChannel,
582 OnDestroyChannel) 602 OnDestroyChannel)
583 IPC_MESSAGE_HANDLER(GpuHostMsg_CacheShader, 603 IPC_MESSAGE_HANDLER(GpuHostMsg_CacheShader,
584 OnCacheShader) 604 OnCacheShader)
585 605 IPC_MESSAGE_HANDLER(GpuHostMsg_AddSubscription, OnAddSubscription)
606 IPC_MESSAGE_HANDLER(GpuHostMsg_RemoveSubscription, OnRemoveSubscription)
586 IPC_MESSAGE_UNHANDLED(RouteOnUIThread(message)) 607 IPC_MESSAGE_UNHANDLED(RouteOnUIThread(message))
587 IPC_END_MESSAGE_MAP() 608 IPC_END_MESSAGE_MAP()
588 609
589 return true; 610 return true;
590 } 611 }
591 612
592 void GpuProcessHost::OnChannelConnected(int32 peer_pid) { 613 void GpuProcessHost::OnChannelConnected(int32 peer_pid) {
593 TRACE_EVENT0("gpu", "GpuProcessHost::OnChannelConnected"); 614 TRACE_EVENT0("gpu", "GpuProcessHost::OnChannelConnected");
594 615
595 while (!queued_messages_.empty()) { 616 while (!queued_messages_.empty()) {
(...skipping 436 matching lines...) Expand 10 before | Expand all | Expand 10 after
1032 return shader_prefix_key_; 1053 return shader_prefix_key_;
1033 } 1054 }
1034 1055
1035 void GpuProcessHost::LoadedShader(const std::string& key, 1056 void GpuProcessHost::LoadedShader(const std::string& key,
1036 const std::string& data) { 1057 const std::string& data) {
1037 std::string prefix = GetShaderPrefixKey(); 1058 std::string prefix = GetShaderPrefixKey();
1038 if (!key.compare(0, prefix.length(), prefix)) 1059 if (!key.compare(0, prefix.length(), prefix))
1039 Send(new GpuMsg_LoadedShader(data)); 1060 Send(new GpuMsg_LoadedShader(data));
1040 } 1061 }
1041 1062
1063 void GpuProcessHost::SendUpdateValueState(int client_id,
1064 unsigned int target,
1065 const gpu::ValueState& state) {
1066 // Only send data if a valuebuffer is subscribed to the target
1067 if (subscription_set_.find(target) != subscription_set_.end()) {
1068 Send(new GpuMsg_UpdateValueState(client_id, target, state));
1069 }
1070 }
1071
1042 void GpuProcessHost::CreateChannelCache(int32 client_id) { 1072 void GpuProcessHost::CreateChannelCache(int32 client_id) {
1043 TRACE_EVENT0("gpu", "GpuProcessHost::CreateChannelCache"); 1073 TRACE_EVENT0("gpu", "GpuProcessHost::CreateChannelCache");
1044 1074
1045 scoped_refptr<ShaderDiskCache> cache = 1075 scoped_refptr<ShaderDiskCache> cache =
1046 ShaderCacheFactory::GetInstance()->Get(client_id); 1076 ShaderCacheFactory::GetInstance()->Get(client_id);
1047 if (!cache.get()) 1077 if (!cache.get())
1048 return; 1078 return;
1049 1079
1050 cache->set_host_id(host_id_); 1080 cache->set_host_id(host_id_);
1051 1081
(...skipping 10 matching lines...) Expand all
1062 const std::string& shader) { 1092 const std::string& shader) {
1063 TRACE_EVENT0("gpu", "GpuProcessHost::OnCacheShader"); 1093 TRACE_EVENT0("gpu", "GpuProcessHost::OnCacheShader");
1064 ClientIdToShaderCacheMap::iterator iter = 1094 ClientIdToShaderCacheMap::iterator iter =
1065 client_id_to_shader_cache_.find(client_id); 1095 client_id_to_shader_cache_.find(client_id);
1066 // If the cache doesn't exist then this is an off the record profile. 1096 // If the cache doesn't exist then this is an off the record profile.
1067 if (iter == client_id_to_shader_cache_.end()) 1097 if (iter == client_id_to_shader_cache_.end())
1068 return; 1098 return;
1069 iter->second->Cache(GetShaderPrefixKey() + ":" + key, shader); 1099 iter->second->Cache(GetShaderPrefixKey() + ":" + key, shader);
1070 } 1100 }
1071 1101
1102 void GpuProcessHost::OnAddSubscription(unsigned int target) {
1103 subscription_set_.insert(target);
1104 }
1105
1106 void GpuProcessHost::OnRemoveSubscription(unsigned int target) {
1107 subscription_set_.erase(target);
1108 }
1109
1072 } // namespace content 1110 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698