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

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

Issue 1249313004: Remove GPU relinquish resources infrastructure and stop GPU process. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Only skip recording crash in ~GpuProcessHost() Created 5 years, 4 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/gpu/gpu_process_host.h ('k') | content/browser/gpu/gpu_process_host_ui_shim.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 "base/base64.h" 7 #include "base/base64.h"
8 #include "base/base_switches.h" 8 #include "base/base_switches.h"
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after
390 } 390 }
391 391
392 GpuProcessHost::GpuProcessHost(int host_id, GpuProcessKind kind) 392 GpuProcessHost::GpuProcessHost(int host_id, GpuProcessKind kind)
393 : host_id_(host_id), 393 : host_id_(host_id),
394 valid_(true), 394 valid_(true),
395 in_process_(false), 395 in_process_(false),
396 swiftshader_rendering_(false), 396 swiftshader_rendering_(false),
397 kind_(kind), 397 kind_(kind),
398 process_launched_(false), 398 process_launched_(false),
399 initialized_(false), 399 initialized_(false),
400 expecting_shutdown_(false),
400 gpu_crash_recorded_(false), 401 gpu_crash_recorded_(false),
401 uma_memory_stats_received_(false) { 402 uma_memory_stats_received_(false) {
402 if (base::CommandLine::ForCurrentProcess()->HasSwitch( 403 if (base::CommandLine::ForCurrentProcess()->HasSwitch(
403 switches::kSingleProcess) || 404 switches::kSingleProcess) ||
404 base::CommandLine::ForCurrentProcess()->HasSwitch( 405 base::CommandLine::ForCurrentProcess()->HasSwitch(
405 switches::kInProcessGPU)) { 406 switches::kInProcessGPU)) {
406 in_process_ = true; 407 in_process_ = true;
407 } 408 }
408 409
409 // If the 'single GPU process' policy ever changes, we still want to maintain 410 // If the 'single GPU process' policy ever changes, we still want to maintain
(...skipping 13 matching lines...) Expand all
423 base::Bind(base::IgnoreResult(&GpuProcessHostUIShim::Create), host_id)); 424 base::Bind(base::IgnoreResult(&GpuProcessHostUIShim::Create), host_id));
424 425
425 process_.reset(new BrowserChildProcessHostImpl(PROCESS_TYPE_GPU, this)); 426 process_.reset(new BrowserChildProcessHostImpl(PROCESS_TYPE_GPU, this));
426 } 427 }
427 428
428 GpuProcessHost::~GpuProcessHost() { 429 GpuProcessHost::~GpuProcessHost() {
429 DCHECK(CalledOnValidThread()); 430 DCHECK(CalledOnValidThread());
430 431
431 SendOutstandingReplies(); 432 SendOutstandingReplies();
432 433
433 RecordProcessCrash(); 434 // Do not record crash if GPU process was asked to stop and stopped
435 // successfully.
436 int exit_code;
437 if (!expecting_shutdown_ ||
438 process_->GetTerminationStatus(false, &exit_code) !=
439 base::TERMINATION_STATUS_NORMAL_TERMINATION) {
440 RecordProcessCrash();
no sievers 2015/07/28 21:28:50 That's better, but calling RecordProcessCrash() he
no sievers 2015/07/28 21:31:46 I forgot one: You might also want to override OnP
derekjchow1 2015/07/29 18:35:40 Done.
441 }
434 442
435 // In case we never started, clean up. 443 // In case we never started, clean up.
436 while (!queued_messages_.empty()) { 444 while (!queued_messages_.empty()) {
437 delete queued_messages_.front(); 445 delete queued_messages_.front();
438 queued_messages_.pop(); 446 queued_messages_.pop();
439 } 447 }
440 448
441 #if defined(OS_MACOSX) && !defined(OS_IOS) 449 #if defined(OS_MACOSX) && !defined(OS_IOS)
442 if (!io_surface_manager_token_.IsZero()) { 450 if (!io_surface_manager_token_.IsZero()) {
443 BrowserIOSurfaceManager::GetInstance()->InvalidateGpuProcessToken(); 451 BrowserIOSurfaceManager::GetInstance()->InvalidateGpuProcessToken();
(...skipping 452 matching lines...) Expand 10 before | Expand all | Expand 10 after
896 #if defined(OS_MACOSX) && !defined(OS_IOS) 904 #if defined(OS_MACOSX) && !defined(OS_IOS)
897 if (!io_surface_manager_token_.IsZero()) { 905 if (!io_surface_manager_token_.IsZero()) {
898 BrowserIOSurfaceManager::GetInstance()->InvalidateGpuProcessToken(); 906 BrowserIOSurfaceManager::GetInstance()->InvalidateGpuProcessToken();
899 io_surface_manager_token_.SetZero(); 907 io_surface_manager_token_.SetZero();
900 } 908 }
901 #endif 909 #endif
902 910
903 process_->ForceShutdown(); 911 process_->ForceShutdown();
904 } 912 }
905 913
914 void GpuProcessHost::StopGpuProcess() {
915 Send(new GpuMsg_Finalize());
916 expecting_shutdown_ = true;
917 }
918
906 void GpuProcessHost::BeginFrameSubscription( 919 void GpuProcessHost::BeginFrameSubscription(
907 int surface_id, 920 int surface_id,
908 base::WeakPtr<RenderWidgetHostViewFrameSubscriber> subscriber) { 921 base::WeakPtr<RenderWidgetHostViewFrameSubscriber> subscriber) {
909 frame_subscribers_[surface_id] = subscriber; 922 frame_subscribers_[surface_id] = subscriber;
910 } 923 }
911 924
912 void GpuProcessHost::EndFrameSubscription(int surface_id) { 925 void GpuProcessHost::EndFrameSubscription(int surface_id) {
913 frame_subscribers_.erase(surface_id); 926 frame_subscribers_.erase(surface_id);
914 } 927 }
915 928
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after
1139 TRACE_EVENT0("gpu", "GpuProcessHost::OnCacheShader"); 1152 TRACE_EVENT0("gpu", "GpuProcessHost::OnCacheShader");
1140 ClientIdToShaderCacheMap::iterator iter = 1153 ClientIdToShaderCacheMap::iterator iter =
1141 client_id_to_shader_cache_.find(client_id); 1154 client_id_to_shader_cache_.find(client_id);
1142 // If the cache doesn't exist then this is an off the record profile. 1155 // If the cache doesn't exist then this is an off the record profile.
1143 if (iter == client_id_to_shader_cache_.end()) 1156 if (iter == client_id_to_shader_cache_.end())
1144 return; 1157 return;
1145 iter->second->Cache(GetShaderPrefixKey() + ":" + key, shader); 1158 iter->second->Cache(GetShaderPrefixKey() + ":" + key, shader);
1146 } 1159 }
1147 1160
1148 } // namespace content 1161 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/gpu/gpu_process_host.h ('k') | content/browser/gpu/gpu_process_host_ui_shim.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698