Changeset 235215 in webkit


Ignore:
Timestamp:
Aug 22, 2018, 8:01:40 PM (7 years ago)
Author:
don.olmstead@sony.com
Message:

[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:
Location:
trunk/Source/WTF
Files:
2 added
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WTF/ChangeLog

    r235129 r235215  
     12018-08-22  Don Olmstead  <don.olmstead@sony.com>
     2
     3        [WTF] Add generic implementation for Memory querying
     4        https://bugs.webkit.org/show_bug.cgi?id=188867
     5
     6        Reviewed by Fujii Hironori.
     7
     8        Moves generic implementation of MemoryPressureHandler from
     9        MemoryPressureHandler.cpp into MemoryPressureHandlerGeneric
     10        and generic implementation of memoryFootprint from
     11        MemoryFootprintLinux.cpp to MemoryFootprintGeneric.
     12
     13        * wtf/MemoryPressureHandler.cpp:
     14        (WTF::MemoryPressureHandler::install): Deleted.
     15        (WTF::MemoryPressureHandler::uninstall): Deleted.
     16        (WTF::MemoryPressureHandler::respondToMemoryPressure): Deleted.
     17        (WTF::MemoryPressureHandler::platformReleaseMemory): Deleted.
     18        (WTF::MemoryPressureHandler::ReliefLogger::platformMemoryUsage): Deleted.
     19        * wtf/PlatformJSCOnly.cmake:
     20        * wtf/generic/MemoryFootprintGeneric.cpp: Added.
     21        (WTF::memoryFootprint):
     22        * wtf/generic/MemoryPressureHandlerGeneric.cpp: Added.
     23        (WTF::MemoryPressureHandler::memoryMeasurementTimerFired):
     24        (WTF::MemoryPressureHandler::platformReleaseMemory):
     25        (WTF::MemoryPressureHandler::install):
     26        (WTF::MemoryPressureHandler::uninstall):
     27        (WTF::MemoryPressureHandler::holdOff):
     28        (WTF::MemoryPressureHandler::respondToMemoryPressure):
     29        (WTF::MemoryPressureHandler::ReliefLogger::platformMemoryUsage):
     30        * wtf/linux/CurrentProcessMemoryStatus.cpp:
     31        * wtf/linux/CurrentProcessMemoryStatus.h:
     32        * wtf/linux/MemoryFootprintLinux.cpp:
     33        (WTF::computeMemoryFootprint):
     34        (WTF::memoryFootprint):
     35        * wtf/linux/MemoryPressureHandlerLinux.cpp:
     36
    1372018-08-21  Antti Koivisto  <antti@apple.com>
    238
  • trunk/Source/WTF/wtf/MemoryPressureHandler.cpp

    r234733 r235215  
    295295}
    296296
    297 #if !PLATFORM(COCOA) && !OS(LINUX) && !OS(WINDOWS)
    298 void MemoryPressureHandler::install() { }
    299 void MemoryPressureHandler::uninstall() { }
    300 void MemoryPressureHandler::respondToMemoryPressure(Critical, Synchronous) { }
    301 void MemoryPressureHandler::platformReleaseMemory(Critical) { }
    302 std::optional<MemoryPressureHandler::ReliefLogger::MemoryUsage> MemoryPressureHandler::ReliefLogger::platformMemoryUsage() { return std::nullopt; }
    303 #endif
    304 
    305297#if !OS(WINDOWS)
    306298void MemoryPressureHandler::platformInitialize() { }
  • trunk/Source/WTF/wtf/PlatformJSCOnly.cmake

    r233401 r235215  
    3131        )
    3232    endif ()
    33 
    3433endif ()
    3534
     
    5857        ${DERIVED_SOURCES_WTF_DIR}
    5958    )
     59elseif (CMAKE_SYSTEM_NAME MATCHES "Linux")
     60    list(APPEND WTF_SOURCES
     61        linux/CurrentProcessMemoryStatus.cpp
     62        linux/MemoryFootprintLinux.cpp
     63        linux/MemoryPressureHandlerLinux.cpp
     64    )
     65    list(APPEND WTF_PUBLIC_HEADERS
     66        linux/CurrentProcessMemoryStatus.h
     67    )
    6068else ()
    6169    list(APPEND WTF_SOURCES
    62         linux/MemoryFootprintLinux.cpp
     70        generic/MemoryFootprintGeneric.cpp
     71        generic/MemoryPressureHandlerGeneric.cpp
    6372    )
    6473endif ()
  • trunk/Source/WTF/wtf/linux/CurrentProcessMemoryStatus.cpp

    r213214 r235215  
    2626#include "config.h"
    2727#include "CurrentProcessMemoryStatus.h"
    28 
    29 #if OS(LINUX)
    3028
    3129#include <stdio.h>
     
    7472
    7573} // namespace WTF
    76 
    77 #endif // OS(LINUX)
  • trunk/Source/WTF/wtf/linux/CurrentProcessMemoryStatus.h

    r213214 r235215  
    2626#pragma once
    2727
    28 #if OS(LINUX)
    29 
    3028namespace WTF {
    3129
     
    4644using WTF::ProcessMemoryStatus;
    4745using WTF::currentProcessMemoryStatus;
    48 
    49 #endif // OS(LINUX)
  • trunk/Source/WTF/wtf/linux/MemoryFootprintLinux.cpp

    r235113 r235215  
    2727#include "MemoryFootprint.h"
    2828
    29 #if OS(LINUX)
    3029#include "MonotonicTime.h"
    3130#include <stdio.h>
    3231#include <wtf/StdLibExtras.h>
    3332#include <wtf/text/StringView.h>
    34 #endif
    3533
    3634namespace WTF {
    3735
    38 #if OS(LINUX)
    3936static const Seconds s_memoryFootprintUpdateInterval = 1_s;
    4037
     
    8986    return totalPrivateDirtyInKB * KB;
    9087}
    91 #endif
    9288
    9389size_t memoryFootprint()
    9490{
    95 #if OS(LINUX)
    9691    static size_t footprint = 0;
    9792    static MonotonicTime previousUpdateTime = { };
     
    10398
    10499    return footprint;
    105 #endif
    106     return 0;
    107100}
    108101
    109 }
     102} // namespace WTF
  • trunk/Source/WTF/wtf/linux/MemoryPressureHandlerLinux.cpp

    r234733 r235215  
    2828#include "config.h"
    2929#include "MemoryPressureHandler.h"
    30 
    31 #if OS(LINUX)
    3230
    3331#include <malloc.h>
     
    139137}
    140138
    141 
    142139} // namespace WTF
    143 
    144 #endif // OS(LINUX)
Note: See TracChangeset for help on using the changeset viewer.