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

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

Issue 8823005: Use ForceShutdown to kill old GPU process. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: update to trunk Created 9 years 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 | Annotate | Revision Log
« no previous file with comments | « content/browser/gpu/gpu_process_host.h ('k') | no next file » | 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "base/base_switches.h" 7 #include "base/base_switches.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/debug/trace_event.h" 9 #include "base/debug/trace_event.h"
10 #include "base/lazy_instance.h" 10 #include "base/lazy_instance.h"
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 177
178 // The Gpu process is invalid if it's not using software, the card is 178 // The Gpu process is invalid if it's not using software, the card is
179 // blacklisted, and we can kill it and start over. 179 // blacklisted, and we can kill it and start over.
180 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kSingleProcess) || 180 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kSingleProcess) ||
181 CommandLine::ForCurrentProcess()->HasSwitch(switches::kInProcessGPU) || 181 CommandLine::ForCurrentProcess()->HasSwitch(switches::kInProcessGPU) ||
182 host->software_rendering() || 182 host->software_rendering() ||
183 !GpuDataManager::GetInstance()->software_rendering()) { 183 !GpuDataManager::GetInstance()->software_rendering()) {
184 return true; 184 return true;
185 } 185 }
186 186
187 host->Send(new GpuMsg_Crash()); 187 host->ForceShutdown();
188 g_hosts_by_id.Pointer()->Remove(host_id);
189 return false; 188 return false;
190 } 189 }
191 190
192 // static 191 // static
193 GpuProcessHost* GpuProcessHost::GetForRenderer( 192 GpuProcessHost* GpuProcessHost::GetForRenderer(
194 int renderer_id, content::CauseForGpuLaunch cause) { 193 int renderer_id, content::CauseForGpuLaunch cause) {
195 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 194 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
196 195
197 // Don't grant further access to GPU if it is not allowed. 196 // Don't grant further access to GPU if it is not allowed.
198 GpuDataManager* gpu_data_manager = GpuDataManager::GetInstance(); 197 GpuDataManager* gpu_data_manager = GpuDataManager::GetInstance();
(...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after
537 // The gpu process is too unstable to use. Disable it for current session. 536 // The gpu process is too unstable to use. Disable it for current session.
538 gpu_enabled_ = false; 537 gpu_enabled_ = false;
539 } 538 }
540 BrowserChildProcessHost::OnProcessCrashed(exit_code); 539 BrowserChildProcessHost::OnProcessCrashed(exit_code);
541 } 540 }
542 541
543 bool GpuProcessHost::software_rendering() { 542 bool GpuProcessHost::software_rendering() {
544 return software_rendering_; 543 return software_rendering_;
545 } 544 }
546 545
546 void GpuProcessHost::ForceShutdown() {
547 g_hosts_by_id.Pointer()->Remove(host_id_);
548 BrowserChildProcessHost::ForceShutdown();
549 }
550
547 bool GpuProcessHost::LaunchGpuProcess(const std::string& channel_id) { 551 bool GpuProcessHost::LaunchGpuProcess(const std::string& channel_id) {
548 if (!gpu_enabled_ || g_gpu_crash_count >= kGpuMaxCrashCount) { 552 if (!gpu_enabled_ || g_gpu_crash_count >= kGpuMaxCrashCount) {
549 SendOutstandingReplies(); 553 SendOutstandingReplies();
550 gpu_enabled_ = false; 554 gpu_enabled_ = false;
551 return false; 555 return false;
552 } 556 }
553 557
554 const CommandLine& browser_command_line = *CommandLine::ForCurrentProcess(); 558 const CommandLine& browser_command_line = *CommandLine::ForCurrentProcess();
555 559
556 CommandLine::StringType gpu_launcher = 560 CommandLine::StringType gpu_launcher =
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
643 scoped_ptr<EstablishChannelCallback> wrapped_callback(callback); 647 scoped_ptr<EstablishChannelCallback> wrapped_callback(callback);
644 wrapped_callback->Run(channel_handle, renderer_process_for_gpu, gpu_info); 648 wrapped_callback->Run(channel_handle, renderer_process_for_gpu, gpu_info);
645 } 649 }
646 650
647 void GpuProcessHost::CreateCommandBufferError( 651 void GpuProcessHost::CreateCommandBufferError(
648 CreateCommandBufferCallback* callback, int32 route_id) { 652 CreateCommandBufferCallback* callback, int32 route_id) {
649 scoped_ptr<GpuProcessHost::CreateCommandBufferCallback> 653 scoped_ptr<GpuProcessHost::CreateCommandBufferCallback>
650 wrapped_callback(callback); 654 wrapped_callback(callback);
651 callback->Run(route_id); 655 callback->Run(route_id);
652 } 656 }
OLDNEW
« no previous file with comments | « content/browser/gpu/gpu_process_host.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698