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