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 <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <list> | 10 #include <list> |
(...skipping 547 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
558 init_start_time_ = base::TimeTicks::Now(); | 558 init_start_time_ = base::TimeTicks::Now(); |
559 | 559 |
560 TRACE_EVENT_INSTANT0("gpu", "LaunchGpuProcess", TRACE_EVENT_SCOPE_THREAD); | 560 TRACE_EVENT_INSTANT0("gpu", "LaunchGpuProcess", TRACE_EVENT_SCOPE_THREAD); |
561 | 561 |
562 std::string channel_id = process_->GetHost()->CreateChannel(); | 562 std::string channel_id = process_->GetHost()->CreateChannel(); |
563 if (channel_id.empty()) | 563 if (channel_id.empty()) |
564 return false; | 564 return false; |
565 | 565 |
566 DCHECK(!mojo_child_connection_); | 566 DCHECK(!mojo_child_connection_); |
567 mojo_child_connection_.reset(new MojoChildConnection( | 567 mojo_child_connection_.reset(new MojoChildConnection( |
568 kGpuMojoApplicationName, "", child_token_, | 568 kGpuMojoApplicationName, |
569 MojoShellContext::GetConnectorForIOThread(), | 569 "", |
570 BrowserThread::GetTaskRunnerForThread(BrowserThread::IO))); | 570 child_token_, |
| 571 MojoShellContext::GetConnectorForIOThread())); |
571 | 572 |
572 gpu::GpuPreferences gpu_preferences = GetGpuPreferencesFromCommandLine(); | 573 gpu::GpuPreferences gpu_preferences = GetGpuPreferencesFromCommandLine(); |
573 if (in_process_) { | 574 if (in_process_) { |
574 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 575 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
575 DCHECK(g_gpu_main_thread_factory); | 576 DCHECK(g_gpu_main_thread_factory); |
576 in_process_gpu_thread_.reset(g_gpu_main_thread_factory( | 577 in_process_gpu_thread_.reset(g_gpu_main_thread_factory( |
577 InProcessChildThreadParams( | 578 InProcessChildThreadParams( |
578 channel_id, base::ThreadTaskRunnerHandle::Get(), std::string(), | 579 channel_id, base::ThreadTaskRunnerHandle::Get(), std::string(), |
579 mojo_child_connection_->service_token()), | 580 mojo_child_connection_->service_token()), |
580 gpu_preferences)); | 581 gpu_preferences)); |
(...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
931 } | 932 } |
932 | 933 |
933 void GpuProcessHost::OnProcessCrashed(int exit_code) { | 934 void GpuProcessHost::OnProcessCrashed(int exit_code) { |
934 SendOutstandingReplies(); | 935 SendOutstandingReplies(); |
935 RecordProcessCrash(); | 936 RecordProcessCrash(); |
936 GpuDataManagerImpl::GetInstance()->ProcessCrashed( | 937 GpuDataManagerImpl::GetInstance()->ProcessCrashed( |
937 process_->GetTerminationStatus(true /* known_dead */, NULL)); | 938 process_->GetTerminationStatus(true /* known_dead */, NULL)); |
938 } | 939 } |
939 | 940 |
940 shell::InterfaceRegistry* GpuProcessHost::GetInterfaceRegistry() { | 941 shell::InterfaceRegistry* GpuProcessHost::GetInterfaceRegistry() { |
941 return mojo_child_connection_->GetInterfaceRegistry(); | 942 return mojo_child_connection_->connection()->GetInterfaceRegistry(); |
942 } | 943 } |
943 | 944 |
944 shell::InterfaceProvider* GpuProcessHost::GetRemoteInterfaces() { | 945 shell::InterfaceProvider* GpuProcessHost::GetRemoteInterfaces() { |
945 return mojo_child_connection_->GetRemoteInterfaces(); | 946 return mojo_child_connection_->connection()->GetRemoteInterfaces(); |
946 } | 947 } |
947 | 948 |
948 GpuProcessHost::GpuProcessKind GpuProcessHost::kind() { | 949 GpuProcessHost::GpuProcessKind GpuProcessHost::kind() { |
949 return kind_; | 950 return kind_; |
950 } | 951 } |
951 | 952 |
952 void GpuProcessHost::ForceShutdown() { | 953 void GpuProcessHost::ForceShutdown() { |
953 // This is only called on the IO thread so no race against the constructor | 954 // This is only called on the IO thread so no race against the constructor |
954 // for another GpuProcessHost. | 955 // for another GpuProcessHost. |
955 if (g_gpu_process_hosts[kind_] == this) | 956 if (g_gpu_process_hosts[kind_] == this) |
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1187 TRACE_EVENT0("gpu", "GpuProcessHost::OnCacheShader"); | 1188 TRACE_EVENT0("gpu", "GpuProcessHost::OnCacheShader"); |
1188 ClientIdToShaderCacheMap::iterator iter = | 1189 ClientIdToShaderCacheMap::iterator iter = |
1189 client_id_to_shader_cache_.find(client_id); | 1190 client_id_to_shader_cache_.find(client_id); |
1190 // If the cache doesn't exist then this is an off the record profile. | 1191 // If the cache doesn't exist then this is an off the record profile. |
1191 if (iter == client_id_to_shader_cache_.end()) | 1192 if (iter == client_id_to_shader_cache_.end()) |
1192 return; | 1193 return; |
1193 iter->second->Cache(GetShaderPrefixKey() + ":" + key, shader); | 1194 iter->second->Cache(GetShaderPrefixKey() + ":" + key, shader); |
1194 } | 1195 } |
1195 | 1196 |
1196 } // namespace content | 1197 } // namespace content |
OLD | NEW |