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

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

Issue 2097753002: Make memory pressure notifier configurable (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix win Created 4 years, 5 months 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() const override;
25 void SetDispatchCallback(const DispatchCallback& callback) override;
25 26
26 private: 27 private:
27 void PollPressureLevel(); 28 void PollPressureLevel();
28 void UpdateMemoryPressureLevel(MemoryPressureLevel new_level); 29 void UpdateMemoryPressureLevel(MemoryPressureLevel new_level);
29 30
30 MemoryPressureLevel current_level_; 31 MemoryPressureLevel current_level_;
31 const int system_reserved_kb_; 32 const int system_reserved_kb_;
33 DispatchCallback dispatch_callback_;
32 base::WeakPtrFactory<CastMemoryPressureMonitor> weak_ptr_factory_; 34 base::WeakPtrFactory<CastMemoryPressureMonitor> weak_ptr_factory_;
33 35
34 DISALLOW_COPY_AND_ASSIGN(CastMemoryPressureMonitor); 36 DISALLOW_COPY_AND_ASSIGN(CastMemoryPressureMonitor);
35 }; 37 };
36 38
37 } // namespace chromecast 39 } // namespace chromecast
38 40
39 #endif // CHROMECAST_BROWSER_CAST_MEMORY_PRESSURE_MONITOR_H_ 41 #endif // CHROMECAST_BROWSER_CAST_MEMORY_PRESSURE_MONITOR_H_
OLDNEW
« no previous file with comments | « base/memory/memory_pressure_monitor_win.cc ('k') | chromecast/browser/cast_memory_pressure_monitor.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698