summaryrefslogtreecommitdiffstats
path: root/chrome/browser/bookmarks
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/browser/bookmarks')
-rw-r--r--chrome/browser/bookmarks/DEPS2
-rw-r--r--chrome/browser/bookmarks/bookmark_model.cc5
-rw-r--r--chrome/browser/bookmarks/bookmark_model.h7
-rw-r--r--chrome/browser/bookmarks/bookmark_model_factory.cc6
4 files changed, 16 insertions, 4 deletions
diff --git a/chrome/browser/bookmarks/DEPS b/chrome/browser/bookmarks/DEPS
index 104e900..4c3d5ac 100644
--- a/chrome/browser/bookmarks/DEPS
+++ b/chrome/browser/bookmarks/DEPS
@@ -22,6 +22,8 @@ include_rules = [
"!chrome/browser/profiles/profile_dependency_manager.h",
"!chrome/browser/profiles/profile_keyed_service.h",
"!chrome/browser/profiles/profile_keyed_service_factory.h",
+ "!chrome/browser/profiles/startup_task_runner_service.h",
+ "!chrome/browser/profiles/startup_task_runner_service_factory.h",
# Do not add to the list of temporarily-allowed dependencies above,
# and please do not introduce more #includes of these files.
]
diff --git a/chrome/browser/bookmarks/bookmark_model.cc b/chrome/browser/bookmarks/bookmark_model.cc
index 150afd4..d23f645 100644
--- a/chrome/browser/bookmarks/bookmark_model.cc
+++ b/chrome/browser/bookmarks/bookmark_model.cc
@@ -232,7 +232,8 @@ void BookmarkModel::Shutdown() {
loaded_signal_.Signal();
}
-void BookmarkModel::Load() {
+void BookmarkModel::Load(
+ const scoped_refptr<base::SequencedTaskRunner>& task_runner) {
if (store_.get()) {
// If the store is non-null, it means Load was already invoked. Load should
// only be invoked once.
@@ -249,7 +250,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, task_runner);
store_->LoadBookmarks(CreateLoadDetails());
}
diff --git a/chrome/browser/bookmarks/bookmark_model.h b/chrome/browser/bookmarks/bookmark_model.h
index 1d846d7..9853d38 100644
--- a/chrome/browser/bookmarks/bookmark_model.h
+++ b/chrome/browser/bookmarks/bookmark_model.h
@@ -33,6 +33,10 @@ class BookmarkModelObserver;
class BookmarkStorage;
class Profile;
+namespace base {
+class SequencedTaskRunner;
+}
+
namespace bookmark_utils {
struct TitleMatch;
}
@@ -236,7 +240,8 @@ class BookmarkModel : public content::NotificationObserver,
// Loads the bookmarks. This is called upon creation of the
// BookmarkModel. You need not invoke this directly.
- void Load();
+ // All load operations will be executed on |task_runner|.
+ void Load(const scoped_refptr<base::SequencedTaskRunner>& task_runner);
// Returns true if the model finished loading.
// This is virtual so it can be mocked.
diff --git a/chrome/browser/bookmarks/bookmark_model_factory.cc b/chrome/browser/bookmarks/bookmark_model_factory.cc
index 1f63b6d..73da8cb 100644
--- a/chrome/browser/bookmarks/bookmark_model_factory.cc
+++ b/chrome/browser/bookmarks/bookmark_model_factory.cc
@@ -4,11 +4,14 @@
#include "chrome/browser/bookmarks/bookmark_model_factory.h"
+#include "base/deferred_sequenced_task_runner.h"
#include "base/memory/singleton.h"
#include "base/values.h"
#include "chrome/browser/bookmarks/bookmark_model.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/profiles/profile_dependency_manager.h"
+#include "chrome/browser/profiles/startup_task_runner_service.h"
+#include "chrome/browser/profiles/startup_task_runner_service_factory.h"
#include "chrome/common/pref_names.h"
#include "components/user_prefs/pref_registry_syncable.h"
@@ -38,7 +41,8 @@ BookmarkModelFactory::~BookmarkModelFactory() {}
ProfileKeyedService* BookmarkModelFactory::BuildServiceInstanceFor(
Profile* profile) const {
BookmarkModel* bookmark_model = new BookmarkModel(profile);
- bookmark_model->Load();
+ bookmark_model->Load(StartupTaskRunnerServiceFactory::GetForProfile(profile)->
+ GetBookmarkTaskRunner());
return bookmark_model;
}