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

Unified Diff: base/files/important_file_writer.cc

Issue 11027070: Moved JsonPrefStore to use SequencedWorkerPool (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 1 month 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: base/files/important_file_writer.cc
diff --git a/base/files/important_file_writer.cc b/base/files/important_file_writer.cc
index 5663bddbb830363d8fd030c1cf29be8ce790d170..536b0fb161b93cadd3a38a355bf2e071b9c1f59d 100644
--- a/base/files/important_file_writer.cc
+++ b/base/files/important_file_writer.cc
@@ -13,7 +13,7 @@
#include "base/file_path.h"
#include "base/file_util.h"
#include "base/logging.h"
-#include "base/message_loop_proxy.h"
+#include "base/task_runner.h"
#include "base/metrics/histogram.h"
#include "base/string_number_conversions.h"
#include "base/threading/thread.h"
@@ -90,14 +90,14 @@ void WriteToDiskTask(const FilePath& path, const std::string& data) {
} // namespace
ImportantFileWriter::ImportantFileWriter(
- const FilePath& path, MessageLoopProxy* file_message_loop_proxy)
+ const FilePath& path, base::SequencedTaskRunner* task_runner)
: path_(path),
- file_message_loop_proxy_(file_message_loop_proxy),
+ task_runner_(task_runner),
serializer_(NULL),
commit_interval_(TimeDelta::FromMilliseconds(
kDefaultCommitIntervalMs)) {
DCHECK(CalledOnValidThread());
- DCHECK(file_message_loop_proxy_.get());
+ DCHECK(task_runner_.get());
}
ImportantFileWriter::~ImportantFileWriter() {
@@ -122,8 +122,8 @@ void ImportantFileWriter::WriteNow(const std::string& data) {
if (HasPendingWrite())
timer_.Stop();
- if (!file_message_loop_proxy_->PostTask(
- FROM_HERE, MakeCriticalClosure(Bind(&WriteToDiskTask, path_, data)))) {
+ if (!task_runner_->PostTask(FROM_HERE,
+ MakeCriticalClosure(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
// on the current thread.

Powered by Google App Engine
This is Rietveld 408576698