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

Unified Diff: components/enhanced_bookmarks/persistent_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: 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
Index: components/enhanced_bookmarks/persistent_image_store.cc
diff --git a/components/enhanced_bookmarks/persistent_image_store.cc b/components/enhanced_bookmarks/persistent_image_store.cc
index 5e42f3528aa8e3358d36b25b099999397b8b4fc3..73d920433c4b1f6cb4f1e5dcdba5bd1ffd3df67e 100644
--- a/components/enhanced_bookmarks/persistent_image_store.cc
+++ b/components/enhanced_bookmarks/persistent_image_store.cc
@@ -4,6 +4,7 @@
#include "components/enhanced_bookmarks/persistent_image_store.h"
+#include "base/files/file.h"
#include "components/enhanced_bookmarks/image_store_util.h"
#include "sql/statement.h"
#include "sql/transaction.h"
@@ -197,6 +198,15 @@ void PersistentImageStore::ClearAll() {
statement.Run();
}
+int64 PersistentImageStore::GetStoreSize() {
+ // Ensure that the db is actually valid.
+ if (OpenDatabase() != sql::INIT_OK)
sky 2014/05/29 21:51:05 Do you really need to open the db here?
Kibeom Kim (inactive) 2014/05/29 23:07:15 Done.
+ return -1;
+
+ return base::File(path_, base::File::FLAG_OPEN | base::File::FLAG_READ).
+ GetLength();
+}
+
PersistentImageStore::~PersistentImageStore() {
DCHECK(sequence_checker_.CalledOnValidSequencedThread());
}

Powered by Google App Engine
This is Rietveld 408576698