Changeset 142212 in webkit
- Timestamp:
- Feb 7, 2013 5:22:05 PM (11 years ago)
- Location:
- trunk/Source
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r142209 r142212 1 2013-02-06 Gavin Barraclough <barraclough@apple.com> 2 3 PluginProcess should quit immediately if idle in response to low-memory notifications 4 https://bugs.webkit.org/show_bug.cgi?id=109103 5 <rdar://problem/12679827> 6 7 Reviewed by Darin Adler. 8 9 This patch allows a process to set a custom callback for low memory warnings 10 (defaulting to the current behaviour, as implemented in releaseMemory). 11 12 MemoryPressureHandler::install is currently used for two purposes - it is 13 called when first initializing a low memory handler for a process, and also 14 used to reinstall the handler (on a delay) after the notification has occured. 15 Since reinstallation doesn't change the callback, split these behaviours out - 16 MemoryPressureHandler::initialize is added to initialization, and accepts a 17 custom callback, install in made private. 18 19 * WebCore.exp.in: 20 - Added export for releaseMemory. 21 * platform/MemoryPressureHandler.cpp: 22 (WebCore::MemoryPressureHandler::releaseMemory): 23 - Added null implementation for non-Mac builds. 24 * platform/MemoryPressureHandler.h: 25 (WebCore::MemoryPressureHandler::initialize): 26 - distinguish initialization from reinstallations, allow handler to be set. 27 (MemoryPressureHandler): 28 - Added m_lowMemoryHandler function pointer member variable. 29 * platform/mac/MemoryPressureHandlerMac.mm: 30 (WebCore::MemoryPressureHandler::respondToMemoryPressure): 31 - Call m_lowMemoryHandler instead of releaseMemory. 32 1 33 2013-02-07 Kentaro Hara <haraken@chromium.org> 2 34 -
trunk/Source/WebCore/WebCore.exp.in
r142189 r142212 601 601 __ZN7WebCore20SpaceSplitStringDataD1Ev 602 602 __ZN7WebCore21BackForwardController11itemAtIndexEi 603 __ZN7WebCore21MemoryPressureHandler13releaseMemoryEb 603 604 __ZN7WebCore21MemoryPressureHandler7installEv 604 605 __ZN7WebCore21NetworkStorageSession28createPrivateBrowsingSessionERKN3WTF6StringE -
trunk/Source/WebCore/platform/MemoryPressureHandler.cpp
r122670 r142212 44 44 45 45 #if !PLATFORM(MAC) || PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED == 1060 46 46 47 void MemoryPressureHandler::install() { } 48 void MemoryPressureHandler::uninstall() { } 49 void MemoryPressureHandler::holdOff(unsigned) { } 50 void MemoryPressureHandler::respondToMemoryPressure() { } 51 void MemoryPressureHandler::releaseMemory(bool) { } 47 52 48 void MemoryPressureHandler::uninstall() { }49 50 void MemoryPressureHandler::holdOff(unsigned) { }51 52 void MemoryPressureHandler::respondToMemoryPressure() { }53 53 #endif 54 54 -
trunk/Source/WebCore/platform/MemoryPressureHandler.h
r131496 r142212 32 32 namespace WebCore { 33 33 34 typedef void (*LowMemoryHandler)(bool critical); 35 34 36 class MemoryPressureHandler { 35 37 WTF_MAKE_FAST_ALLOCATED; … … 37 39 friend MemoryPressureHandler& memoryPressureHandler(); 38 40 41 void initialize(LowMemoryHandler handler = releaseMemory) 42 { 43 ASSERT(!m_installed); 44 m_lowMemoryHandler = handler; 45 install(); 46 } 47 48 private: 39 49 void install(); 40 50 void uninstall(); … … 42 52 void holdOff(unsigned); 43 53 44 private:45 54 MemoryPressureHandler(); 46 55 ~MemoryPressureHandler(); 47 56 48 57 void respondToMemoryPressure(); 49 void releaseMemory(bool critical);58 static void releaseMemory(bool critical); 50 59 51 60 bool m_installed; 52 61 time_t m_lastRespondTime; 62 LowMemoryHandler m_lowMemoryHandler; 53 63 }; 54 64 -
trunk/Source/WebCore/platform/mac/MemoryPressureHandlerMac.mm
r139218 r142212 135 135 double startTime = monotonicallyIncreasingTime(); 136 136 137 releaseMemory(false); 137 ASSERT(m_lowMemoryHandler); 138 m_lowMemoryHandler(false); 138 139 139 140 unsigned holdOffTime = (monotonicallyIncreasingTime() - startTime) * s_holdOffMultiplier; -
trunk/Source/WebKit/mac/ChangeLog
r142171 r142212 1 2013-02-06 Gavin Barraclough <barraclough@apple.com> 2 3 PluginProcess should quit immediately if idle in response to low-memory notifications 4 https://bugs.webkit.org/show_bug.cgi?id=109103 5 <rdar://problem/12679827> 6 7 Reviewed by Darin Adler. 8 9 * WebView/WebView.mm: 10 (-[WebView _commonInitializationWithFrameName:groupName:]): 11 - MemoryPressureHandler::install is now called via MemoryPressureHandler::initialize. 12 (WebInstallMemoryPressureHandler): 13 - MemoryPressureHandler::install is now called via MemoryPressureHandler::initialize. 14 1 15 2013-02-07 Benjamin Poulain <bpoulain@apple.com> 2 16 -
trunk/Source/WebKit/mac/WebView/WebView.mm
r141173 r142212 820 820 [[self preferences] _postPreferencesChangedAPINotification]; 821 821 822 memoryPressureHandler().in stall();822 memoryPressureHandler().initialize(); 823 823 824 824 if (!WebKitLinkedOnOrAfter(WEBKIT_FIRST_VERSION_WITH_LOCAL_RESOURCE_SECURITY_RESTRICTION)) { … … 6735 6735 void WebInstallMemoryPressureHandler(void) 6736 6736 { 6737 memoryPressureHandler().in stall();6737 memoryPressureHandler().initialize(); 6738 6738 } 6739 6739 -
trunk/Source/WebKit2/ChangeLog
r142201 r142212 1 2013-02-06 Gavin Barraclough <barraclough@apple.com> 2 3 PluginProcess should quit immediately if idle in response to low-memory notifications 4 https://bugs.webkit.org/show_bug.cgi?id=109103 5 <rdar://problem/12679827> 6 7 Reviewed by Darin Adler. 8 9 PluginProcess now initializes a MemoryPressureHandler for the process, providing 10 a custom callback which will call terminate if appropriate (if the plugin is not 11 currently in use). 12 13 * PluginProcess/PluginProcess.cpp: 14 (WebKit::PluginProcess::lowMemoryHandler): 15 - Custom callback to terminate if appropriate. 16 (WebKit::PluginProcess::initializeProcess): 17 - Initialize the MemoryPressureHandler. 18 (WebKit::PluginProcess::shouldTerminate): 19 - This method now also needs to be callable in situations where it might return false. 20 * PluginProcess/PluginProcess.h: 21 (PluginProcess): 22 - Added declaration for lowMemoryHandler. 23 * WebProcess/WebProcess.cpp: 24 (WebKit::WebProcess::initializeWebProcess): 25 - MemoryPressureHandler::install is now called via MemoryPressureHandler::initialize. 26 1 27 2013-02-07 KwangYong Choi <ky0.choi@samsung.com> 2 28 -
trunk/Source/WebKit2/PluginProcess/PluginProcess.cpp
r141361 r142212 37 37 #include "PluginProcessProxyMessages.h" 38 38 #include "WebProcessConnection.h" 39 #include <WebCore/MemoryPressureHandler.h> 39 40 #include <WebCore/NotImplemented.h> 40 41 #include <WebCore/RunLoop.h> … … 86 87 } 87 88 89 void PluginProcess::lowMemoryHandler(bool) 90 { 91 if (shared().shouldTerminate()) 92 shared().terminate(); 93 } 94 88 95 void PluginProcess::initializeProcess(const ChildProcessInitializationParameters& parameters) 89 96 { 90 97 m_pluginPath = parameters.extraInitializationData.get("plugin-path"); 91 98 platformInitializeProcess(parameters); 99 100 memoryPressureHandler().initialize(lowMemoryHandler); 92 101 } 93 102 … … 126 135 bool PluginProcess::shouldTerminate() 127 136 { 128 ASSERT(m_webProcessConnections.isEmpty()); 129 130 return true; 137 return m_webProcessConnections.isEmpty(); 131 138 } 132 139 -
trunk/Source/WebKit2/PluginProcess/PluginProcess.h
r141361 r142212 109 109 mach_port_t m_compositingRenderServerPort; 110 110 #endif 111 112 static void lowMemoryHandler(bool critical); 111 113 }; 112 114 -
trunk/Source/WebKit2/WebProcess/WebProcess.cpp
r141820 r142212 245 245 platformInitializeWebProcess(parameters, decoder); 246 246 247 memoryPressureHandler().in stall();247 memoryPressureHandler().initialize(); 248 248 249 249 RefPtr<APIObject> injectedBundleInitializationUserData;
Note: See TracChangeset
for help on using the changeset viewer.