OLD | NEW |
---|---|
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 508 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
519 in_process_gpu_thread_->Start(); | 519 in_process_gpu_thread_->Start(); |
520 | 520 |
521 OnProcessLaunched(); // Fake a callback that the process is ready. | 521 OnProcessLaunched(); // Fake a callback that the process is ready. |
522 } else if (!LaunchGpuProcess(channel_id)) { | 522 } else if (!LaunchGpuProcess(channel_id)) { |
523 return false; | 523 return false; |
524 } | 524 } |
525 | 525 |
526 if (!Send(new GpuMsg_Initialize())) | 526 if (!Send(new GpuMsg_Initialize())) |
527 return false; | 527 return false; |
528 | 528 |
529 #if defined(USE_OZONE) | |
530 int32 host_route_id = GenerateRouteID(); | |
alexst (slow to review)
2014/06/16 21:34:23
This is a public function that seems to only be us
rjkroege
2014/06/16 21:38:49
you are presuming that we never call this code mor
piman
2014/06/16 23:53:14
What is the purpose of the host route id?
1- Gener
spang
2014/06/17 14:47:34
Right. I thought of making it a constant, and we c
| |
531 if (!Send(new GpuMsg_InitializePlatformSupport(host_route_id))) | |
piman
2014/06/16 23:53:14
Can you combine this with the GpuMsg_Initialize me
spang
2014/06/17 14:47:34
Will merge them.
| |
532 return false; | |
533 #endif | |
534 | |
529 return true; | 535 return true; |
530 } | 536 } |
531 | 537 |
532 void GpuProcessHost::RouteOnUIThread(const IPC::Message& message) { | 538 void GpuProcessHost::RouteOnUIThread(const IPC::Message& message) { |
533 BrowserThread::PostTask( | 539 BrowserThread::PostTask( |
534 BrowserThread::UI, | 540 BrowserThread::UI, |
535 FROM_HERE, | 541 FROM_HERE, |
536 base::Bind(&RouteToGpuProcessHostUIShimTask, host_id_, message)); | 542 base::Bind(&RouteToGpuProcessHostUIShimTask, host_id_, message)); |
537 } | 543 } |
538 | 544 |
(...skipping 543 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1082 return shader_prefix_key_; | 1088 return shader_prefix_key_; |
1083 } | 1089 } |
1084 | 1090 |
1085 void GpuProcessHost::LoadedShader(const std::string& key, | 1091 void GpuProcessHost::LoadedShader(const std::string& key, |
1086 const std::string& data) { | 1092 const std::string& data) { |
1087 std::string prefix = GetShaderPrefixKey(); | 1093 std::string prefix = GetShaderPrefixKey(); |
1088 if (!key.compare(0, prefix.length(), prefix)) | 1094 if (!key.compare(0, prefix.length(), prefix)) |
1089 Send(new GpuMsg_LoadedShader(data)); | 1095 Send(new GpuMsg_LoadedShader(data)); |
1090 } | 1096 } |
1091 | 1097 |
1098 int32 GpuProcessHost::GenerateRouteID() { | |
1099 return next_route_id_.GetNext(); | |
1100 } | |
1101 | |
1092 void GpuProcessHost::CreateChannelCache(int32 client_id) { | 1102 void GpuProcessHost::CreateChannelCache(int32 client_id) { |
1093 TRACE_EVENT0("gpu", "GpuProcessHost::CreateChannelCache"); | 1103 TRACE_EVENT0("gpu", "GpuProcessHost::CreateChannelCache"); |
1094 | 1104 |
1095 scoped_refptr<ShaderDiskCache> cache = | 1105 scoped_refptr<ShaderDiskCache> cache = |
1096 ShaderCacheFactory::GetInstance()->Get(client_id); | 1106 ShaderCacheFactory::GetInstance()->Get(client_id); |
1097 if (!cache.get()) | 1107 if (!cache.get()) |
1098 return; | 1108 return; |
1099 | 1109 |
1100 cache->set_host_id(host_id_); | 1110 cache->set_host_id(host_id_); |
1101 | 1111 |
(...skipping 11 matching lines...) Expand all Loading... | |
1113 TRACE_EVENT0("gpu", "GpuProcessHost::OnCacheShader"); | 1123 TRACE_EVENT0("gpu", "GpuProcessHost::OnCacheShader"); |
1114 ClientIdToShaderCacheMap::iterator iter = | 1124 ClientIdToShaderCacheMap::iterator iter = |
1115 client_id_to_shader_cache_.find(client_id); | 1125 client_id_to_shader_cache_.find(client_id); |
1116 // If the cache doesn't exist then this is an off the record profile. | 1126 // If the cache doesn't exist then this is an off the record profile. |
1117 if (iter == client_id_to_shader_cache_.end()) | 1127 if (iter == client_id_to_shader_cache_.end()) |
1118 return; | 1128 return; |
1119 iter->second->Cache(GetShaderPrefixKey() + ":" + key, shader); | 1129 iter->second->Cache(GetShaderPrefixKey() + ":" + key, shader); |
1120 } | 1130 } |
1121 | 1131 |
1122 } // namespace content | 1132 } // namespace content |
OLD | NEW |