summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorantonm@chromium.org <antonm@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-09-08 10:19:54 +0000
committerantonm@chromium.org <antonm@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-09-08 10:19:54 +0000
commitc65f07debbaf0dde8de015591cb6386f0859b1a8 (patch)
tree21c2ecbf73f5af7e258806c63307c44dddc1ebc9
parent429c909dcdb6ce422e4d16870a63deb34f729596 (diff)
downloadchromium_src-c65f07debbaf0dde8de015591cb6386f0859b1a8.zip
chromium_src-c65f07debbaf0dde8de015591cb6386f0859b1a8.tar.gz
chromium_src-c65f07debbaf0dde8de015591cb6386f0859b1a8.tar.bz2
Implement on Chromium side recently added actualMemoryUsageMB.
This new method is needed in the cases when stale values from caches are not acceptable, for example, when estimating an effect of GC on working set of the app. Review URL: http://codereview.chromium.org/3294010 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@58808 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--webkit/glue/webkitclient_impl.cc13
-rw-r--r--webkit/glue/webkitclient_impl.h1
2 files changed, 12 insertions, 2 deletions
diff --git a/webkit/glue/webkitclient_impl.cc b/webkit/glue/webkitclient_impl.cc
index 70be0f3..c65d176 100644
--- a/webkit/glue/webkitclient_impl.cc
+++ b/webkit/glue/webkitclient_impl.cc
@@ -424,10 +424,11 @@ static size_t memoryUsageMBGeneric() {
}
#endif
-size_t WebKitClientImpl::memoryUsageMB() {
+static size_t getMemoryUsageMB(bool bypass_cache) {
size_t current_mem_usage = 0;
MemoryUsageCache* mem_usage_cache_singleton = MemoryUsageCache::Get();
- if (mem_usage_cache_singleton->IsCachedValueValid(&current_mem_usage))
+ if (!bypass_cache &&
+ mem_usage_cache_singleton->IsCachedValueValid(&current_mem_usage))
return current_mem_usage;
current_mem_usage =
@@ -442,6 +443,14 @@ size_t WebKitClientImpl::memoryUsageMB() {
return current_mem_usage;
}
+size_t WebKitClientImpl::memoryUsageMB() {
+ return getMemoryUsageMB(false);
+}
+
+size_t WebKitClientImpl::actualMemoryUsageMB() {
+ return getMemoryUsageMB(true);
+}
+
void WebKitClientImpl::SuspendSharedTimer() {
++shared_timer_suspended_;
}
diff --git a/webkit/glue/webkitclient_impl.h b/webkit/glue/webkitclient_impl.h
index 8c0cfa3..607677f 100644
--- a/webkit/glue/webkitclient_impl.h
+++ b/webkit/glue/webkitclient_impl.h
@@ -35,6 +35,7 @@ class WebKitClientImpl : public WebKit::WebKitClient {
unsigned key_size_index, const WebKit::WebString& challenge,
const WebKit::WebURL& url);
virtual size_t memoryUsageMB();
+ virtual size_t actualMemoryUsageMB();
virtual WebKit::WebURLLoader* createURLLoader();
virtual WebKit::WebSocketStreamHandle* createSocketStreamHandle();
virtual WebKit::WebString userAgent(const WebKit::WebURL& url);