| 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 486 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 497 init_start_time_ = base::TimeTicks::Now(); | 497 init_start_time_ = base::TimeTicks::Now(); |
| 498 | 498 |
| 499 TRACE_EVENT_INSTANT0("gpu", "LaunchGpuProcess", TRACE_EVENT_SCOPE_THREAD); | 499 TRACE_EVENT_INSTANT0("gpu", "LaunchGpuProcess", TRACE_EVENT_SCOPE_THREAD); |
| 500 | 500 |
| 501 std::string channel_id = process_->GetHost()->CreateChannel(); | 501 std::string channel_id = process_->GetHost()->CreateChannel(); |
| 502 if (channel_id.empty()) | 502 if (channel_id.empty()) |
| 503 return false; | 503 return false; |
| 504 | 504 |
| 505 if (in_process_) { | 505 if (in_process_) { |
| 506 DCHECK(g_gpu_main_thread_factory); | 506 DCHECK(g_gpu_main_thread_factory); |
| 507 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); | |
| 508 command_line->AppendSwitch(switches::kDisableGpuWatchdog); | |
| 509 | |
| 510 GpuDataManagerImpl* gpu_data_manager = GpuDataManagerImpl::GetInstance(); | |
| 511 DCHECK(gpu_data_manager); | |
| 512 gpu_data_manager->AppendGpuCommandLine(command_line); | |
| 513 | |
| 514 in_process_gpu_thread_.reset(g_gpu_main_thread_factory(channel_id)); | 507 in_process_gpu_thread_.reset(g_gpu_main_thread_factory(channel_id)); |
| 515 base::Thread::Options options; | 508 base::Thread::Options options; |
| 516 #if defined(OS_WIN) | 509 #if defined(OS_WIN) |
| 517 // WGL needs to create its own window and pump messages on it. | 510 // WGL needs to create its own window and pump messages on it. |
| 518 options.message_loop_type = base::MessageLoop::TYPE_UI; | 511 options.message_loop_type = base::MessageLoop::TYPE_UI; |
| 519 #endif | 512 #endif |
| 520 in_process_gpu_thread_->StartWithOptions(options); | 513 in_process_gpu_thread_->StartWithOptions(options); |
| 521 | 514 |
| 522 OnProcessLaunched(); // Fake a callback that the process is ready. | 515 OnProcessLaunched(); // Fake a callback that the process is ready. |
| 523 } else if (!LaunchGpuProcess(channel_id)) { | 516 } else if (!LaunchGpuProcess(channel_id)) { |
| (...skipping 561 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1085 TRACE_EVENT0("gpu", "GpuProcessHost::OnCacheShader"); | 1078 TRACE_EVENT0("gpu", "GpuProcessHost::OnCacheShader"); |
| 1086 ClientIdToShaderCacheMap::iterator iter = | 1079 ClientIdToShaderCacheMap::iterator iter = |
| 1087 client_id_to_shader_cache_.find(client_id); | 1080 client_id_to_shader_cache_.find(client_id); |
| 1088 // If the cache doesn't exist then this is an off the record profile. | 1081 // If the cache doesn't exist then this is an off the record profile. |
| 1089 if (iter == client_id_to_shader_cache_.end()) | 1082 if (iter == client_id_to_shader_cache_.end()) |
| 1090 return; | 1083 return; |
| 1091 iter->second->Cache(GetShaderPrefixKey() + ":" + key, shader); | 1084 iter->second->Cache(GetShaderPrefixKey() + ":" + key, shader); |
| 1092 } | 1085 } |
| 1093 | 1086 |
| 1094 } // namespace content | 1087 } // namespace content |
| OLD | NEW |