| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "chrome/browser/power/process_power_collector.h" | 5 #include "chrome/browser/power/process_power_collector.h" |
| 6 | 6 |
| 7 #include "base/process/process_handle.h" | 7 #include "base/process/process_handle.h" |
| 8 #include "base/process/process_metrics.h" | 8 #include "base/process/process_metrics.h" |
| 9 #include "build/build_config.h" |
| 9 #include "chrome/browser/browser_process.h" | 10 #include "chrome/browser/browser_process.h" |
| 10 #include "chrome/browser/profiles/profile.h" | 11 #include "chrome/browser/profiles/profile.h" |
| 11 #include "chrome/browser/profiles/profile_manager.h" | 12 #include "chrome/browser/profiles/profile_manager.h" |
| 12 #include "chrome/browser/ui/tab_contents/tab_contents_iterator.h" | 13 #include "chrome/browser/ui/tab_contents/tab_contents_iterator.h" |
| 13 #include "components/power/origin_power_map.h" | 14 #include "components/power/origin_power_map.h" |
| 14 #include "components/power/origin_power_map_factory.h" | 15 #include "components/power/origin_power_map_factory.h" |
| 15 #include "content/public/browser/browser_context.h" | 16 #include "content/public/browser/browser_context.h" |
| 16 #include "content/public/browser/render_process_host.h" | 17 #include "content/public/browser/render_process_host.h" |
| 17 #include "content/public/browser/web_contents.h" | 18 #include "content/public/browser/web_contents.h" |
| 18 #include "extensions/browser/app_window/app_window.h" | 19 #include "extensions/browser/app_window/app_window.h" |
| (...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 208 origin, | 209 origin, |
| 209 Profile::FromBrowserContext(rph->GetBrowserContext()))); | 210 Profile::FromBrowserContext(rph->GetBrowserContext()))); |
| 210 } | 211 } |
| 211 | 212 |
| 212 linked_ptr<PerProcessData>& process_data = metrics_map_[handle]; | 213 linked_ptr<PerProcessData>& process_data = metrics_map_[handle]; |
| 213 process_data->set_last_cpu_percent(std::max(0.0, | 214 process_data->set_last_cpu_percent(std::max(0.0, |
| 214 cpu_usage_callback_.is_null() ? process_data->metrics()->GetCPUUsage() | 215 cpu_usage_callback_.is_null() ? process_data->metrics()->GetCPUUsage() |
| 215 : cpu_usage_callback_.Run(handle))); | 216 : cpu_usage_callback_.Run(handle))); |
| 216 process_data->set_seen_this_cycle(true); | 217 process_data->set_seen_this_cycle(true); |
| 217 } | 218 } |
| OLD | NEW |