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

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

Issue 2122543002: Replace Closure in TaskRunner::PostTask with OneShotCallback (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@07_oneshot
Patch Set: fix Created 4 years, 3 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.cc ('k') | base/files/important_file_writer.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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 #ifndef BASE_FILES_IMPORTANT_FILE_WRITER_H_ 5 #ifndef BASE_FILES_IMPORTANT_FILE_WRITER_H_
6 #define BASE_FILES_IMPORTANT_FILE_WRITER_H_ 6 #define BASE_FILES_IMPORTANT_FILE_WRITER_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/base_export.h" 10 #include "base/base_export.h"
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 // successful write event. Only one callback can be set at once. 98 // successful write event. Only one callback can be set at once.
99 void RegisterOnNextSuccessfulWriteCallback( 99 void RegisterOnNextSuccessfulWriteCallback(
100 const Closure& on_next_successful_write); 100 const Closure& on_next_successful_write);
101 101
102 TimeDelta commit_interval() const { 102 TimeDelta commit_interval() const {
103 return commit_interval_; 103 return commit_interval_;
104 } 104 }
105 105
106 private: 106 private:
107 // Helper method for WriteNow(). 107 // Helper method for WriteNow().
108 bool PostWriteTask(const Callback<bool()>& task); 108 bool PostWriteTask(OnceCallback<bool()> task);
109 109
110 // If |result| is true and |on_next_successful_write_| is set, invokes 110 // If |result| is true and |on_next_successful_write_| is set, invokes
111 // |on_successful_write_| and then resets it; no-ops otherwise. 111 // |on_successful_write_| and then resets it; no-ops otherwise.
112 void ForwardSuccessfulWrite(bool result); 112 void ForwardSuccessfulWrite(bool result);
113 113
114 // Invoked once and then reset on the next successful write event. 114 // Invoked once and then reset on the next successful write event.
115 Closure on_next_successful_write_; 115 Closure on_next_successful_write_;
116 116
117 // Path being written to. 117 // Path being written to.
118 const FilePath path_; 118 const FilePath path_;
(...skipping 11 matching lines...) Expand all
130 const TimeDelta commit_interval_; 130 const TimeDelta commit_interval_;
131 131
132 WeakPtrFactory<ImportantFileWriter> weak_factory_; 132 WeakPtrFactory<ImportantFileWriter> weak_factory_;
133 133
134 DISALLOW_COPY_AND_ASSIGN(ImportantFileWriter); 134 DISALLOW_COPY_AND_ASSIGN(ImportantFileWriter);
135 }; 135 };
136 136
137 } // namespace base 137 } // namespace base
138 138
139 #endif // BASE_FILES_IMPORTANT_FILE_WRITER_H_ 139 #endif // BASE_FILES_IMPORTANT_FILE_WRITER_H_
OLDNEW
« no previous file with comments | « base/files/file_util_proxy.cc ('k') | base/files/important_file_writer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698