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

Side by Side Diff: base/memory/memory_pressure_monitor_win.cc

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 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 "base/memory/memory_pressure_monitor_win.h" 5 #include "base/memory/memory_pressure_monitor_win.h"
6 6
7 #include <windows.h> 7 #include <windows.h>
8 8
9 #include "base/single_thread_task_runner.h" 9 #include "base/single_thread_task_runner.h"
10 #include "base/threading/thread_task_runner_handle.h" 10 #include "base/threading/thread_task_runner_handle.h"
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 83
84 void MemoryPressureMonitor::CheckMemoryPressureSoon() { 84 void MemoryPressureMonitor::CheckMemoryPressureSoon() {
85 DCHECK(thread_checker_.CalledOnValidThread()); 85 DCHECK(thread_checker_.CalledOnValidThread());
86 86
87 ThreadTaskRunnerHandle::Get()->PostTask( 87 ThreadTaskRunnerHandle::Get()->PostTask(
88 FROM_HERE, Bind(&MemoryPressureMonitor::CheckMemoryPressure, 88 FROM_HERE, Bind(&MemoryPressureMonitor::CheckMemoryPressure,
89 weak_ptr_factory_.GetWeakPtr())); 89 weak_ptr_factory_.GetWeakPtr()));
90 } 90 }
91 91
92 MemoryPressureListener::MemoryPressureLevel 92 MemoryPressureListener::MemoryPressureLevel
93 MemoryPressureMonitor::GetCurrentPressureLevel() const { 93 MemoryPressureMonitor::GetCurrentPressureLevel() {
94 return current_memory_pressure_level_; 94 return current_memory_pressure_level_;
95 } 95 }
96 96
97 void MemoryPressureMonitor::InferThresholds() { 97 void MemoryPressureMonitor::InferThresholds() {
98 // Default to a 'high' memory situation, which uses more conservative 98 // Default to a 'high' memory situation, which uses more conservative
99 // thresholds. 99 // thresholds.
100 bool high_memory = true; 100 bool high_memory = true;
101 MEMORYSTATUSEX mem_status = {}; 101 MEMORYSTATUSEX mem_status = {};
102 if (GetSystemMemoryStatus(&mem_status)) { 102 if (GetSystemMemoryStatus(&mem_status)) {
103 static const DWORDLONG kLargeMemoryThresholdBytes = 103 static const DWORDLONG kLargeMemoryThresholdBytes =
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
224 return true; 224 return true;
225 } 225 }
226 226
227 void MemoryPressureMonitor::SetDispatchCallback( 227 void MemoryPressureMonitor::SetDispatchCallback(
228 const DispatchCallback& callback) { 228 const DispatchCallback& callback) {
229 dispatch_callback_ = callback; 229 dispatch_callback_ = callback;
230 } 230 }
231 231
232 } // namespace win 232 } // namespace win
233 } // namespace base 233 } // namespace base
OLDNEW
« no previous file with comments | « base/memory/memory_pressure_monitor_win.h ('k') | chrome/browser/chromeos/resource_reporter/resource_reporter_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698