summaryrefslogtreecommitdiffstats
path: root/chrome/browser/bookmarks/bookmark_storage.cc
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/browser/bookmarks/bookmark_storage.cc')
-rw-r--r--chrome/browser/bookmarks/bookmark_storage.cc20
1 files changed, 20 insertions, 0 deletions
diff --git a/chrome/browser/bookmarks/bookmark_storage.cc b/chrome/browser/bookmarks/bookmark_storage.cc
index 7df18cd..e237d66 100644
--- a/chrome/browser/bookmarks/bookmark_storage.cc
+++ b/chrome/browser/bookmarks/bookmark_storage.cc
@@ -6,6 +6,7 @@
#include "base/compiler_specific.h"
#include "base/file_util.h"
+#include "base/histogram.h"
#include "base/json_writer.h"
#include "base/message_loop.h"
#include "base/thread.h"
@@ -19,6 +20,8 @@
#include "chrome/common/notification_source.h"
#include "chrome/common/notification_type.h"
+using base::TimeTicks;
+
namespace {
// Extension used for backup files (copy of main file created during startup).
@@ -193,8 +196,16 @@ void BookmarkStorage::OnLoadFinished(bool file_exists, const FilePath& path,
return;
if (root_value) {
+ TimeTicks start_time = TimeTicks::Now();
BookmarkCodec codec;
codec.Decode(model_, *root_value);
+ UMA_HISTOGRAM_TIMES("Bookmarks.DecodeTime",
+ TimeTicks::Now() - start_time);
+
+ start_time = TimeTicks::Now();
+ AddBookmarksToIndex(model_->root_node());
+ UMA_HISTOGRAM_TIMES("Bookmarks.CreatebookmarkIndexTime",
+ TimeTicks::Now() - start_time);
}
model_->DoneLoading();
@@ -246,3 +257,12 @@ void BookmarkStorage::RunTaskOnBackendThread(Task* task) const {
delete task;
}
}
+
+void BookmarkStorage::AddBookmarksToIndex(BookmarkNode* node) {
+ if (node->is_url()) {
+ model_->index_.Add(node);
+ } else {
+ for (int i = 0; i < node->GetChildCount(); ++i)
+ AddBookmarksToIndex(node->GetChild(i));
+ }
+}