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 540 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
551 init_start_time_ = base::TimeTicks::Now(); | 551 init_start_time_ = base::TimeTicks::Now(); |
552 | 552 |
553 TRACE_EVENT_INSTANT0("gpu", "LaunchGpuProcess", TRACE_EVENT_SCOPE_THREAD); | 553 TRACE_EVENT_INSTANT0("gpu", "LaunchGpuProcess", TRACE_EVENT_SCOPE_THREAD); |
554 | 554 |
555 std::string channel_id = process_->GetHost()->CreateChannel(); | 555 std::string channel_id = process_->GetHost()->CreateChannel(); |
556 if (channel_id.empty()) | 556 if (channel_id.empty()) |
557 return false; | 557 return false; |
558 | 558 |
559 DCHECK(!mojo_child_connection_); | 559 DCHECK(!mojo_child_connection_); |
560 mojo_child_connection_.reset(new MojoChildConnection( | 560 mojo_child_connection_.reset(new MojoChildConnection( |
561 kGpuMojoApplicationName, | 561 kGpuMojoApplicationName, "", child_token_, |
562 "", | 562 MojoShellContext::GetConnectorForIOThread(), |
563 child_token_, | 563 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO))); |
564 MojoShellContext::GetConnectorForIOThread())); | |
565 | 564 |
566 gpu::GpuPreferences gpu_preferences = GetGpuPreferencesFromCommandLine(); | 565 gpu::GpuPreferences gpu_preferences = GetGpuPreferencesFromCommandLine(); |
567 if (in_process_) { | 566 if (in_process_) { |
568 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 567 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
569 DCHECK(g_gpu_main_thread_factory); | 568 DCHECK(g_gpu_main_thread_factory); |
570 in_process_gpu_thread_.reset(g_gpu_main_thread_factory( | 569 in_process_gpu_thread_.reset(g_gpu_main_thread_factory( |
571 InProcessChildThreadParams( | 570 InProcessChildThreadParams( |
572 channel_id, base::ThreadTaskRunnerHandle::Get(), std::string(), | 571 channel_id, base::ThreadTaskRunnerHandle::Get(), std::string(), |
573 mojo_child_connection_->shell_client_token()), | 572 mojo_child_connection_->shell_client_token()), |
574 gpu_preferences)); | 573 gpu_preferences)); |
(...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
925 } | 924 } |
926 | 925 |
927 void GpuProcessHost::OnProcessCrashed(int exit_code) { | 926 void GpuProcessHost::OnProcessCrashed(int exit_code) { |
928 SendOutstandingReplies(); | 927 SendOutstandingReplies(); |
929 RecordProcessCrash(); | 928 RecordProcessCrash(); |
930 GpuDataManagerImpl::GetInstance()->ProcessCrashed( | 929 GpuDataManagerImpl::GetInstance()->ProcessCrashed( |
931 process_->GetTerminationStatus(true /* known_dead */, NULL)); | 930 process_->GetTerminationStatus(true /* known_dead */, NULL)); |
932 } | 931 } |
933 | 932 |
934 shell::InterfaceRegistry* GpuProcessHost::GetInterfaceRegistry() { | 933 shell::InterfaceRegistry* GpuProcessHost::GetInterfaceRegistry() { |
935 return mojo_child_connection_->connection()->GetInterfaceRegistry(); | 934 return mojo_child_connection_->GetInterfaceRegistry(); |
936 } | 935 } |
937 | 936 |
938 shell::InterfaceProvider* GpuProcessHost::GetRemoteInterfaces() { | 937 shell::InterfaceProvider* GpuProcessHost::GetRemoteInterfaces() { |
939 return mojo_child_connection_->connection()->GetRemoteInterfaces(); | 938 return mojo_child_connection_->GetRemoteInterfaces(); |
940 } | 939 } |
941 | 940 |
942 GpuProcessHost::GpuProcessKind GpuProcessHost::kind() { | 941 GpuProcessHost::GpuProcessKind GpuProcessHost::kind() { |
943 return kind_; | 942 return kind_; |
944 } | 943 } |
945 | 944 |
946 void GpuProcessHost::ForceShutdown() { | 945 void GpuProcessHost::ForceShutdown() { |
947 // This is only called on the IO thread so no race against the constructor | 946 // This is only called on the IO thread so no race against the constructor |
948 // for another GpuProcessHost. | 947 // for another GpuProcessHost. |
949 if (g_gpu_process_hosts[kind_] == this) | 948 if (g_gpu_process_hosts[kind_] == this) |
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1181 TRACE_EVENT0("gpu", "GpuProcessHost::OnCacheShader"); | 1180 TRACE_EVENT0("gpu", "GpuProcessHost::OnCacheShader"); |
1182 ClientIdToShaderCacheMap::iterator iter = | 1181 ClientIdToShaderCacheMap::iterator iter = |
1183 client_id_to_shader_cache_.find(client_id); | 1182 client_id_to_shader_cache_.find(client_id); |
1184 // If the cache doesn't exist then this is an off the record profile. | 1183 // If the cache doesn't exist then this is an off the record profile. |
1185 if (iter == client_id_to_shader_cache_.end()) | 1184 if (iter == client_id_to_shader_cache_.end()) |
1186 return; | 1185 return; |
1187 iter->second->Cache(GetShaderPrefixKey() + ":" + key, shader); | 1186 iter->second->Cache(GetShaderPrefixKey() + ":" + key, shader); |
1188 } | 1187 } |
1189 | 1188 |
1190 } // namespace content | 1189 } // namespace content |
OLD | NEW |