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

Unified Diff: base/memory/memory_pressure_listener.h

Issue 1749073002: Do V8 GC ASAP if system memory is pressured (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 8 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 side-by-side diff with in-line comments
Download patch
Index: base/memory/memory_pressure_listener.h
diff --git a/base/memory/memory_pressure_listener.h b/base/memory/memory_pressure_listener.h
index a6ce702ccb0f68df89a80b53934a884f4463926f..7e97010085dc8dcaea7f0fb68993b968fc5484c5 100644
--- a/base/memory/memory_pressure_listener.h
+++ b/base/memory/memory_pressure_listener.h
@@ -51,22 +51,27 @@ class BASE_EXPORT MemoryPressureListener {
// No problems, there is enough memory to use. This event is not sent via
// callback, but the enum is used in other places to find out the current
// state of the system.
- MEMORY_PRESSURE_LEVEL_NONE = -1,
+ MEMORY_PRESSURE_LEVEL_NONE,
// Modules are advised to free buffers that are cheap to re-allocate and not
// immediately needed.
- MEMORY_PRESSURE_LEVEL_MODERATE = 0,
+ MEMORY_PRESSURE_LEVEL_MODERATE,
// At this level, modules are advised to free all possible memory. The
// alternative is to be killed by the system, which means all memory will
// have to be re-created, plus the cost of a cold start.
- MEMORY_PRESSURE_LEVEL_CRITICAL = 2,
+ MEMORY_PRESSURE_LEVEL_CRITICAL,
};
- typedef base::Callback<void(MemoryPressureLevel)> MemoryPressureCallback;
+ typedef Callback<void(MemoryPressureLevel)> MemoryPressureCallback;
+ typedef Callback<void(MemoryPressureLevel)> SyncMemoryPressureCallback;
explicit MemoryPressureListener(
const MemoryPressureCallback& memory_pressure_callback);
+ MemoryPressureListener(
+ const MemoryPressureCallback& memory_pressure_callback,
+ const SyncMemoryPressureCallback& sync_memory_pressure_callback);
+
~MemoryPressureListener();
// Intended for use by the platform specific implementation.
@@ -80,12 +85,14 @@ class BASE_EXPORT MemoryPressureListener {
static void SimulatePressureNotification(
MemoryPressureLevel memory_pressure_level);
- private:
void Notify(MemoryPressureLevel memory_pressure_level);
+ void SyncNotify(MemoryPressureLevel memory_pressure_level);
+ private:
static void DoNotifyMemoryPressure(MemoryPressureLevel memory_pressure_level);
MemoryPressureCallback callback_;
+ SyncMemoryPressureCallback sync_memory_pressure_callback_;
DISALLOW_COPY_AND_ASSIGN(MemoryPressureListener);
};
« no previous file with comments | « no previous file | base/memory/memory_pressure_listener.cc » ('j') | third_party/WebKit/Source/core/workers/WorkerBackingThread.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698