diff options
author | alexeif@chromium.org <alexeif@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-07-24 15:12:44 +0000 |
---|---|---|
committer | alexeif@chromium.org <alexeif@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-07-24 15:12:44 +0000 |
commit | 4990299ded0cd00c29f5f59e4aa34ccd23414216 (patch) | |
tree | 976e3cbfd23bf8b3eb69db55bd6a677ad049ca12 | |
parent | c83f3fada5760e9b6ad065a3892127c5fdb00cb6 (diff) | |
download | chromium_src-4990299ded0cd00c29f5f59e4aa34ccd23414216.zip chromium_src-4990299ded0cd00c29f5f59e4aa34ccd23414216.tar.gz chromium_src-4990299ded0cd00c29f5f59e4aa34ccd23414216.tar.bz2 |
Web Inspector: count DOM storage cache memory for native snapshot
Review URL: https://chromiumcodereview.appspot.com/10799008
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@148108 0039d316-1c4b-4281-b951-d872f2087c98
4 files changed, 12 insertions, 1 deletions
diff --git a/content/renderer/dom_storage/webstoragearea_impl.cc b/content/renderer/dom_storage/webstoragearea_impl.cc index 633f7a3..1b16cfc 100644 --- a/content/renderer/dom_storage/webstoragearea_impl.cc +++ b/content/renderer/dom_storage/webstoragearea_impl.cc @@ -76,3 +76,7 @@ void WebStorageAreaImpl::removeItem( void WebStorageAreaImpl::clear(const WebURL& page_url) { cached_area_->Clear(connection_id_, page_url); } + +size_t WebStorageAreaImpl::memoryBytesUsedByCache() const { + return cached_area_->MemoryBytesUsedByCache(); +} diff --git a/content/renderer/dom_storage/webstoragearea_impl.h b/content/renderer/dom_storage/webstoragearea_impl.h index aff5e6e..2d16ba6 100644 --- a/content/renderer/dom_storage/webstoragearea_impl.h +++ b/content/renderer/dom_storage/webstoragearea_impl.h @@ -33,6 +33,7 @@ class WebStorageAreaImpl : public WebKit::WebStorageArea { virtual void removeItem( const WebKit::WebString& key, const WebKit::WebURL& page_url); virtual void clear(const WebKit::WebURL& url); + virtual size_t memoryBytesUsedByCache() const; private: int connection_id_; diff --git a/webkit/dom_storage/dom_storage_cached_area.cc b/webkit/dom_storage/dom_storage_cached_area.cc index 6dfd1e5..544d1a0 100644 --- a/webkit/dom_storage/dom_storage_cached_area.cc +++ b/webkit/dom_storage/dom_storage_cached_area.cc @@ -131,6 +131,10 @@ void DomStorageCachedArea::ApplyMutation( map_->set_quota(dom_storage::kPerAreaQuota); } +size_t DomStorageCachedArea::MemoryBytesUsedByCache() const { + return map_ ? map_->bytes_used() : 0; +} + void DomStorageCachedArea::Prime(int connection_id) { DCHECK(!map_); diff --git a/webkit/dom_storage/dom_storage_cached_area.h b/webkit/dom_storage/dom_storage_cached_area.h index fb6df40..fc1968e 100644 --- a/webkit/dom_storage/dom_storage_cached_area.h +++ b/webkit/dom_storage/dom_storage_cached_area.h @@ -18,7 +18,7 @@ class DomStorageMap; class DomStorageProxy; // Unlike the other classes in the dom_storage library, this one is intended -// for use in renderer processes. It maintains a complete cach of the an +// for use in renderer processes. It maintains a complete cache of the // origin's Map of key/value pairs for fast access. The cache is primed on // first access and changes are written to the backend thru the |proxy|. // Mutations originating in other processes are applied to the cache via @@ -43,6 +43,8 @@ class DomStorageCachedArea : public base::RefCounted<DomStorageCachedArea> { void ApplyMutation(const NullableString16& key, const NullableString16& new_value); + size_t MemoryBytesUsedByCache() const; + private: friend class DomStorageCachedAreaTest; friend class base::RefCounted<DomStorageCachedArea>; |