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

Side by Side Diff: base/files/important_file_writer.cc

Issue 1113953002: Revert of base: Remove use of MessageLoopProxy (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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 unified diff | Download patch
« no previous file with comments | « base/files/file_util_proxy_unittest.cc ('k') | base/files/important_file_writer_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/files/important_file_writer.h" 5 #include "base/files/important_file_writer.h"
6 6
7 #include <stdio.h> 7 #include <stdio.h>
8 8
9 #include <string> 9 #include <string>
10 10
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 123
124 ImportantFileWriter::ImportantFileWriter( 124 ImportantFileWriter::ImportantFileWriter(
125 const FilePath& path, 125 const FilePath& path,
126 const scoped_refptr<base::SequencedTaskRunner>& task_runner) 126 const scoped_refptr<base::SequencedTaskRunner>& task_runner)
127 : path_(path), 127 : path_(path),
128 task_runner_(task_runner), 128 task_runner_(task_runner),
129 serializer_(NULL), 129 serializer_(NULL),
130 commit_interval_(TimeDelta::FromMilliseconds(kDefaultCommitIntervalMs)), 130 commit_interval_(TimeDelta::FromMilliseconds(kDefaultCommitIntervalMs)),
131 weak_factory_(this) { 131 weak_factory_(this) {
132 DCHECK(CalledOnValidThread()); 132 DCHECK(CalledOnValidThread());
133 DCHECK(task_runner_); 133 DCHECK(task_runner_.get());
134 } 134 }
135 135
136 ImportantFileWriter::~ImportantFileWriter() { 136 ImportantFileWriter::~ImportantFileWriter() {
137 // We're usually a member variable of some other object, which also tends 137 // We're usually a member variable of some other object, which also tends
138 // to be our serializer. It may not be safe to call back to the parent object 138 // to be our serializer. It may not be safe to call back to the parent object
139 // being destructed. 139 // being destructed.
140 DCHECK(!HasPendingWrite()); 140 DCHECK(!HasPendingWrite());
141 } 141 }
142 142
143 bool ImportantFileWriter::HasPendingWrite() const { 143 bool ImportantFileWriter::HasPendingWrite() const {
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
217 217
218 void ImportantFileWriter::ForwardSuccessfulWrite(bool result) { 218 void ImportantFileWriter::ForwardSuccessfulWrite(bool result) {
219 DCHECK(CalledOnValidThread()); 219 DCHECK(CalledOnValidThread());
220 if (result && !on_next_successful_write_.is_null()) { 220 if (result && !on_next_successful_write_.is_null()) {
221 on_next_successful_write_.Run(); 221 on_next_successful_write_.Run();
222 on_next_successful_write_.Reset(); 222 on_next_successful_write_.Reset();
223 } 223 }
224 } 224 }
225 225
226 } // namespace base 226 } // namespace base
OLDNEW
« no previous file with comments | « base/files/file_util_proxy_unittest.cc ('k') | base/files/important_file_writer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698