⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 184064 in webkit


Ignore:
Timestamp:
May 10, 2015, 8:09:11 PM (11 years ago)
Author:
commit-queue@webkit.org
Message:

[GTK][SOUP] Web and Network processes don't know how to get memory size on OSX
https://bugs.webkit.org/show_bug.cgi?id=144554

Patch by Philip Chimento <philip.chimento@gmail.com> on 2015-05-10
Reviewed by Darin Adler.

  • NetworkProcess/soup/NetworkProcessSoup.cpp:

(WebKit::NetworkProcess::platformSetCacheModel): Use WTF::ramSize()
instead of local function. Also use WTF::MB instead of dividing by
1024 * 1024.
(WebKit::getMemorySize): Deleted.

  • WebProcess/soup/WebProcessSoup.cpp:

(WebKit::WebProcess::platformSetCacheModel): Ditto.
(WebKit::getMemorySize): Deleted.

Location:
trunk/Source/WebKit2
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit2/ChangeLog

    r184061 r184064  
     12015-05-10  Philip Chimento  <philip.chimento@gmail.com>
     2
     3        [GTK][SOUP] Web and Network processes don't know how to get memory size on OSX
     4        https://bugs.webkit.org/show_bug.cgi?id=144554
     5
     6        Reviewed by Darin Adler.
     7
     8        * NetworkProcess/soup/NetworkProcessSoup.cpp:
     9        (WebKit::NetworkProcess::platformSetCacheModel): Use WTF::ramSize()
     10        instead of local function. Also use WTF::MB instead of dividing by
     11        1024 * 1024.
     12        (WebKit::getMemorySize): Deleted.
     13        * WebProcess/soup/WebProcessSoup.cpp:
     14        (WebKit::WebProcess::platformSetCacheModel): Ditto.
     15        (WebKit::getMemorySize): Deleted.
     16
    1172015-05-10  Yongjun Zhang  <yongjun_zhang@apple.com>
    218
  • trunk/Source/WebKit2/NetworkProcess/soup/NetworkProcessSoup.cpp

    r183931 r184064  
    3939#include <WebCore/SoupNetworkSession.h>
    4040#include <libsoup/soup.h>
     41#include <wtf/RAMSize.h>
    4142#include <wtf/gobject/GRefPtr.h>
    4243#include <wtf/gobject/GUniquePtr.h>
     
    5960}
    6061#endif
    61 
    62 static uint64_t getMemorySize()
    63 {
    64     static uint64_t kDefaultMemorySize = 512;
    65     long pageSize = sysconf(_SC_PAGESIZE);
    66     if (pageSize == -1)
    67         return kDefaultMemorySize;
    68 
    69     long physPages = sysconf(_SC_PHYS_PAGES);
    70     if (physPages == -1)
    71         return kDefaultMemorySize;
    72 
    73     return ((pageSize / 1024) * physPages) / 1024;
    74 }
    7562
    7663void NetworkProcess::userPreferredLanguagesChanged(const Vector<String>& languages)
     
    129116
    130117#if ENABLE(NETWORK_CACHE)
    131     uint64_t diskFreeSize = WebCore::getVolumeFreeSizeForPath(m_diskCacheDirectory.utf8().data()) / 1024 / 1024;
     118    uint64_t diskFreeSize = WebCore::getVolumeFreeSizeForPath(m_diskCacheDirectory.utf8().data()) / WTF::MB;
    132119#else
    133120    SoupCache* cache = SoupNetworkSession::defaultSession().cache();
    134     uint64_t diskFreeSize = getCacheDiskFreeSize(cache) / 1024 / 1024;
     121    uint64_t diskFreeSize = getCacheDiskFreeSize(cache) / WTF::MB;
    135122#endif
    136123
    137     uint64_t memSize = getMemorySize();
     124    uint64_t memSize = WTF::ramSize() / WTF::MB;
    138125    calculateCacheSizes(cacheModel, memSize, diskFreeSize,
    139126        cacheTotalCapacity, cacheMinDeadCapacity, cacheMaxDeadCapacity, deadDecodedDataDeletionInterval,
  • trunk/Source/WebKit2/WebProcess/soup/WebProcessSoup.cpp

    r183931 r184064  
    4242#include <WebCore/SoupNetworkSession.h>
    4343#include <libsoup/soup.h>
     44#include <wtf/RAMSize.h>
    4445#include <wtf/gobject/GRefPtr.h>
    4546#include <wtf/gobject/GUniquePtr.h>
     
    5758
    5859    return WebCore::getVolumeFreeSizeForPath(cacheDir.get());
    59 }
    60 
    61 static uint64_t getMemorySize()
    62 {
    63     static uint64_t kDefaultMemorySize = 512;
    64     long pageSize = sysconf(_SC_PAGESIZE);
    65     if (pageSize == -1)
    66         return kDefaultMemorySize;
    67 
    68     long physPages = sysconf(_SC_PHYS_PAGES);
    69     if (physPages == -1)
    70         return kDefaultMemorySize;
    71 
    72     return ((pageSize / 1024LL) * physPages) / 1024LL;
    7360}
    7461
     
    8976    if (!usesNetworkProcess()) {
    9077        cache = WebCore::SoupNetworkSession::defaultSession().cache();
    91         diskFreeSize = getCacheDiskFreeSize(cache) / 1024 / 1024;
     78        diskFreeSize = getCacheDiskFreeSize(cache) / WTF::MB;
    9279    }
    9380
    94     uint64_t memSize = getMemorySize();
     81    uint64_t memSize = WTF::ramSize() / WTF::MB;
    9582    calculateCacheSizes(cacheModel, memSize, diskFreeSize,
    9683                        cacheTotalCapacity, cacheMinDeadCapacity, cacheMaxDeadCapacity, deadDecodedDataDeletionInterval,
Note: See TracChangeset for help on using the changeset viewer.