OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "chromecast/browser/cast_memory_pressure_monitor.h" | 5 #include "chromecast/browser/cast_memory_pressure_monitor.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/location.h" | 8 #include "base/location.h" |
9 #include "base/process/process_metrics.h" | 9 #include "base/process/process_metrics.h" |
10 #include "base/thread_task_runner_handle.h" | 10 #include "base/threading/thread_task_runner_handle.h" |
11 #include "chromecast/base/metrics/cast_metrics_helper.h" | 11 #include "chromecast/base/metrics/cast_metrics_helper.h" |
12 | 12 |
13 namespace chromecast { | 13 namespace chromecast { |
14 namespace { | 14 namespace { |
15 | 15 |
16 // Memory thresholds (as fraction of total memory) for memory pressure levels. | 16 // Memory thresholds (as fraction of total memory) for memory pressure levels. |
17 // See more detailed description of pressure heuristic in PollPressureLevel. | 17 // See more detailed description of pressure heuristic in PollPressureLevel. |
18 // TODO(halliwell): tune thresholds based on data. | 18 // TODO(halliwell): tune thresholds based on data. |
19 constexpr float kCriticalMemoryThreshold = 0.2f; | 19 constexpr float kCriticalMemoryThreshold = 0.2f; |
20 constexpr float kModerateMemoryThreshold = 0.3f; | 20 constexpr float kModerateMemoryThreshold = 0.3f; |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 | 75 |
76 if (new_level == current_level_) | 76 if (new_level == current_level_) |
77 return; | 77 return; |
78 | 78 |
79 current_level_ = new_level; | 79 current_level_ = new_level; |
80 metrics::CastMetricsHelper::GetInstance()->RecordApplicationEventWithValue( | 80 metrics::CastMetricsHelper::GetInstance()->RecordApplicationEventWithValue( |
81 "Memory.Pressure.LevelChange", new_level); | 81 "Memory.Pressure.LevelChange", new_level); |
82 } | 82 } |
83 | 83 |
84 } // namespace chromecast | 84 } // namespace chromecast |
OLD | NEW |