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

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

Issue 1800743003: base: Remove some unnecessary const scoped_refptr<>&. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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
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 <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 #include <stdio.h> 9 #include <stdio.h>
10 #include <string> 10 #include <string>
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 LogFailure(path, FAILED_RENAMING, "could not rename temporary file"); 119 LogFailure(path, FAILED_RENAMING, "could not rename temporary file");
120 DeleteFile(tmp_file_path, false); 120 DeleteFile(tmp_file_path, false);
121 return false; 121 return false;
122 } 122 }
123 123
124 return true; 124 return true;
125 } 125 }
126 126
127 ImportantFileWriter::ImportantFileWriter( 127 ImportantFileWriter::ImportantFileWriter(
128 const FilePath& path, 128 const FilePath& path,
129 const scoped_refptr<SequencedTaskRunner>& task_runner) 129 scoped_refptr<SequencedTaskRunner> task_runner)
130 : ImportantFileWriter( 130 : ImportantFileWriter(
131 path, 131 path,
132 task_runner, 132 std::move(task_runner),
133 TimeDelta::FromMilliseconds(kDefaultCommitIntervalMs)) { 133 TimeDelta::FromMilliseconds(kDefaultCommitIntervalMs)) {}
134 }
135 134
136 ImportantFileWriter::ImportantFileWriter( 135 ImportantFileWriter::ImportantFileWriter(
137 const FilePath& path, 136 const FilePath& path,
138 const scoped_refptr<SequencedTaskRunner>& task_runner, 137 scoped_refptr<SequencedTaskRunner> task_runner,
139 TimeDelta interval) 138 TimeDelta interval)
140 : path_(path), 139 : path_(path),
141 task_runner_(task_runner), 140 task_runner_(std::move(task_runner)),
142 serializer_(nullptr), 141 serializer_(nullptr),
143 commit_interval_(interval), 142 commit_interval_(interval),
144 weak_factory_(this) { 143 weak_factory_(this) {
145 DCHECK(CalledOnValidThread()); 144 DCHECK(CalledOnValidThread());
146 DCHECK(task_runner_); 145 DCHECK(task_runner_);
147 } 146 }
148 147
149 ImportantFileWriter::~ImportantFileWriter() { 148 ImportantFileWriter::~ImportantFileWriter() {
150 // We're usually a member variable of some other object, which also tends 149 // We're usually a member variable of some other object, which also tends
151 // to be our serializer. It may not be safe to call back to the parent object 150 // to be our serializer. It may not be safe to call back to the parent object
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
230 229
231 void ImportantFileWriter::ForwardSuccessfulWrite(bool result) { 230 void ImportantFileWriter::ForwardSuccessfulWrite(bool result) {
232 DCHECK(CalledOnValidThread()); 231 DCHECK(CalledOnValidThread());
233 if (result && !on_next_successful_write_.is_null()) { 232 if (result && !on_next_successful_write_.is_null()) {
234 on_next_successful_write_.Run(); 233 on_next_successful_write_.Run();
235 on_next_successful_write_.Reset(); 234 on_next_successful_write_.Reset();
236 } 235 }
237 } 236 }
238 237
239 } // namespace base 238 } // namespace base
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698