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

Unified Diff: chrome/common/important_file_writer.cc

Issue 10344007: Use worker pool for IO in JsonPrefStore. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 8 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 | « chrome/common/important_file_writer.h ('k') | chrome/common/json_pref_store.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/common/important_file_writer.cc
diff --git a/chrome/common/important_file_writer.cc b/chrome/common/important_file_writer.cc
index 6a76dfbb362b83776d0c8f37e0d2bc5176e039df..fe225128effaa10c0dc43cb1a443a5e44440e3bd 100644
--- a/chrome/common/important_file_writer.cc
+++ b/chrome/common/important_file_writer.cc
@@ -89,14 +89,15 @@ void WriteToDiskTask(const FilePath& path, const std::string& data) {
} // namespace
ImportantFileWriter::ImportantFileWriter(
- const FilePath& path, base::MessageLoopProxy* file_message_loop_proxy)
- : path_(path),
- file_message_loop_proxy_(file_message_loop_proxy),
- serializer_(NULL),
- commit_interval_(TimeDelta::FromMilliseconds(
- kDefaultCommitIntervalMs)) {
+ const FilePath& path,
+ base::SequencedTaskRunner* blocking_task_runner)
+ : path_(path),
+ blocking_task_runner_(blocking_task_runner),
+ serializer_(NULL),
+ commit_interval_(TimeDelta::FromMilliseconds(
+ kDefaultCommitIntervalMs)) {
DCHECK(CalledOnValidThread());
- DCHECK(file_message_loop_proxy_.get());
+ DCHECK(blocking_task_runner_.get());
}
ImportantFileWriter::~ImportantFileWriter() {
@@ -121,7 +122,7 @@ void ImportantFileWriter::WriteNow(const std::string& data) {
if (HasPendingWrite())
timer_.Stop();
- if (!file_message_loop_proxy_->PostTask(
+ if (!blocking_task_runner_->PostTask(
FROM_HERE, base::Bind(&WriteToDiskTask, path_, data))) {
// Posting the task to background message loop is not expected
// to fail, but if it does, avoid losing data and just hit the disk
« no previous file with comments | « chrome/common/important_file_writer.h ('k') | chrome/common/json_pref_store.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698