OLD | NEW |
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 "chrome/browser/performance_monitor/performance_monitor.h" | 5 #include "chrome/browser/performance_monitor/performance_monitor.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
(...skipping 17 matching lines...) Expand all Loading... |
28 using content::BrowserThread; | 28 using content::BrowserThread; |
29 | 29 |
30 namespace performance_monitor { | 30 namespace performance_monitor { |
31 | 31 |
32 namespace { | 32 namespace { |
33 | 33 |
34 // The default interval at which PerformanceMonitor performs its timed | 34 // The default interval at which PerformanceMonitor performs its timed |
35 // collections. | 35 // collections. |
36 const int kGatherIntervalInSeconds = 120; | 36 const int kGatherIntervalInSeconds = 120; |
37 | 37 |
38 base::LazyInstance<PerformanceMonitor> g_monitor = LAZY_INSTANCE_INITIALIZER; | 38 base::LazyInstance<PerformanceMonitor>::DestructorAtExit g_monitor = |
| 39 LAZY_INSTANCE_INITIALIZER; |
39 | 40 |
40 void GatherMetricsForRenderProcess(content::RenderProcessHost* host, | 41 void GatherMetricsForRenderProcess(content::RenderProcessHost* host, |
41 ProcessMetricsMetadata* data) { | 42 ProcessMetricsMetadata* data) { |
42 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 43 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
43 #if BUILDFLAG(ENABLE_EXTENSIONS) | 44 #if BUILDFLAG(ENABLE_EXTENSIONS) |
44 content::BrowserContext* browser_context = host->GetBrowserContext(); | 45 content::BrowserContext* browser_context = host->GetBrowserContext(); |
45 extensions::ProcessMap* extension_process_map = | 46 extensions::ProcessMap* extension_process_map = |
46 extensions::ProcessMap::Get(browser_context); | 47 extensions::ProcessMap::Get(browser_context); |
47 | 48 |
48 std::set<std::string> extension_ids = | 49 std::set<std::string> extension_ids = |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
207 | 208 |
208 void PerformanceMonitor::RunTriggersUIThread() { | 209 void PerformanceMonitor::RunTriggersUIThread() { |
209 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 210 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
210 for (auto& metrics : metrics_map_) | 211 for (auto& metrics : metrics_map_) |
211 metrics.second->RunPerformanceTriggers(); | 212 metrics.second->RunPerformanceTriggers(); |
212 | 213 |
213 StartGatherCycle(); | 214 StartGatherCycle(); |
214 } | 215 } |
215 | 216 |
216 } // namespace performance_monitor | 217 } // namespace performance_monitor |
OLD | NEW |