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

Unified Diff: content/renderer/render_thread_impl.cc

Issue 2688653002: Implement OnPurgeMemory callback for RenderThreadImpl (Closed)
Patch Set: Created 3 years, 10 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
« no previous file with comments | « content/renderer/render_thread_impl.h ('k') | third_party/WebKit/Source/platform/MemoryCoordinator.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/render_thread_impl.cc
diff --git a/content/renderer/render_thread_impl.cc b/content/renderer/render_thread_impl.cc
index acb26cb298706cc91ee7cff41a4a5d0bdaadd59b..a95fdfd9f0a1446e186b4a3422b83d6d6a822337 100644
--- a/content/renderer/render_thread_impl.cc
+++ b/content/renderer/render_thread_impl.cc
@@ -2218,36 +2218,18 @@ void RenderThreadImpl::OnMemoryPressure(
}
void RenderThreadImpl::OnMemoryStateChange(base::MemoryState state) {
- // TODO(hajimehoshi): Adjust the size of this memory usage according to
- // |state|. RenderThreadImpl doesn't have a feature to limit memory usage at
- // present.
if (blink_platform_impl_) {
blink::WebMemoryCoordinator::onMemoryStateChange(
static_cast<blink::MemoryState>(state));
}
- switch (state) {
- case base::MemoryState::NORMAL:
- break;
- case base::MemoryState::THROTTLED:
- // TODO(bashi): Figure out what kind of strategy is suitable on
- // THROTTLED state. crbug.com/674815
-#if defined(OS_ANDROID)
- OnTrimMemoryImmediately();
-#else
- OnSyncMemoryPressure(
- base::MemoryPressureListener::MEMORY_PRESSURE_LEVEL_MODERATE);
-#endif
- ReleaseFreeMemory();
- break;
- case base::MemoryState::SUSPENDED:
- OnTrimMemoryImmediately();
- ReleaseFreeMemory();
- ClearMemory();
- break;
- case base::MemoryState::UNKNOWN:
- NOTREACHED();
- break;
- }
+}
+
+void RenderThreadImpl::OnPurgeMemory() {
+ OnTrimMemoryImmediately();
+ ReleaseFreeMemory();
+ ClearMemory();
+ if (blink_platform_impl_)
+ blink::WebMemoryCoordinator::onPurgeMemory();
}
void RenderThreadImpl::ClearMemory() {
« no previous file with comments | « content/renderer/render_thread_impl.h ('k') | third_party/WebKit/Source/platform/MemoryCoordinator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698