diff options
author | antonm@chromium.org <antonm@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-09-01 09:26:32 +0000 |
---|---|---|
committer | antonm@chromium.org <antonm@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-09-01 09:26:32 +0000 |
commit | aceb071dc7168831838168506871c1aa828998cb (patch) | |
tree | f82d95291d713b6f339b04f6704660142d5b5b8f | |
parent | 93b465b434ab417046575d30a09da35819768bc6 (diff) | |
download | chromium_src-aceb071dc7168831838168506871c1aa828998cb.zip chromium_src-aceb071dc7168831838168506871c1aa828998cb.tar.gz chromium_src-aceb071dc7168831838168506871c1aa828998cb.tar.bz2 |
Introduce a flag to bypass the cache when retrieving current memory usage.
We need the most fresh value when giving an estimate to current working set, for
example, after major GC in V8 happened.
Review URL: http://codereview.chromium.org/3285003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@58153 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | webkit/glue/webkitclient_impl.cc | 5 | ||||
-rw-r--r-- | webkit/glue/webkitclient_impl.h | 2 |
2 files changed, 4 insertions, 3 deletions
diff --git a/webkit/glue/webkitclient_impl.cc b/webkit/glue/webkitclient_impl.cc index 70be0f3..5bfd43a5 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() { +size_t WebKitClientImpl::memoryUsageMB(bool no_cache) { size_t current_mem_usage = 0; MemoryUsageCache* mem_usage_cache_singleton = MemoryUsageCache::Get(); - if (mem_usage_cache_singleton->IsCachedValueValid(¤t_mem_usage)) + if (!no_cache + && mem_usage_cache_singleton->IsCachedValueValid(¤t_mem_usage)) return current_mem_usage; current_mem_usage = diff --git a/webkit/glue/webkitclient_impl.h b/webkit/glue/webkitclient_impl.h index 8c0cfa3..2d446f4 100644 --- a/webkit/glue/webkitclient_impl.h +++ b/webkit/glue/webkitclient_impl.h @@ -34,7 +34,7 @@ class WebKitClientImpl : public WebKit::WebKitClient { virtual WebKit::WebString signedPublicKeyAndChallengeString( unsigned key_size_index, const WebKit::WebString& challenge, const WebKit::WebURL& url); - virtual size_t memoryUsageMB(); + virtual size_t memoryUsageMB(bool no_cache = false); virtual WebKit::WebURLLoader* createURLLoader(); virtual WebKit::WebSocketStreamHandle* createSocketStreamHandle(); virtual WebKit::WebString userAgent(const WebKit::WebURL& url); |