Commit 526c552a authored by andersca@apple.com's avatar andersca@apple.com

Remove MemoryUsageSupport class

https://bugs.webkit.org/show_bug.cgi?id=115913

Reviewed by Andreas Kling.

MemoryUsageSupport was just used by a single call site in InspectorTimelineAgent,
and the function called always returns zero on all platforms! Remove it.

* CMakeLists.txt:
* GNUmakefile.list.am:
* Target.pri:
* WebCore.vcproj/WebCore.vcproj:
* WebCore.vcxproj/WebCore.vcxproj:
* WebCore.vcxproj/WebCore.vcxproj.filters:
* WebCore.xcodeproj/project.pbxproj:
* inspector/InspectorMemoryAgent.cpp:
* inspector/InspectorTimelineAgent.cpp:
(WebCore):
(WebCore::InspectorTimelineAgent::setNativeHeapStatistics):
* platform/MemoryUsageSupport.cpp: Removed.
* platform/MemoryUsageSupport.h: Removed.
* platform/qt/MemoryUsageSupportQt.cpp: Removed.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@149882 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent b9e8c3fd
......@@ -1828,7 +1828,6 @@ set(WebCore_SOURCES
platform/LengthBox.cpp
platform/LinkHash.cpp
platform/Logging.cpp
platform/MemoryUsageSupport.cpp
platform/MIMETypeRegistry.cpp
platform/MemoryPressureHandler.cpp
platform/NotImplemented.cpp
......
2013-05-10 Anders Carlsson <andersca@apple.com>
Remove MemoryUsageSupport class
https://bugs.webkit.org/show_bug.cgi?id=115913
Reviewed by Andreas Kling.
MemoryUsageSupport was just used by a single call site in InspectorTimelineAgent,
and the function called always returns zero on all platforms! Remove it.
* CMakeLists.txt:
* GNUmakefile.list.am:
* Target.pri:
* WebCore.vcproj/WebCore.vcproj:
* WebCore.vcxproj/WebCore.vcxproj:
* WebCore.vcxproj/WebCore.vcxproj.filters:
* WebCore.xcodeproj/project.pbxproj:
* inspector/InspectorMemoryAgent.cpp:
* inspector/InspectorTimelineAgent.cpp:
(WebCore):
(WebCore::InspectorTimelineAgent::setNativeHeapStatistics):
* platform/MemoryUsageSupport.cpp: Removed.
* platform/MemoryUsageSupport.h: Removed.
* platform/qt/MemoryUsageSupportQt.cpp: Removed.
2013-05-10 Ryosuke Niwa <rniwa@webkit.org>
REGRESSION (r149652): Videos do not play on cnn.com, just black box
......
......@@ -6144,8 +6144,6 @@ platform_sources += \
Source/WebCore/platform/Logging.h \
Source/WebCore/platform/MemoryPressureHandler.cpp \
Source/WebCore/platform/MemoryPressureHandler.h \
Source/WebCore/platform/MemoryUsageSupport.cpp \
Source/WebCore/platform/MemoryUsageSupport.h \
Source/WebCore/platform/NotImplemented.cpp \
Source/WebCore/platform/NotImplemented.h \
Source/WebCore/platform/RunLoop.cpp \
......
......@@ -1075,7 +1075,6 @@ SOURCES += \
platform/LinkHash.cpp \
platform/Logging.cpp \
platform/MemoryPressureHandler.cpp \
platform/qt/MemoryUsageSupportQt.cpp \
platform/MIMETypeRegistry.cpp \
platform/mock/DeviceMotionClientMock.cpp \
platform/mock/DeviceOrientationClientMock.cpp \
......@@ -2314,7 +2313,6 @@ HEADERS += \
platform/Logging.h \
platform/Language.h \
platform/MemoryPressureHandler.h \
platform/MemoryUsageSupport.h \
platform/MainThreadTask.h \
platform/MIMETypeRegistry.h \
platform/network/AuthenticationChallengeBase.h \
......
......@@ -29030,14 +29030,6 @@
RelativePath="..\platform\MemoryPressureHandler.h"
>
</File>
<File
RelativePath="..\platform\MemoryUsageSupport.cpp"
>
</File>
<File
RelativePath="..\platform\MemoryUsageSupport.h"
>
</File>
<File
RelativePath="..\platform\MainThreadTask.h"
>
......@@ -4109,7 +4109,6 @@
<ClCompile Include="..\platform\LocalizedStrings.cpp" />
<ClCompile Include="..\platform\Logging.cpp" />
<ClCompile Include="..\platform\MemoryPressureHandler.cpp" />
<ClCompile Include="..\platform\MemoryUsageSupport.cpp" />
<ClCompile Include="..\platform\MIMETypeRegistry.cpp" />
<ClCompile Include="..\platform\NotImplemented.cpp" />
<ClCompile Include="..\platform\PlatformEvent.cpp" />
......@@ -11565,7 +11564,6 @@
<ClInclude Include="..\platform\LocalizedStrings.h" />
<ClInclude Include="..\platform\Logging.h" />
<ClInclude Include="..\platform\MemoryPressureHandler.h" />
<ClInclude Include="..\platform\MemoryUsageSupport.h" />
<ClInclude Include="..\platform\MainThreadTask.h" />
<ClInclude Include="..\platform\MIMETypeRegistry.h" />
<ClInclude Include="..\platform\NotImplemented.h" />
......@@ -1161,9 +1161,6 @@
<ClCompile Include="..\platform\MemoryPressureHandler.cpp">
<Filter>platform</Filter>
</ClCompile>
<ClCompile Include="..\platform\MemoryUsageSupport.cpp">
<Filter>platform</Filter>
</ClCompile>
<ClCompile Include="..\platform\MIMETypeRegistry.cpp">
<Filter>platform</Filter>
</ClCompile>
......@@ -7959,9 +7956,6 @@
<ClInclude Include="..\platform\MemoryPressureHandler.h">
<Filter>platform</Filter>
</ClInclude>
<ClInclude Include="..\platform\MemoryUsageSupport.h">
<Filter>platform</Filter>
</ClInclude>
<ClInclude Include="..\platform\MainThreadTask.h">
<Filter>platform</Filter>
</ClInclude>
......
......@@ -5323,7 +5323,6 @@
D3D4E973130C7CFE007BA540 /* HTMLSummaryElement.h in Headers */ = {isa = PBXBuildFile; fileRef = D3D4E971130C7CFE007BA540 /* HTMLSummaryElement.h */; };
D619A307144E00BE004BC302 /* ChildListMutationScope.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D619A305144E00BE004BC302 /* ChildListMutationScope.cpp */; };
D619A308144E00BE004BC302 /* ChildListMutationScope.h in Headers */ = {isa = PBXBuildFile; fileRef = D619A306144E00BE004BC302 /* ChildListMutationScope.h */; };
D630E2AC149BF344005B2F95 /* MemoryUsageSupport.h in Headers */ = {isa = PBXBuildFile; fileRef = D630E2AB149BF344005B2F95 /* MemoryUsageSupport.h */; };
D630E2AC149BF344005B2F96 /* EventTracer.h in Headers */ = {isa = PBXBuildFile; fileRef = D630E2AB149BF344005B2F96 /* EventTracer.h */; };
D6489D25166FFCF1007C031B /* JSHTMLTemplateElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D6489D23166FFCF1007C031B /* JSHTMLTemplateElement.cpp */; };
D6489D26166FFCF1007C031B /* JSHTMLTemplateElement.h in Headers */ = {isa = PBXBuildFile; fileRef = D6489D24166FFCF1007C031B /* JSHTMLTemplateElement.h */; };
......@@ -5335,7 +5334,6 @@
D6E528A4149A926D00EFE1F3 /* MutationObserverInterestGroup.h in Headers */ = {isa = PBXBuildFile; fileRef = D6E528A2149A926D00EFE1F3 /* MutationObserverInterestGroup.h */; };
D6F7960D166FFECE0076DD18 /* JSHTMLTemplateElementCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D6F7960C166FFECE0076DD18 /* JSHTMLTemplateElementCustom.cpp */; };
D6FDAEF3149C06190037B1E1 /* HistogramSupport.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D6FDAEF2149C06190037B1E1 /* HistogramSupport.cpp */; };
D6FDAEF3149C06190037B1E3 /* MemoryUsageSupport.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D6FDAEF2149C06190037B1E3 /* MemoryUsageSupport.cpp */; };
D6FDAEF3149C06190037B1E4 /* EventTracer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D6FDAEF2149C06190037B1E4 /* EventTracer.cpp */; };
D70AD65713E1342B005B50B4 /* RenderRegion.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D70AD65513E1342B005B50B4 /* RenderRegion.cpp */; };
D70AD65813E1342B005B50B4 /* RenderRegion.h in Headers */ = {isa = PBXBuildFile; fileRef = D70AD65613E1342B005B50B4 /* RenderRegion.h */; };
......@@ -12106,7 +12104,6 @@
D619A305144E00BE004BC302 /* ChildListMutationScope.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ChildListMutationScope.cpp; sourceTree = "<group>"; };
D619A306144E00BE004BC302 /* ChildListMutationScope.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ChildListMutationScope.h; sourceTree = "<group>"; };
D630E2AB149BF344005B2F93 /* HistogramSupport.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HistogramSupport.h; sourceTree = "<group>"; };
D630E2AB149BF344005B2F95 /* MemoryUsageSupport.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MemoryUsageSupport.h; sourceTree = "<group>"; };
D630E2AB149BF344005B2F96 /* EventTracer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EventTracer.h; sourceTree = "<group>"; };
D6489D23166FFCF1007C031B /* JSHTMLTemplateElement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSHTMLTemplateElement.cpp; sourceTree = "<group>"; };
D6489D24166FFCF1007C031B /* JSHTMLTemplateElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSHTMLTemplateElement.h; sourceTree = "<group>"; };
......@@ -12119,7 +12116,6 @@
D6EFC0BD1666DF7A003D291E /* HTMLTemplateElement.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = HTMLTemplateElement.idl; sourceTree = "<group>"; };
D6F7960C166FFECE0076DD18 /* JSHTMLTemplateElementCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSHTMLTemplateElementCustom.cpp; sourceTree = "<group>"; };
D6FDAEF2149C06190037B1E1 /* HistogramSupport.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = HistogramSupport.cpp; sourceTree = "<group>"; };
D6FDAEF2149C06190037B1E3 /* MemoryUsageSupport.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MemoryUsageSupport.cpp; sourceTree = "<group>"; };
D6FDAEF2149C06190037B1E4 /* EventTracer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = EventTracer.cpp; sourceTree = "<group>"; };
D70AD65513E1342B005B50B4 /* RenderRegion.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RenderRegion.cpp; sourceTree = "<group>"; };
D70AD65613E1342B005B50B4 /* RenderRegion.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RenderRegion.h; sourceTree = "<group>"; };
......@@ -19350,8 +19346,6 @@
E187056216E54A0D00585E97 /* MainThreadTask.h */,
657EDA061385CB97004E0645 /* MemoryPressureHandler.cpp */,
657EDA071385CB97004E0645 /* MemoryPressureHandler.h */,
D6FDAEF2149C06190037B1E3 /* MemoryUsageSupport.cpp */,
D630E2AB149BF344005B2F95 /* MemoryUsageSupport.h */,
BC772C4C0C4EB3040083285F /* MIMETypeRegistry.cpp */,
BC772C4D0C4EB3040083285F /* MIMETypeRegistry.h */,
E1513D501677F08800149FCB /* NotImplemented.cpp */,
......@@ -22902,7 +22896,6 @@
BCB16C180979C3BD00467741 /* MemoryCache.h in Headers */,
9FFE3E7B11B59C5D0037874E /* MemoryInfo.h in Headers */,
6571DCC81385E6A400702DD0 /* MemoryPressureHandler.h in Headers */,
D630E2AC149BF344005B2F95 /* MemoryUsageSupport.h in Headers */,
93309DFA099E64920056E581 /* MergeIdenticalElementsCommand.h in Headers */,
E1ADECCE0E76AD8B004A1A5E /* MessageChannel.h in Headers */,
75793E840D0CE0B3007FC0AC /* MessageEvent.h in Headers */,
......@@ -26087,7 +26080,6 @@
9FFE3E7A11B59C5D0037874E /* MemoryInfo.cpp in Sources */,
657EDA081385CB97004E0645 /* MemoryPressureHandler.cpp in Sources */,
657EDA0B1385CBD8004E0645 /* MemoryPressureHandlerMac.mm in Sources */,
D6FDAEF3149C06190037B1E3 /* MemoryUsageSupport.cpp in Sources */,
93309DF9099E64920056E581 /* MergeIdenticalElementsCommand.cpp in Sources */,
E1ADECCF0E76AD8B004A1A5E /* MessageChannel.cpp in Sources */,
75793E830D0CE0B3007FC0AC /* MessageEvent.cpp in Sources */,
......@@ -45,7 +45,6 @@
#include "InspectorValues.h"
#include "InstrumentingAgents.h"
#include "MemoryCache.h"
#include "MemoryUsageSupport.h"
#include "Node.h"
#include "NodeTraversal.h"
#include "ScriptGCEvent.h"
......
......@@ -47,7 +47,6 @@
#include "InspectorState.h"
#include "InstrumentingAgents.h"
#include "IntRect.h"
#include "MemoryUsageSupport.h"
#include "RenderObject.h"
#include "RenderView.h"
#include "ResourceRequest.h"
......@@ -597,6 +596,7 @@ void InspectorTimelineAgent::setDOMCounters(TypeBuilder::Timeline::TimelineEvent
}
}
// FIXME: This entire function can probably be removed, since it's a no-op.
void InspectorTimelineAgent::setNativeHeapStatistics(TypeBuilder::Timeline::TimelineEvent* record)
{
if (!m_memoryAgent)
......@@ -604,10 +604,7 @@ void InspectorTimelineAgent::setNativeHeapStatistics(TypeBuilder::Timeline::Time
if (!m_state->getBoolean(TimelineAgentState::includeNativeMemoryStatistics))
return;
RefPtr<InspectorObject> stats = InspectorObject::create();
size_t privateBytes = 0;
size_t sharedBytes = 0;
MemoryUsageSupport::processMemorySizesInBytes(&privateBytes, &sharedBytes);
stats->setNumber("PrivateBytes", privateBytes);
stats->setNumber("PrivateBytes", 0);
record->setNativeHeapStatistics(stats.release());
}
......
/*
* Copyright (C) 2012 Google Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * 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.
* * Neither the name of Google Inc. nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT
* OWNER OR 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 "MemoryUsageSupport.h"
namespace WebCore {
int MemoryUsageSupport::memoryUsageMB()
{
return 0;
}
int MemoryUsageSupport::actualMemoryUsageMB()
{
return 0;
}
int MemoryUsageSupport::lowMemoryUsageMB()
{
return 0;
}
int MemoryUsageSupport::highMemoryUsageMB()
{
return 0;
}
int MemoryUsageSupport::highUsageDeltaMB()
{
return 0;
}
bool MemoryUsageSupport::processMemorySizesInBytes(size_t*, size_t*)
{
return false;
}
void MemoryUsageSupport::requestProcessMemorySizes(PassOwnPtr<WebCore::MemoryUsageSupport::ProcessMemorySizesCallback>)
{
}
void MemoryUsageSupport::memoryUsageByComponents(Vector<ComponentInfo>&)
{
}
} // namespace WebCore
/*
* Copyright (C) 2012 Google Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * 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.
* * Neither the name of Google Inc. nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT
* OWNER OR 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.
*/
#ifndef MemoryUsageSupport_h
#define MemoryUsageSupport_h
#include <wtf/Forward.h>
#include <wtf/PassOwnPtr.h>
#include <wtf/text/WTFString.h>
namespace WebCore {
class MemoryUsageSupport {
public:
// Returns the current space allocated for the pagefile, in MB.
// That is committed size for Windows and virtual memory size for POSIX.
static int memoryUsageMB();
// Same as above, but always returns actual value, without any
// caches.
static int actualMemoryUsageMB();
// If memory usage is below this threshold, do not bother forcing GC.
static int lowMemoryUsageMB();
// If memory usage is above this threshold, force GC more aggressively.
static int highMemoryUsageMB();
// Delta of memory usage growth (vs. last actualMemoryUsageMB())
// to force GC when memory usage is high.
static int highUsageDeltaMB();
// Returns private and shared usage, in bytes. Private bytes is the amount of
// memory currently allocated to this process that cannot be shared. Returns
// false on platform specific error conditions.
static bool processMemorySizesInBytes(size_t* privateBytes, size_t* sharedBytes);
// A callback for requestProcessMemorySizes
class ProcessMemorySizesCallback {
public:
virtual ~ProcessMemorySizesCallback() { }
virtual void dataReceived(size_t privateBytes, size_t sharedBytes) = 0;
};
// Requests private and shared usage, in bytes. Private bytes is the amount of
// memory currently allocated to this process that cannot be shared.
static void requestProcessMemorySizes(PassOwnPtr<ProcessMemorySizesCallback> requestCallback);
class ComponentInfo {
public:
ComponentInfo(const String& name, size_t size) : m_name(name), m_sizeInBytes(size) { }
const String m_name;
size_t m_sizeInBytes;
};
// Reports private memory used by components in bytes.
static void memoryUsageByComponents(Vector<ComponentInfo>&);
};
} // namespace WebCore
#endif // MemoryUsageSupport_h
/*
* Copyright (C) 2012 Google Inc. All rights reserved.
* (C) 2012 Nokia Corporation and/or its subsidiary(-ies)
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#include "config.h"
#include "MemoryUsageSupport.h"
#include "JSDOMWindow.h"
#include <runtime/MemoryStatistics.h>
#include <wtf/FastMalloc.h>
#if OS(LINUX)
#include <malloc.h>
#endif
namespace WebCore {
#if OS(LINUX)
static size_t mallocMemoryUsage(bool inuse)
{
// Return how much memory (in bytes) has been allocated on the system heap.
struct mallinfo minfo = ::mallinfo();
// If we want the internal memory usage, we subtract the memory used by
// free blocks. That is memory allocated from the system by malloc but
// which malloc considers free.
return minfo.arena - (inuse ? minfo.fordblks : 0);
}
#else
static size_t mallocMemoryUsage(bool)
{
// FIXME: Implement for other supported OS's.
return 0;
}
#endif
// This is how much system-memory we use.
static int memoryUsageKB()
{
size_t mallocUsage = mallocMemoryUsage(false);
WTF::FastMallocStatistics fmStats = WTF::fastMallocStatistics();
// Extract memory statistics from JavaScriptCore:
JSC::GlobalMemoryStatistics jscStats = JSC::globalMemoryStatistics();
size_t jscHeapUsage = JSDOMWindow::commonVM()->heap.capacity();
return (mallocUsage + fmStats.committedVMBytes + jscStats.stackBytes + jscStats.JITBytes + jscHeapUsage) >> 10;
}
// This is how much memory we use internally, not including memory only reserved from the system.
static int actualMemoryUsageKB()
{
size_t mallocUsage = mallocMemoryUsage(true);
WTF::FastMallocStatistics fmStats = WTF::fastMallocStatistics();
// Extract memory statistics from JavaScriptCore:
JSC::GlobalMemoryStatistics jscStats = JSC::globalMemoryStatistics();
size_t jscHeapUsage = JSDOMWindow::commonVM()->heap.size();
return (mallocUsage + fmStats.committedVMBytes - fmStats.freeListBytes + jscStats.stackBytes + jscStats.JITBytes + jscHeapUsage) >> 10;
}
int MemoryUsageSupport::memoryUsageMB()
{
return memoryUsageKB() >> 10;
}
int MemoryUsageSupport::actualMemoryUsageMB()
{
return actualMemoryUsageKB() >> 10;
}
// FIXME: These values should be determined based on hardware or set by the application.
static const unsigned normalMemoryWatermark = 128; // Chromium default: 256
static const unsigned highMemoryWatermark = 256; // Chromium default: 1024
static const unsigned highMemoryDelta = 64; // Chromium default: 128
int MemoryUsageSupport::lowMemoryUsageMB()
{
return normalMemoryWatermark;
}
int MemoryUsageSupport::highMemoryUsageMB()
{
return highMemoryWatermark;
}
int MemoryUsageSupport::highUsageDeltaMB()
{
return highMemoryDelta;
}
bool MemoryUsageSupport::processMemorySizesInBytes(size_t*, size_t*)
{
// FIXME: Not implemented.
return false;
}
void MemoryUsageSupport::requestProcessMemorySizes(PassOwnPtr<WebCore::MemoryUsageSupport::ProcessMemorySizesCallback> requestCallback)
{
// FIXME: Not implemented.
}
void MemoryUsageSupport::memoryUsageByComponents(Vector<ComponentInfo>&)
{
}
} // namespace WebCore
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment