| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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_ |
| OLD | NEW |