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

Unified Diff: chrome/browser/power/process_power_collector.cc

Issue 582983002: Fix a bug where Guest Profiles in CrOS could cause crashes when collecting (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: No colon. Created 6 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/browser/ui/webui/options/website_settings_handler.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/power/process_power_collector.cc
diff --git a/chrome/browser/power/process_power_collector.cc b/chrome/browser/power/process_power_collector.cc
index 5d44e6112f3a1e8870446ed23964218a238fbe48..3583b5754c6b7b16decd96617033085412960c46 100644
--- a/chrome/browser/power/process_power_collector.cc
+++ b/chrome/browser/power/process_power_collector.cc
@@ -171,7 +171,10 @@ void ProcessPowerCollector::RecordCpuUsageByOrigin(double total_cpu_percent) {
power::OriginPowerMap* origin_power_map =
power::OriginPowerMapFactory::GetForBrowserContext(
it->second->profile());
- DCHECK(origin_power_map);
+ // |origin_power_map| can be NULL, if the profile is a guest profile in
+ // Chrome OS.
+ if (!origin_power_map)
+ continue;
origin_power_map->AddPowerForOrigin(origin, last_process_power_usage);
}
@@ -183,6 +186,8 @@ void ProcessPowerCollector::RecordCpuUsageByOrigin(double total_cpu_percent) {
++it) {
power::OriginPowerMap* origin_power_map =
power::OriginPowerMapFactory::GetForBrowserContext(*it);
+ if (!origin_power_map)
+ continue;
origin_power_map->OnAllOriginsUpdated();
}
}
« no previous file with comments | « no previous file | chrome/browser/ui/webui/options/website_settings_handler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698