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

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

Issue 2881143002: Switch BookmarkFaviconFetcher to the TaskScheduler API. (Closed)
Patch Set: Switch to a SingleThreadTaskRunner Created 3 years, 7 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/bookmarks/bookmark_html_writer.cc
diff --git a/chrome/browser/bookmarks/bookmark_html_writer.cc b/chrome/browser/bookmarks/bookmark_html_writer.cc
index 5bfecb94303cda68a4b3810baf2c4e3b257a93fe..f9027cd9e271b4a16179576920c595dde3c7407d 100644
--- a/chrome/browser/bookmarks/bookmark_html_writer.cc
+++ b/chrome/browser/bookmarks/bookmark_html_writer.cc
@@ -19,6 +19,7 @@
#include "base/single_thread_task_runner.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_util.h"
+#include "base/task_scheduler/post_task.h"
#include "base/threading/thread_task_runner_handle.h"
#include "base/time/time.h"
#include "base/values.h"
@@ -449,8 +450,12 @@ void BookmarkFaviconFetcher::ExecuteWriter() {
// for the duration of the write), as such we make a copy of the
// BookmarkModel using BookmarkCodec then write from that.
BookmarkCodec codec;
- BrowserThread::PostTask(
- BrowserThread::FILE, FROM_HERE,
+ // TODO(https://crbug.com/676387) make this sequenced when 676387 is fixed.
+ scoped_refptr<base::SingleThreadTaskRunner> task_runner_ =
sky 2017/05/22 16:40:46 Forgive my ignorance, but what happens if ExecuteW
Sébastien Marchand 2017/05/22 17:19:17 +fdoray@/robliao@ as I'm not entirely sure, one so
robliao 2017/05/22 17:27:25 As coded here, if ExecuteRunner is executed twice
sky 2017/05/22 17:33:55 While likely rare, we should make sure there aren'
Sébastien Marchand 2017/05/23 16:56:48 One way to do this would be to add a SequencedTask
gab 2017/05/23 17:17:00 I agree with sky that although there's only one ca
+ base::CreateSingleThreadTaskRunnerWithTraits(
+ {base::MayBlock(), base::TaskPriority::BACKGROUND});
+ task_runner_->PostTask(
+ FROM_HERE,
base::BindOnce(
&Writer::DoWrite,
new Writer(codec.Encode(
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698