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

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

Issue 2881143002: Switch BookmarkFaviconFetcher to the TaskScheduler API. (Closed)
Patch Set: Remove useless include Created 3 years, 5 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
« no previous file with comments | « no previous file | chrome/browser/bookmarks/bookmark_html_writer.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/bookmarks/bookmark_html_writer.h
diff --git a/chrome/browser/bookmarks/bookmark_html_writer.h b/chrome/browser/bookmarks/bookmark_html_writer.h
index ed8ae816ecb175dbc8dd1b440d56f677b0300f1e..bb0c87f3accb4598e440e25bd5039c99a3c9d845 100644
--- a/chrome/browser/bookmarks/bookmark_html_writer.h
+++ b/chrome/browser/bookmarks/bookmark_html_writer.h
@@ -14,6 +14,7 @@
#include "base/memory/ref_counted.h"
#include "base/memory/ref_counted_memory.h"
#include "base/task/cancelable_task_tracker.h"
+#include "base/task_scheduler/post_task.h"
#include "components/favicon_base/favicon_types.h"
#include "content/public/browser/notification_observer.h"
#include "content/public/browser/notification_registrar.h"
@@ -73,7 +74,7 @@ class BookmarkFaviconFetcher: public content::NotificationObserver {
bool FetchNextFavicon();
// Favicon fetch callback. After all favicons are fetched executes
- // html output on the file thread.
+ // html output with |background_io_task_runner_|.
void OnFaviconDataAvailable(
const favicon_base::FaviconRawBitmapResult& bitmap_result);
@@ -97,14 +98,17 @@ class BookmarkFaviconFetcher: public content::NotificationObserver {
content::NotificationRegistrar registrar_;
+ scoped_refptr<base::SequencedTaskRunner> background_io_task_runner_ =
+ base::CreateSequencedTaskRunnerWithTraits(
+ {base::MayBlock(), base::TaskPriority::BACKGROUND});
+
DISALLOW_COPY_AND_ASSIGN(BookmarkFaviconFetcher);
};
namespace bookmark_html_writer {
// Writes the bookmarks out in the 'bookmarks.html' format understood by
-// Firefox and IE. The results are written to the file at |path|. The file
-// thread is used.
+// Firefox and IE. The results are written asynchronously to the file at |path|.
// Before writing to the file favicons are fetched on the main thread.
// TODO(sky): need a callback on failure.
void WriteBookmarks(Profile* profile,
« no previous file with comments | « no previous file | chrome/browser/bookmarks/bookmark_html_writer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698