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