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

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

Issue 11345008: Remove content::NotificationObserver dependency from most Prefs code. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge LKGR. Created 8 years, 1 month 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 | Annotate | Revision Log
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 22 matching lines...) Expand all
33 // To be safe, we don't start with writing directly to F. Instead, we write to 33 // To be safe, we don't start with writing directly to F. Instead, we write to
34 // to a temporary file. Only after that write is successful, we rename the 34 // to a temporary file. Only after that write is successful, we rename the
35 // temporary file to target filename. 35 // temporary file to target filename.
36 // 36 //
37 // If you want to know more about this approach and ext3/ext4 fsync issues, see 37 // If you want to know more about this approach and ext3/ext4 fsync issues, see
38 // http://valhenson.livejournal.com/37921.html 38 // http://valhenson.livejournal.com/37921.html
39 class BASE_EXPORT ImportantFileWriter : public NonThreadSafe { 39 class BASE_EXPORT ImportantFileWriter : public NonThreadSafe {
40 public: 40 public:
41 // Used by ScheduleSave to lazily provide the data to be saved. Allows us 41 // Used by ScheduleSave to lazily provide the data to be saved. Allows us
42 // to also batch data serializations. 42 // to also batch data serializations.
43 class DataSerializer { 43 class BASE_EXPORT DataSerializer {
44 public: 44 public:
45 // Should put serialized string in |data| and return true on successful 45 // Should put serialized string in |data| and return true on successful
46 // serialization. Will be called on the same thread on which 46 // serialization. Will be called on the same thread on which
47 // ImportantFileWriter has been created. 47 // ImportantFileWriter has been created.
48 virtual bool SerializeData(std::string* data) = 0; 48 virtual bool SerializeData(std::string* data) = 0;
49 49
50 protected: 50 protected:
51 virtual ~DataSerializer() {} 51 virtual ~DataSerializer() {}
52 }; 52 };
53 53
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 107
108 // Time delta after which scheduled data will be written to disk. 108 // Time delta after which scheduled data will be written to disk.
109 TimeDelta commit_interval_; 109 TimeDelta commit_interval_;
110 110
111 DISALLOW_COPY_AND_ASSIGN(ImportantFileWriter); 111 DISALLOW_COPY_AND_ASSIGN(ImportantFileWriter);
112 }; 112 };
113 113
114 } // namespace base 114 } // namespace base
115 115
116 #endif // BASE_FILES_IMPORTANT_FILE_WRITER_H_ 116 #endif // BASE_FILES_IMPORTANT_FILE_WRITER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698