Title: [153949] trunk/Source/WebKit2
- Revision
- 153949
- Author
- [email protected]
- Date
- 2013-08-12 10:32:37 -0700 (Mon, 12 Aug 2013)
Log Message
[Qt] [WebKit2] Remove duplicate RAM Size calculation and reuse WTF::ramSize()
https://bugs.webkit.org/show_bug.cgi?id=119663
Patch by Arunprasad Rajkumar <[email protected]> on 2013-08-12
Reviewed by Sam Weinig.
* WebProcess/qt/WebProcessQt.cpp:
(WebKit::WebProcess::platformSetCacheModel):
Modified Paths
Diff
Modified: trunk/Source/WebKit2/ChangeLog (153948 => 153949)
--- trunk/Source/WebKit2/ChangeLog 2013-08-12 17:23:42 UTC (rev 153948)
+++ trunk/Source/WebKit2/ChangeLog 2013-08-12 17:32:37 UTC (rev 153949)
@@ -1,3 +1,13 @@
+2013-08-12 Arunprasad Rajkumar <[email protected]>
+
+ [Qt] [WebKit2] Remove duplicate RAM Size calculation and reuse WTF::ramSize()
+ https://bugs.webkit.org/show_bug.cgi?id=119663
+
+ Reviewed by Sam Weinig.
+
+ * WebProcess/qt/WebProcessQt.cpp:
+ (WebKit::WebProcess::platformSetCacheModel):
+
2013-08-12 Anton Obzhirov <[email protected]>
[GTK] Don't load GAIL when using GTK 3.2 or greater
Modified: trunk/Source/WebKit2/WebProcess/qt/WebProcessQt.cpp (153948 => 153949)
--- trunk/Source/WebKit2/WebProcess/qt/WebProcessQt.cpp 2013-08-12 17:23:42 UTC (rev 153948)
+++ trunk/Source/WebKit2/WebProcess/qt/WebProcessQt.cpp 2013-08-12 17:32:37 UTC (rev 153949)
@@ -42,6 +42,7 @@
#include <WebCore/MemoryCache.h>
#include <WebCore/PageCache.h>
#include <WebCore/RuntimeEnabledFeatures.h>
+#include <wtf/RAMSize.h>
#if defined(Q_OS_MACX)
#include <dispatch/dispatch.h>
@@ -56,42 +57,9 @@
namespace WebKit {
-static uint64_t physicalMemorySizeInBytes()
-{
- static uint64_t physicalMemorySize = 0;
-
- if (!physicalMemorySize) {
-#if defined(Q_OS_MACX)
- host_basic_info_data_t hostInfo;
- mach_port_t host = mach_host_self();
- mach_msg_type_number_t count = HOST_BASIC_INFO_COUNT;
- kern_return_t r = host_info(host, HOST_BASIC_INFO, (host_info_t)&hostInfo, &count);
- mach_port_deallocate(mach_task_self(), host);
-
- if (r == KERN_SUCCESS)
- physicalMemorySize = hostInfo.max_mem;
-
-#elif defined(Q_OS_WIN)
- MEMORYSTATUSEX statex;
- statex.dwLength = sizeof(statex);
- GlobalMemoryStatusEx(&statex);
- physicalMemorySize = static_cast<uint64_t>(statex.ullTotalPhys);
-
-#else
- long pageSize = sysconf(_SC_PAGESIZE);
- long numberOfPages = sysconf(_SC_PHYS_PAGES);
-
- if (pageSize > 0 && numberOfPages > 0)
- physicalMemorySize = static_cast<uint64_t>(pageSize) * static_cast<uint64_t>(numberOfPages);
-
-#endif
- }
- return physicalMemorySize;
-}
-
void WebProcess::platformSetCacheModel(CacheModel cacheModel)
{
- uint64_t physicalMemorySizeInMegabytes = physicalMemorySizeInBytes() / 1024 / 1024;
+ uint64_t physicalMemorySizeInMegabytes = WTF::ramSize() / 1024 / 1024;
// The Mac port of WebKit2 uses a fudge factor of 1000 here to account for misalignment, however,
// that tends to overestimate the memory quite a bit (1 byte misalignment ~ 48 MiB misestimation).
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes