OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/chromeos/resource_reporter/resource_reporter.h" | 5 #include "chrome/browser/chromeos/resource_reporter/resource_reporter.h" |
6 | 6 |
7 #include <cstdint> | 7 #include <cstdint> |
8 #include <queue> | 8 #include <queue> |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 } | 106 } |
107 | 107 |
108 void ResourceReporter::StartMonitoring() { | 108 void ResourceReporter::StartMonitoring() { |
109 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 109 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
110 | 110 |
111 if (is_monitoring_) | 111 if (is_monitoring_) |
112 return; | 112 return; |
113 | 113 |
114 is_monitoring_ = true; | 114 is_monitoring_ = true; |
115 task_management::TaskManagerInterface::GetTaskManager()->AddObserver(this); | 115 task_management::TaskManagerInterface::GetTaskManager()->AddObserver(this); |
116 memory_pressure_listener_.reset(new base::MemoryPressureListener( | 116 memory_pressure_listener_.reset(base::MemoryPressureListener::Create( |
117 base::Bind(&ResourceReporter::OnMemoryPressure, base::Unretained(this)))); | 117 base::Bind(&ResourceReporter::OnMemoryPressure, base::Unretained(this)))); |
118 } | 118 } |
119 | 119 |
120 void ResourceReporter::StopMonitoring() { | 120 void ResourceReporter::StopMonitoring() { |
121 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 121 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
122 | 122 |
123 if (!is_monitoring_) | 123 if (!is_monitoring_) |
124 return; | 124 return; |
125 | 125 |
126 is_monitoring_ = false; | 126 is_monitoring_ = false; |
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
423 kRapporUsageRangeFlagsField, | 423 kRapporUsageRangeFlagsField, |
424 GET_ENUM_VAL(GetMemoryUsageRange(sampled_memory_task->memory_bytes)), | 424 GET_ENUM_VAL(GetMemoryUsageRange(sampled_memory_task->memory_bytes)), |
425 GET_ENUM_VAL(MemoryUsageRange::NUM_RANGES)); | 425 GET_ENUM_VAL(MemoryUsageRange::NUM_RANGES)); |
426 rappor_service->RecordSampleObj(kMemoryRapporMetric, | 426 rappor_service->RecordSampleObj(kMemoryRapporMetric, |
427 std::move(memory_sample)); | 427 std::move(memory_sample)); |
428 } | 428 } |
429 } | 429 } |
430 } | 430 } |
431 | 431 |
432 } // namespace chromeos | 432 } // namespace chromeos |
OLD | NEW |