Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(262)

Unified Diff: components/enhanced_bookmarks/test_image_store.cc

Issue 305963004: Add GetStoreSize() to ImageStore to know the actual db size. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: size += bitmap.getSize(); Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « components/enhanced_bookmarks/test_image_store.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/enhanced_bookmarks/test_image_store.cc
diff --git a/components/enhanced_bookmarks/test_image_store.cc b/components/enhanced_bookmarks/test_image_store.cc
index c96f3cfcb75c5bb014c2c05b39eaab9edc3b299b..19d505ff650a80fd065418a0dc881c38df960949 100644
--- a/components/enhanced_bookmarks/test_image_store.cc
+++ b/components/enhanced_bookmarks/test_image_store.cc
@@ -4,6 +4,7 @@
#include "components/enhanced_bookmarks/test_image_store.h"
+#include "third_party/skia/include/core/SkBitmap.h"
#include "ui/gfx/geometry/size.h"
#include "url/gurl.h"
@@ -68,6 +69,21 @@ void TestImageStore::ClearAll() {
store_.clear();
}
+int64 TestImageStore::GetStoreSizeInBytes() {
+ // Not 100% accurate, but it's for testing so the actual value is not
+ // important.
+ int64 size = sizeof(store_);
+ for (ImageMap::const_iterator it = store_.begin(); it != store_.end(); ++it) {
+ size += sizeof(it->first);
+ size += it->first.spec().length();
+ size += sizeof(it->second);
+ SkBitmap bitmap = it->second.first.AsBitmap();
+ size += bitmap.getSize();
+ size += it->second.second.spec().length();
+ }
+ return size;
+}
+
TestImageStore::~TestImageStore() {
DCHECK(sequence_checker_.CalledOnValidSequencedThread());
}
« no previous file with comments | « components/enhanced_bookmarks/test_image_store.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698