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

Side by Side Diff: chromecast/browser/cast_memory_pressure_monitor.h

Issue 2495003004: [Mac] Report statistics more regularly in Mac memory pressure monitor (Closed)
Patch Set: Report in 5 second ticks Created 4 years, 1 month 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 unified diff | Download patch
OLDNEW
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 #ifndef CHROMECAST_BROWSER_CAST_MEMORY_PRESSURE_MONITOR_H_ 5 #ifndef CHROMECAST_BROWSER_CAST_MEMORY_PRESSURE_MONITOR_H_
6 #define CHROMECAST_BROWSER_CAST_MEMORY_PRESSURE_MONITOR_H_ 6 #define CHROMECAST_BROWSER_CAST_MEMORY_PRESSURE_MONITOR_H_
7 7
8 #include "base/macros.h" 8 #include "base/macros.h"
9 #include "base/memory/memory_pressure_monitor.h" 9 #include "base/memory/memory_pressure_monitor.h"
10 #include "base/memory/weak_ptr.h" 10 #include "base/memory/weak_ptr.h"
11 11
12 namespace chromecast { 12 namespace chromecast {
13 13
14 // Memory pressure monitor for Cast: polls for current memory 14 // Memory pressure monitor for Cast: polls for current memory
15 // usage periodically and sends memory pressure notifications. 15 // usage periodically and sends memory pressure notifications.
16 // TODO(halliwell): switch to //components/memory_pressure when that's 16 // TODO(halliwell): switch to //components/memory_pressure when that's
17 // ready. 17 // ready.
18 class CastMemoryPressureMonitor : public base::MemoryPressureMonitor { 18 class CastMemoryPressureMonitor : public base::MemoryPressureMonitor {
19 public: 19 public:
20 CastMemoryPressureMonitor(); 20 CastMemoryPressureMonitor();
21 ~CastMemoryPressureMonitor() override; 21 ~CastMemoryPressureMonitor() override;
22 22
23 // base::MemoryPressureMonitor implementation: 23 // base::MemoryPressureMonitor implementation:
24 MemoryPressureLevel GetCurrentPressureLevel() const override; 24 MemoryPressureLevel GetCurrentPressureLevel() override;
25 void SetDispatchCallback(const DispatchCallback& callback) override; 25 void SetDispatchCallback(const DispatchCallback& callback) override;
26 26
27 private: 27 private:
28 void PollPressureLevel(); 28 void PollPressureLevel();
29 void UpdateMemoryPressureLevel(MemoryPressureLevel new_level); 29 void UpdateMemoryPressureLevel(MemoryPressureLevel new_level);
30 30
31 MemoryPressureLevel current_level_; 31 MemoryPressureLevel current_level_;
32 const int system_reserved_kb_; 32 const int system_reserved_kb_;
33 DispatchCallback dispatch_callback_; 33 DispatchCallback dispatch_callback_;
34 base::WeakPtrFactory<CastMemoryPressureMonitor> weak_ptr_factory_; 34 base::WeakPtrFactory<CastMemoryPressureMonitor> weak_ptr_factory_;
35 35
36 DISALLOW_COPY_AND_ASSIGN(CastMemoryPressureMonitor); 36 DISALLOW_COPY_AND_ASSIGN(CastMemoryPressureMonitor);
37 }; 37 };
38 38
39 } // namespace chromecast 39 } // namespace chromecast
40 40
41 #endif // CHROMECAST_BROWSER_CAST_MEMORY_PRESSURE_MONITOR_H_ 41 #endif // CHROMECAST_BROWSER_CAST_MEMORY_PRESSURE_MONITOR_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698