Changeset 177216 in webkit
- Timestamp:
- Dec 12, 2014 1:21:15 AM (9 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 1 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r177214 r177216 1 2014-12-12 ChangSeok Oh <changseok.oh@collabora.com> 2 3 Implement MemoryPressureHandler for Linux system 4 https://bugs.webkit.org/show_bug.cgi?id=123532 5 6 Reviewed by Sergio Villar Senin. 7 8 This is an initial implementation to support MemoryPressureHandler for linux system. 9 The patch is based on Tomeu's last patch and improved on top of it. 10 Most of current linux distributions support cgroup, so that we use the memory.pressure_level 11 mechanism of cgroup to get notifications when an application reaches the 'low' memory 12 pressure level. 13 14 No new tests since no engine behavior changed. 15 16 * PlatformEfl.cmake: 17 * PlatformGTK.cmake: 18 * platform/MemoryPressureHandler.cpp: 19 (WebCore::MemoryPressureHandler::MemoryPressureHandler): 20 * platform/MemoryPressureHandler.h: 21 * platform/linux/MemoryPressureHandlerLinux.cpp: Added. 22 (WebCore::nextToken): 23 (WebCore::MemoryPressureHandler::~MemoryPressureHandler): 24 (WebCore::MemoryPressureHandler::waitForMemoryPressureEvent): run in a seperated thread 25 to listen 'low' level event. 26 (WebCore::MemoryPressureHandler::logErrorAndCloseFDs): 27 (WebCore::MemoryPressureHandler::install): 28 (WebCore::MemoryPressureHandler::uninstall): 29 (WebCore::MemoryPressureHandler::holdOffTimerFired): 30 (WebCore::MemoryPressureHandler::holdOff): 31 (WebCore::MemoryPressureHandler::respondToMemoryPressure): 32 (WebCore::MemoryPressureHandler::platformReleaseMemory): 33 (WebCore::MemoryPressureHandler::ReliefLogger::platformLog): 34 (WebCore::MemoryPressureHandler::ReliefLogger::platformMemoryUsage): read /proc/self/status 35 to get VM amount used by current process. 36 1 37 2014-12-12 Simon Fraser <simon.fraser@apple.com> 2 38 -
trunk/Source/WebCore/PlatformEfl.cmake
r177058 r177216 213 213 214 214 platform/linux/GamepadDeviceLinux.cpp 215 platform/linux/MemoryPressureHandlerLinux.cpp 215 216 216 217 platform/mediastream/gstreamer/MediaStreamCenterGStreamer.cpp -
trunk/Source/WebCore/PlatformGTK.cmake
r177148 r177216 157 157 158 158 platform/linux/GamepadDeviceLinux.cpp 159 platform/linux/MemoryPressureHandlerLinux.cpp 159 160 160 161 platform/mediastream/gstreamer/MediaStreamCenterGStreamer.cpp -
trunk/Source/WebCore/platform/MemoryPressureHandler.cpp
r177167 r177216 65 65 , m_releaseMemoryBlock(0) 66 66 , m_observer(0) 67 #elif OS(LINUX) 68 , m_eventFD(0) 69 , m_pressureLevelFD(0) 70 , m_threadID(0) 71 , m_holdOffTimer(*this, &MemoryPressureHandler::holdOffTimerFired) 67 72 #endif 68 73 { … … 144 149 } 145 150 146 #if !PLATFORM(COCOA) 151 #if !PLATFORM(COCOA) && !OS(LINUX) 147 152 void MemoryPressureHandler::install() { } 148 153 void MemoryPressureHandler::uninstall() { } -
trunk/Source/WebCore/platform/MemoryPressureHandler.h
r172862 r177216 1 1 /* 2 2 * Copyright (C) 2011 Apple Inc. All Rights Reserved. 3 * Copyright (C) 2014 Raspberry Pi Foundation. All Rights Reserved. 3 4 * 4 5 * Redistribution and use in source and binary forms, with or without … … 33 34 #if PLATFORM(IOS) 34 35 #include <wtf/ThreadingPrimitives.h> 36 #elif OS(LINUX) 37 #include "Timer.h" 35 38 #endif 36 39 … … 70 73 WEBCORE_EXPORT bool shouldWaitForMemoryClearMessage(); 71 74 void respondToMemoryPressureIfNeeded(); 75 #elif OS(LINUX) 76 static void waitForMemoryPressureEvent(void*); 72 77 #endif 73 78 … … 128 133 CFRunLoopObserverRef m_observer; 129 134 Mutex m_observerMutex; 135 #elif OS(LINUX) 136 int m_eventFD; 137 int m_pressureLevelFD; 138 WTF::ThreadIdentifier m_threadID; 139 Timer m_holdOffTimer; 140 void holdOffTimerFired(); 141 void logErrorAndCloseFDs(const char* error); 130 142 #endif 131 143 }; 132 144 133 145 // Function to obtain the global memory pressure object. 134 146 WEBCORE_EXPORT MemoryPressureHandler& memoryPressureHandler();
Note: See TracChangeset
for help on using the changeset viewer.