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

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: Use const ref 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 486 matching lines...) Expand 10 before | Expand all | Expand 10 after
896 #if defined(OS_MACOSX) && !defined(OS_IOS) 897 #if defined(OS_MACOSX) && !defined(OS_IOS)
897 if (!io_surface_manager_token_.IsZero()) { 898 if (!io_surface_manager_token_.IsZero()) {
898 BrowserIOSurfaceManager::GetInstance()->InvalidateGpuProcessToken(); 899 BrowserIOSurfaceManager::GetInstance()->InvalidateGpuProcessToken();
899 io_surface_manager_token_.SetZero(); 900 io_surface_manager_token_.SetZero();
900 } 901 }
901 #endif 902 #endif
902 903
903 process_->ForceShutdown(); 904 process_->ForceShutdown();
904 } 905 }
905 906
907 void GpuProcessHost::StopGpuProcess() {
908 Send(new GpuMsg_Finalize());
909 expecting_shutdown_ = true;
910 }
911
906 void GpuProcessHost::BeginFrameSubscription( 912 void GpuProcessHost::BeginFrameSubscription(
907 int surface_id, 913 int surface_id,
908 base::WeakPtr<RenderWidgetHostViewFrameSubscriber> subscriber) { 914 base::WeakPtr<RenderWidgetHostViewFrameSubscriber> subscriber) {
909 frame_subscribers_[surface_id] = subscriber; 915 frame_subscribers_[surface_id] = subscriber;
910 } 916 }
911 917
912 void GpuProcessHost::EndFrameSubscription(int surface_id) { 918 void GpuProcessHost::EndFrameSubscription(int surface_id) {
913 frame_subscribers_.erase(surface_id); 919 frame_subscribers_.erase(surface_id);
914 } 920 }
915 921
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
1023 GpuDataManagerImpl::GetInstance()->BlockDomainFrom3DAPIs( 1029 GpuDataManagerImpl::GetInstance()->BlockDomainFrom3DAPIs(
1024 *iter, GpuDataManagerImpl::DOMAIN_GUILT_UNKNOWN); 1030 *iter, GpuDataManagerImpl::DOMAIN_GUILT_UNKNOWN);
1025 } 1031 }
1026 } 1032 }
1027 1033
1028 void GpuProcessHost::RecordProcessCrash() { 1034 void GpuProcessHost::RecordProcessCrash() {
1029 // Skip if a GPU process crash was already counted. 1035 // Skip if a GPU process crash was already counted.
1030 if (gpu_crash_recorded_) 1036 if (gpu_crash_recorded_)
1031 return; 1037 return;
1032 1038
1039 // Skip if GPU process was asked to stop and stopped successfully.
1040 if (expecting_shutdown_) {
1041 expecting_shutdown_ = false;
1042 int exit_code;
1043 base::TerminationStatus status =
1044 process_->GetTerminationStatus(false, &exit_code);
1045 if (status == base::TERMINATION_STATUS_NORMAL_TERMINATION) {
dcheng 2015/07/28 18:47:21 Why does this set gpu_crash_recorded_ to true if i
derekjchow1 2015/07/28 18:57:28 RecordProcessCrash can be called multiple times fo
dcheng 2015/07/28 19:04:27 Huh. That's kind of non-intuitive (both the fact t
no sievers 2015/07/28 19:21:20 Actually it's not quite obvious how you get here.
derekjchow1 2015/07/28 21:01:44 Sure. The only other place RecordProcessCrash is c
1046 gpu_crash_recorded_ = true;
1047 return;
1048 }
1049 }
1050
1033 // Maximum number of times the GPU process is allowed to crash in a session. 1051 // Maximum number of times the GPU process is allowed to crash in a session.
1034 // Once this limit is reached, any request to launch the GPU process will 1052 // Once this limit is reached, any request to launch the GPU process will
1035 // fail. 1053 // fail.
1036 const int kGpuMaxCrashCount = 3; 1054 const int kGpuMaxCrashCount = 3;
1037 1055
1038 // Last time the GPU process crashed. 1056 // Last time the GPU process crashed.
1039 static base::Time last_gpu_crash_time; 1057 static base::Time last_gpu_crash_time;
1040 1058
1041 bool disable_crash_limit = base::CommandLine::ForCurrentProcess()->HasSwitch( 1059 bool disable_crash_limit = base::CommandLine::ForCurrentProcess()->HasSwitch(
1042 switches::kDisableGpuProcessCrashLimit); 1060 switches::kDisableGpuProcessCrashLimit);
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
1139 TRACE_EVENT0("gpu", "GpuProcessHost::OnCacheShader"); 1157 TRACE_EVENT0("gpu", "GpuProcessHost::OnCacheShader");
1140 ClientIdToShaderCacheMap::iterator iter = 1158 ClientIdToShaderCacheMap::iterator iter =
1141 client_id_to_shader_cache_.find(client_id); 1159 client_id_to_shader_cache_.find(client_id);
1142 // If the cache doesn't exist then this is an off the record profile. 1160 // If the cache doesn't exist then this is an off the record profile.
1143 if (iter == client_id_to_shader_cache_.end()) 1161 if (iter == client_id_to_shader_cache_.end())
1144 return; 1162 return;
1145 iter->second->Cache(GetShaderPrefixKey() + ":" + key, shader); 1163 iter->second->Cache(GetShaderPrefixKey() + ":" + key, shader);
1146 } 1164 }
1147 1165
1148 } // namespace content 1166 } // 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