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

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: Fix nits. 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..f74602b74eb41809679d763472c396d70deabd47 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"
@@ -233,6 +234,15 @@ void BookmarkModel::Shutdown() {
loaded_signal_.Signal();
}
+scoped_refptr<base::DeferredSequencedTaskRunner>
+ BookmarkModel::GetBookmarkTaskRunner() {
+ if (!bookmark_task_runner_) {
+ bookmark_task_runner_ =
+ new base::DeferredSequencedTaskRunner(profile_->GetIOTaskRunner());
+ }
+ return bookmark_task_runner_;
+}
+
void BookmarkModel::Load() {
if (store_.get()) {
// If the store is non-null, it means Load was already invoked. Load should
@@ -250,7 +260,7 @@ 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());
}

Powered by Google App Engine
This is Rietveld 408576698