https://bugs.webkit.org/show_bug.cgi?id=188867
Reviewed by Fujii Hironori.
Moves generic implementation of MemoryPressureHandler from
MemoryPressureHandler.cpp into MemoryPressureHandlerGeneric
and generic implementation of memoryFootprint from
MemoryFootprintLinux.cpp to MemoryFootprintGeneric.
* wtf/MemoryPressureHandler.cpp:
(WTF::MemoryPressureHandler::install): Deleted.
(WTF::MemoryPressureHandler::uninstall): Deleted.
(WTF::MemoryPressureHandler::respondToMemoryPressure): Deleted.
(WTF::MemoryPressureHandler::platformReleaseMemory): Deleted.
(WTF::MemoryPressureHandler::ReliefLogger::platformMemoryUsage): Deleted.
* wtf/PlatformJSCOnly.cmake:
* wtf/generic/MemoryFootprintGeneric.cpp: Added.
(WTF::memoryFootprint):
* wtf/generic/MemoryPressureHandlerGeneric.cpp: Added.
(WTF::MemoryPressureHandler::memoryMeasurementTimerFired):
(WTF::MemoryPressureHandler::platformReleaseMemory):
(WTF::MemoryPressureHandler::install):
(WTF::MemoryPressureHandler::uninstall):
(WTF::MemoryPressureHandler::holdOff):
(WTF::MemoryPressureHandler::respondToMemoryPressure):
(WTF::MemoryPressureHandler::ReliefLogger::platformMemoryUsage):
* wtf/linux/CurrentProcessMemoryStatus.cpp:
* wtf/linux/CurrentProcessMemoryStatus.h:
* wtf/linux/MemoryFootprintLinux.cpp:
(WTF::computeMemoryFootprint):
(WTF::memoryFootprint):
* wtf/linux/MemoryPressureHandlerLinux.cpp:
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@235215
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2018-08-22 Don Olmstead <don.olmstead@sony.com>
+
+ [WTF] Add generic implementation for Memory querying
+ https://bugs.webkit.org/show_bug.cgi?id=188867
+
+ Reviewed by Fujii Hironori.
+
+ Moves generic implementation of MemoryPressureHandler from
+ MemoryPressureHandler.cpp into MemoryPressureHandlerGeneric
+ and generic implementation of memoryFootprint from
+ MemoryFootprintLinux.cpp to MemoryFootprintGeneric.
+
+ * wtf/MemoryPressureHandler.cpp:
+ (WTF::MemoryPressureHandler::install): Deleted.
+ (WTF::MemoryPressureHandler::uninstall): Deleted.
+ (WTF::MemoryPressureHandler::respondToMemoryPressure): Deleted.
+ (WTF::MemoryPressureHandler::platformReleaseMemory): Deleted.
+ (WTF::MemoryPressureHandler::ReliefLogger::platformMemoryUsage): Deleted.
+ * wtf/PlatformJSCOnly.cmake:
+ * wtf/generic/MemoryFootprintGeneric.cpp: Added.
+ (WTF::memoryFootprint):
+ * wtf/generic/MemoryPressureHandlerGeneric.cpp: Added.
+ (WTF::MemoryPressureHandler::memoryMeasurementTimerFired):
+ (WTF::MemoryPressureHandler::platformReleaseMemory):
+ (WTF::MemoryPressureHandler::install):
+ (WTF::MemoryPressureHandler::uninstall):
+ (WTF::MemoryPressureHandler::holdOff):
+ (WTF::MemoryPressureHandler::respondToMemoryPressure):
+ (WTF::MemoryPressureHandler::ReliefLogger::platformMemoryUsage):
+ * wtf/linux/CurrentProcessMemoryStatus.cpp:
+ * wtf/linux/CurrentProcessMemoryStatus.h:
+ * wtf/linux/MemoryFootprintLinux.cpp:
+ (WTF::computeMemoryFootprint):
+ (WTF::memoryFootprint):
+ * wtf/linux/MemoryPressureHandlerLinux.cpp:
+
2018-08-21 Antti Koivisto <antti@apple.com>
Allow creating WeakPtrs to const objects
m_initialMemory->physical, currentMemory->physical, physicalDiff);
}
-#if !PLATFORM(COCOA) && !OS(LINUX) && !OS(WINDOWS)
-void MemoryPressureHandler::install() { }
-void MemoryPressureHandler::uninstall() { }
-void MemoryPressureHandler::respondToMemoryPressure(Critical, Synchronous) { }
-void MemoryPressureHandler::platformReleaseMemory(Critical) { }
-std::optional<MemoryPressureHandler::ReliefLogger::MemoryUsage> MemoryPressureHandler::ReliefLogger::platformMemoryUsage() { return std::nullopt; }
-#endif
-
#if !OS(WINDOWS)
void MemoryPressureHandler::platformInitialize() { }
#endif
unix/CPUTimeUnix.cpp
)
endif ()
-
endif ()
if (WIN32)
list(APPEND WTF_INCLUDE_DIRECTORIES
${DERIVED_SOURCES_WTF_DIR}
)
-else ()
+elseif (CMAKE_SYSTEM_NAME MATCHES "Linux")
list(APPEND WTF_SOURCES
+ linux/CurrentProcessMemoryStatus.cpp
linux/MemoryFootprintLinux.cpp
+ linux/MemoryPressureHandlerLinux.cpp
+ )
+ list(APPEND WTF_PUBLIC_HEADERS
+ linux/CurrentProcessMemoryStatus.h
+ )
+else ()
+ list(APPEND WTF_SOURCES
+ generic/MemoryFootprintGeneric.cpp
+ generic/MemoryPressureHandlerGeneric.cpp
)
endif ()
--- /dev/null
+/*
+ * Copyright (C) 2018 Sony Interactive Entertainment Inc.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "MemoryFootprint.h"
+
+namespace WTF {
+
+size_t memoryFootprint()
+{
+ return 0;
+}
+
+} // namespace WTF
--- /dev/null
+/*
+ * Copyright (C) 2018 Sony Interactive Entertainment Inc.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "MemoryPressureHandler.h"
+
+namespace WTF {
+
+void MemoryPressureHandler::memoryMeasurementTimerFired()
+{
+}
+
+void MemoryPressureHandler::platformReleaseMemory(Critical)
+{
+}
+
+void MemoryPressureHandler::install()
+{
+}
+
+void MemoryPressureHandler::uninstall()
+{
+}
+
+void MemoryPressureHandler::holdOff(Seconds seconds)
+{
+}
+
+void MemoryPressureHandler::respondToMemoryPressure(Critical critical, Synchronous synchronous)
+{
+}
+
+std::optional<MemoryPressureHandler::ReliefLogger::MemoryUsage> MemoryPressureHandler::ReliefLogger::platformMemoryUsage()
+{
+ return std::nullopt;
+}
+
+} // namespace WTF
#include "config.h"
#include "CurrentProcessMemoryStatus.h"
-#if OS(LINUX)
-
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
}
} // namespace WTF
-
-#endif // OS(LINUX)
#pragma once
-#if OS(LINUX)
-
namespace WTF {
struct ProcessMemoryStatus {
using WTF::ProcessMemoryStatus;
using WTF::currentProcessMemoryStatus;
-
-#endif // OS(LINUX)
#include "config.h"
#include "MemoryFootprint.h"
-#if OS(LINUX)
#include "MonotonicTime.h"
#include <stdio.h>
#include <wtf/StdLibExtras.h>
#include <wtf/text/StringView.h>
-#endif
namespace WTF {
-#if OS(LINUX)
static const Seconds s_memoryFootprintUpdateInterval = 1_s;
template<typename Functor>
fclose(file);
return totalPrivateDirtyInKB * KB;
}
-#endif
size_t memoryFootprint()
{
-#if OS(LINUX)
static size_t footprint = 0;
static MonotonicTime previousUpdateTime = { };
Seconds elapsed = MonotonicTime::now() - previousUpdateTime;
}
return footprint;
-#endif
- return 0;
}
-}
+} // namespace WTF
#include "config.h"
#include "MemoryPressureHandler.h"
-#if OS(LINUX)
-
#include <malloc.h>
#include <unistd.h>
#include <wtf/MainThread.h>
return MemoryUsage {processMemoryUsage(), memoryFootprint()};
}
-
} // namespace WTF
-
-#endif // OS(LINUX)