Title: [214974] trunk/Source
- Revision
- 214974
- Author
- akl...@apple.com
- Date
- 2017-04-05 15:55:25 -0700 (Wed, 05 Apr 2017)
Log Message
Make inactive web processes behave as though under memory pressure.
https://bugs.webkit.org/show_bug.cgi?id=170042
<rdar://problem/31038445>
Reviewed by Antti Koivisto.
Source/WebCore:
Prevent PerformanceMonitor from marking the process as inactive at startup.
This fixes the API test failure that caused this patch to get rolled out.
* page/PerformanceMonitor.h:
Source/WTF:
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 (214973 => 214974)
--- trunk/Source/WTF/ChangeLog 2017-04-05 22:38:24 UTC (rev 214973)
+++ trunk/Source/WTF/ChangeLog 2017-04-05 22:55:25 UTC (rev 214974)
@@ -1,3 +1,21 @@
+2017-04-05 Andreas Kling <akl...@apple.com>
+
+ Make inactive web processes behave as though under memory pressure.
+ https://bugs.webkit.org/show_bug.cgi?id=170042
+ <rdar://problem/31038445>
+
+ 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-04-05 Yusuke Suzuki <utatane....@gmail.com>
[JSC] Suppress warnings in GCC
Modified: trunk/Source/WTF/wtf/MemoryPressureHandler.cpp (214973 => 214974)
--- trunk/Source/WTF/wtf/MemoryPressureHandler.cpp 2017-04-05 22:38:24 UTC (rev 214973)
+++ trunk/Source/WTF/wtf/MemoryPressureHandler.cpp 2017-04-05 22:55:25 UTC (rev 214974)
@@ -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 (214973 => 214974)
--- trunk/Source/WTF/wtf/MemoryPressureHandler.h 2017-04-05 22:38:24 UTC (rev 214973)
+++ trunk/Source/WTF/wtf/MemoryPressureHandler.h 2017-04-05 22:55:25 UTC (rev 214974)
@@ -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)
@@ -184,7 +177,7 @@
};
#endif
- WebsamProcessState m_processState { WebsamProcessState::Inactive };
+ WebsamProcessState m_processState { WebsamProcessState::Active };
bool m_installed { false };
LowMemoryHandler m_lowMemoryHandler;
Modified: trunk/Source/WebCore/ChangeLog (214973 => 214974)
--- trunk/Source/WebCore/ChangeLog 2017-04-05 22:38:24 UTC (rev 214973)
+++ trunk/Source/WebCore/ChangeLog 2017-04-05 22:55:25 UTC (rev 214974)
@@ -1,3 +1,16 @@
+2017-04-05 Andreas Kling <akl...@apple.com>
+
+ Make inactive web processes behave as though under memory pressure.
+ https://bugs.webkit.org/show_bug.cgi?id=170042
+ <rdar://problem/31038445>
+
+ Reviewed by Antti Koivisto.
+
+ Prevent PerformanceMonitor from marking the process as inactive at startup.
+ This fixes the API test failure that caused this patch to get rolled out.
+
+ * page/PerformanceMonitor.h:
+
2017-04-05 Youenn Fablet <you...@apple.com>
Switch to kCVPixelFormatType_420YpCbCr8BiPlanarFullRange for Mac video capture format
Modified: trunk/Source/WebCore/page/PerformanceMonitor.h (214973 => 214974)
--- trunk/Source/WebCore/page/PerformanceMonitor.h 2017-04-05 22:38:24 UTC (rev 214973)
+++ trunk/Source/WebCore/page/PerformanceMonitor.h 2017-04-05 22:55:25 UTC (rev 214974)
@@ -65,7 +65,7 @@
Timer m_postBackgroundingMemoryUsageTimer;
Timer m_processMayBecomeInactiveTimer;
- bool m_processMayBecomeInactive { true };
+ bool m_processMayBecomeInactive { false };
};
}
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes