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

Unified Diff: trunk/src/base/files/important_file_writer.cc

Issue 273243002: Revert 269415 "Introduce a new framework for back-and-forth trac..." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 6 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
Index: trunk/src/base/files/important_file_writer.cc
===================================================================
--- trunk/src/base/files/important_file_writer.cc (revision 269437)
+++ trunk/src/base/files/important_file_writer.cc (working copy)
@@ -23,7 +23,6 @@
#include "base/metrics/histogram.h"
#include "base/strings/string_number_conversions.h"
#include "base/task_runner.h"
-#include "base/task_runner_util.h"
#include "base/threading/thread.h"
#include "base/time/time.h"
@@ -94,13 +93,13 @@
return true;
}
-ImportantFileWriter::ImportantFileWriter(const FilePath& path,
- base::SequencedTaskRunner* task_runner)
- : path_(path),
- task_runner_(task_runner),
- serializer_(NULL),
- commit_interval_(TimeDelta::FromMilliseconds(kDefaultCommitIntervalMs)),
- weak_factory_(this) {
+ImportantFileWriter::ImportantFileWriter(
+ const FilePath& path, base::SequencedTaskRunner* task_runner)
+ : path_(path),
+ task_runner_(task_runner),
+ serializer_(NULL),
+ commit_interval_(TimeDelta::FromMilliseconds(
+ kDefaultCommitIntervalMs)) {
DCHECK(CalledOnValidThread());
DCHECK(task_runner_.get());
}
@@ -127,13 +126,11 @@
if (HasPendingWrite())
timer_.Stop();
- if (!base::PostTaskAndReplyWithResult(
- task_runner_,
+ if (!task_runner_->PostTask(
FROM_HERE,
MakeCriticalClosure(
- Bind(&ImportantFileWriter::WriteFileAtomically, path_, data)),
- Bind(&ImportantFileWriter::ForwardSuccessfulWrite,
- weak_factory_.GetWeakPtr()))) {
+ Bind(IgnoreResult(&ImportantFileWriter::WriteFileAtomically),
+ 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.
@@ -167,18 +164,4 @@
serializer_ = NULL;
}
-void ImportantFileWriter::RegisterOnNextSuccessfulWriteCallback(
- const base::Closure& on_next_successful_write) {
- DCHECK(on_next_successful_write_.is_null());
- on_next_successful_write_ = on_next_successful_write;
-}
-
-void ImportantFileWriter::ForwardSuccessfulWrite(bool result) {
- DCHECK(CalledOnValidThread());
- if (result && !on_next_successful_write_.is_null()) {
- on_next_successful_write_.Run();
- on_next_successful_write_.Reset();
- }
-}
-
} // namespace base
« no previous file with comments | « trunk/src/base/files/important_file_writer.h ('k') | trunk/src/base/files/important_file_writer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698