Title: [214351] trunk/Source/WTF
- Revision
- 214351
- Author
- akl...@apple.com
- Date
- 2017-03-24 09:45:08 -0700 (Fri, 24 Mar 2017)
Log Message
Make inactive web processes behave as though under memory pressure.
<https://webkit.org/b/170042>
Reviewed by Antti Koivisto.
Once a web process becomes inactive, let's try to reduce its impact
on memory usage by treating it as if it's under memory pressure until
it becomes active.
* wtf/MemoryPressureHandler.cpp:
(WTF::MemoryPressureHandler::setProcessState):
(WTF::MemoryPressureHandler::isUnderMemoryPressure):
* wtf/MemoryPressureHandler.h:
(WTF::MemoryPressureHandler::isUnderMemoryPressure): Deleted.
Modified Paths
Diff
Modified: trunk/Source/WTF/ChangeLog (214350 => 214351)
--- trunk/Source/WTF/ChangeLog 2017-03-24 16:32:53 UTC (rev 214350)
+++ trunk/Source/WTF/ChangeLog 2017-03-24 16:45:08 UTC (rev 214351)
@@ -1,3 +1,20 @@
+2017-03-24 Andreas Kling <akl...@apple.com>
+
+ Make inactive web processes behave as though under memory pressure.
+ <https://webkit.org/b/170042>
+
+ Reviewed by Antti Koivisto.
+
+ Once a web process becomes inactive, let's try to reduce its impact
+ on memory usage by treating it as if it's under memory pressure until
+ it becomes active.
+
+ * wtf/MemoryPressureHandler.cpp:
+ (WTF::MemoryPressureHandler::setProcessState):
+ (WTF::MemoryPressureHandler::isUnderMemoryPressure):
+ * wtf/MemoryPressureHandler.h:
+ (WTF::MemoryPressureHandler::isUnderMemoryPressure): Deleted.
+
2017-03-23 Michael Catanzaro <mcatanz...@igalia.com>
window.crypto.getRandomValues() uses the insecure RC4 RNG
Modified: trunk/Source/WTF/wtf/MemoryPressureHandler.cpp (214350 => 214351)
--- trunk/Source/WTF/wtf/MemoryPressureHandler.cpp 2017-03-24 16:32:53 UTC (rev 214350)
+++ trunk/Source/WTF/wtf/MemoryPressureHandler.cpp 2017-03-24 16:45:08 UTC (rev 214351)
@@ -171,6 +171,9 @@
if (m_processState == state)
return;
m_processState = state;
+ memoryPressureStatusChanged();
+ if (m_processState == WebsamProcessState::Inactive)
+ respondToMemoryPressure(Critical::Yes, Synchronous::No);
}
void MemoryPressureHandler::beginSimulatedMemoryPressure()
@@ -190,6 +193,17 @@
memoryPressureStatusChanged();
}
+bool MemoryPressureHandler::isUnderMemoryPressure()
+{
+ auto& memoryPressureHandler = singleton();
+ return memoryPressureHandler.m_underMemoryPressure
+#if PLATFORM(MAC)
+ || memoryPressureHandler.m_memoryUsagePolicy >= MemoryUsagePolicy::Strict
+ || memoryPressureHandler.m_processState == WebsamProcessState::Inactive
+#endif
+ || memoryPressureHandler.m_isSimulatingMemoryPressure;
+}
+
void MemoryPressureHandler::releaseMemory(Critical critical, Synchronous synchronous)
{
if (!m_lowMemoryHandler)
Modified: trunk/Source/WTF/wtf/MemoryPressureHandler.h (214350 => 214351)
--- trunk/Source/WTF/wtf/MemoryPressureHandler.h 2017-03-24 16:32:53 UTC (rev 214350)
+++ trunk/Source/WTF/wtf/MemoryPressureHandler.h 2017-03-24 16:45:08 UTC (rev 214351)
@@ -79,14 +79,7 @@
m_lowMemoryHandler = WTFMove(handler);
}
- bool isUnderMemoryPressure() const
- {
- return m_underMemoryPressure
-#if PLATFORM(MAC)
- || m_memoryUsagePolicy >= MemoryUsagePolicy::Strict
-#endif
- || m_isSimulatingMemoryPressure;
- }
+ WTF_EXPORT_PRIVATE static bool isUnderMemoryPressure();
void setUnderMemoryPressure(bool);
#if OS(LINUX)
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes