Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(145)

Side by Side Diff: content/browser/gpu/gpu_process_host.cc

Issue 2111353002: Move content's shell connections to the IO thread (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « content/browser/browser_main_loop.cc ('k') | content/browser/mojo/mojo_child_connection.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 548 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 const std::string mojo_channel_token = 562 const std::string mojo_channel_token =
563 process_->GetHost()->CreateChannelMojo(child_token_); 563 process_->GetHost()->CreateChannelMojo(child_token_);
564 if (mojo_channel_token.empty()) 564 if (mojo_channel_token.empty())
565 return false; 565 return false;
566 566
567 DCHECK(!mojo_child_connection_); 567 DCHECK(!mojo_child_connection_);
568 mojo_child_connection_.reset(new MojoChildConnection( 568 mojo_child_connection_.reset(new MojoChildConnection(
569 kGpuMojoApplicationName, 569 kGpuMojoApplicationName, "", child_token_,
570 "", 570 MojoShellContext::GetConnectorForIOThread(),
571 child_token_, 571 BrowserThread::GetTaskRunnerForThread(BrowserThread::IO)));
572 MojoShellContext::GetConnectorForIOThread()));
573 572
574 gpu::GpuPreferences gpu_preferences = GetGpuPreferencesFromCommandLine(); 573 gpu::GpuPreferences gpu_preferences = GetGpuPreferencesFromCommandLine();
575 if (in_process_) { 574 if (in_process_) {
576 DCHECK_CURRENTLY_ON(BrowserThread::IO); 575 DCHECK_CURRENTLY_ON(BrowserThread::IO);
577 DCHECK(g_gpu_main_thread_factory); 576 DCHECK(g_gpu_main_thread_factory);
578 in_process_gpu_thread_.reset(g_gpu_main_thread_factory( 577 in_process_gpu_thread_.reset(g_gpu_main_thread_factory(
579 InProcessChildThreadParams( 578 InProcessChildThreadParams(
580 std::string(), base::ThreadTaskRunnerHandle::Get(), 579 std::string(), base::ThreadTaskRunnerHandle::Get(),
581 mojo_channel_token, mojo_child_connection_->service_token()), 580 mojo_channel_token, mojo_child_connection_->service_token()),
582 gpu_preferences)); 581 gpu_preferences));
(...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after
933 } 932 }
934 933
935 void GpuProcessHost::OnProcessCrashed(int exit_code) { 934 void GpuProcessHost::OnProcessCrashed(int exit_code) {
936 SendOutstandingReplies(); 935 SendOutstandingReplies();
937 RecordProcessCrash(); 936 RecordProcessCrash();
938 GpuDataManagerImpl::GetInstance()->ProcessCrashed( 937 GpuDataManagerImpl::GetInstance()->ProcessCrashed(
939 process_->GetTerminationStatus(true /* known_dead */, NULL)); 938 process_->GetTerminationStatus(true /* known_dead */, NULL));
940 } 939 }
941 940
942 shell::InterfaceRegistry* GpuProcessHost::GetInterfaceRegistry() { 941 shell::InterfaceRegistry* GpuProcessHost::GetInterfaceRegistry() {
943 return mojo_child_connection_->connection()->GetInterfaceRegistry(); 942 return mojo_child_connection_->GetInterfaceRegistry();
944 } 943 }
945 944
946 shell::InterfaceProvider* GpuProcessHost::GetRemoteInterfaces() { 945 shell::InterfaceProvider* GpuProcessHost::GetRemoteInterfaces() {
947 return mojo_child_connection_->connection()->GetRemoteInterfaces(); 946 return mojo_child_connection_->GetRemoteInterfaces();
948 } 947 }
949 948
950 GpuProcessHost::GpuProcessKind GpuProcessHost::kind() { 949 GpuProcessHost::GpuProcessKind GpuProcessHost::kind() {
951 return kind_; 950 return kind_;
952 } 951 }
953 952
954 void GpuProcessHost::ForceShutdown() { 953 void GpuProcessHost::ForceShutdown() {
955 // 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
956 // for another GpuProcessHost. 955 // for another GpuProcessHost.
957 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
1189 TRACE_EVENT0("gpu", "GpuProcessHost::OnCacheShader"); 1188 TRACE_EVENT0("gpu", "GpuProcessHost::OnCacheShader");
1190 ClientIdToShaderCacheMap::iterator iter = 1189 ClientIdToShaderCacheMap::iterator iter =
1191 client_id_to_shader_cache_.find(client_id); 1190 client_id_to_shader_cache_.find(client_id);
1192 // 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.
1193 if (iter == client_id_to_shader_cache_.end()) 1192 if (iter == client_id_to_shader_cache_.end())
1194 return; 1193 return;
1195 iter->second->Cache(GetShaderPrefixKey() + ":" + key, shader); 1194 iter->second->Cache(GetShaderPrefixKey() + ":" + key, shader);
1196 } 1195 }
1197 1196
1198 } // namespace content 1197 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/browser_main_loop.cc ('k') | content/browser/mojo/mojo_child_connection.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698