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

Unified Diff: chrome/browser/bookmarks/bookmark_model.cc

Issue 12952005: Delay bookmarks load while the profile is loading. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address mirandac's comments: add BookmarkModel::StartLoading Created 7 years, 9 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: chrome/browser/bookmarks/bookmark_model.cc
diff --git a/chrome/browser/bookmarks/bookmark_model.cc b/chrome/browser/bookmarks/bookmark_model.cc
index 52533b4c2be72210353f7fc5c17cb7d33441eae5..e7b3bb1f698bc5214112b3bdff1efdd72e3d801a 100644
--- a/chrome/browser/bookmarks/bookmark_model.cc
+++ b/chrome/browser/bookmarks/bookmark_model.cc
@@ -9,6 +9,7 @@
#include "base/bind.h"
#include "base/bind_helpers.h"
+#include "base/deferred_sequenced_task_runner.h"
#include "base/json/json_string_value_serializer.h"
#include "base/sequenced_task_runner.h"
#include "base/string_util.h"
@@ -250,10 +251,14 @@ void BookmarkModel::Load() {
content::Source<Profile>(profile_));
// Load the bookmarks. BookmarkStorage notifies us when done.
- store_ = new BookmarkStorage(profile_, this, profile_->GetIOTaskRunner());
+ store_ = new BookmarkStorage(profile_, this, GetBookmarkTaskRunner());
store_->LoadBookmarks(CreateLoadDetails());
}
+void BookmarkModel::StartLoading() {
+ GetBookmarkTaskRunner()->Start();
+}
+
bool BookmarkModel::IsLoaded() const {
return loaded_;
}
@@ -961,3 +966,12 @@ BookmarkLoadDetails* BookmarkModel::CreateLoadDetails() {
new BookmarkIndex(profile_),
next_node_id_);
}
+
+scoped_refptr<base::DeferredSequencedTaskRunner>
+ BookmarkModel::GetBookmarkTaskRunner() {
+ if (!bookmark_task_runner_) {
+ bookmark_task_runner_ =
+ new base::DeferredSequencedTaskRunner(profile_->GetIOTaskRunner());
tfarina 2013/03/28 22:57:01 Can we do something similar to |blocking_task_runn
msarda 2013/03/29 14:40:03 I think so. We should probably have a similar star
+ }
+ return bookmark_task_runner_;
+}

Powered by Google App Engine
This is Rietveld 408576698