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

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

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.h
diff --git a/chrome/browser/bookmarks/bookmark_model.h b/chrome/browser/bookmarks/bookmark_model.h
index 1f0cf7b793032ce4608c0791dac2461a908c834a..bb7096fade657614b692e89f51034f53d1a4dde7 100644
--- a/chrome/browser/bookmarks/bookmark_model.h
+++ b/chrome/browser/bookmarks/bookmark_model.h
@@ -10,6 +10,7 @@
#include "base/basictypes.h"
#include "base/compiler_specific.h"
+#include "base/deferred_sequenced_task_runner.h"
#include "base/memory/ref_counted.h"
#include "base/memory/scoped_ptr.h"
#include "base/observer_list.h"
@@ -238,6 +239,11 @@ class BookmarkModel : public content::NotificationObserver,
// BookmarkModel. You need not invoke this directly.
void Load();
+ // Starts loading the bookmarks. This is decoupled from Load, giving the
+ // caller the possibility to start loading the bookmarks after the
+ // creation of the BookmarkModel.
+ void StartLoading();
+
// Returns true if the model finished loading.
// This is virtual so it can be mocked.
virtual bool IsLoaded() const;
@@ -484,6 +490,10 @@ class BookmarkModel : public content::NotificationObserver,
// delete the returned object.
BookmarkLoadDetails* CreateLoadDetails();
+ // Returns sequenced task runner where all bookmarks I/O operations are
+ // performed.
+ scoped_refptr<base::DeferredSequencedTaskRunner> GetBookmarkTaskRunner();
+
content::NotificationRegistrar registrar_;
Profile* profile_;
@@ -528,6 +538,8 @@ class BookmarkModel : public content::NotificationObserver,
scoped_ptr<BookmarkExpandedStateTracker> expanded_state_tracker_;
+ scoped_refptr<base::DeferredSequencedTaskRunner> bookmark_task_runner_;
+
DISALLOW_COPY_AND_ASSIGN(BookmarkModel);
};

Powered by Google App Engine
This is Rietveld 408576698