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

Side by Side Diff: chrome/common/important_file_writer.cc

Issue 6713032: Provide lazy CommitPendingWrites in addition to eager SavePersistentPrefs. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: removed notification + rebase Created 9 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 | Annotate | Revision Log
« no previous file with comments | « chrome/browser/prefs/testing_pref_store.h ('k') | chrome/common/json_pref_store.h » ('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) 2010 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 "chrome/common/important_file_writer.h" 5 #include "chrome/common/important_file_writer.h"
6 6
7 #include <stdio.h> 7 #include <stdio.h>
8 8
9 #include <string> 9 #include <string>
10 10
11 #include "base/file_path.h" 11 #include "base/file_path.h"
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 DCHECK(CalledOnValidThread()); 99 DCHECK(CalledOnValidThread());
100 return timer_.IsRunning(); 100 return timer_.IsRunning();
101 } 101 }
102 102
103 void ImportantFileWriter::WriteNow(const std::string& data) { 103 void ImportantFileWriter::WriteNow(const std::string& data) {
104 DCHECK(CalledOnValidThread()); 104 DCHECK(CalledOnValidThread());
105 105
106 if (HasPendingWrite()) 106 if (HasPendingWrite())
107 timer_.Stop(); 107 timer_.Stop();
108 108
109 if (!file_message_loop_proxy_->PostTask(FROM_HERE, 109 if (!file_message_loop_proxy_->PostTask(
110 new WriteToDiskTask(path_, data))) { 110 FROM_HERE, new WriteToDiskTask(path_, data))) {
Mattias Nissler (ping if slow) 2011/03/25 15:29:57 any reason for the formatting change here? I found
Denis Lagno 2011/03/25 15:41:22 In old versions of CL there was argument added, no
111 // Posting the task to background message loop is not expected 111 // Posting the task to background message loop is not expected
112 // to fail, but if it does, avoid losing data and just hit the disk 112 // to fail, but if it does, avoid losing data and just hit the disk
113 // on the current thread. 113 // on the current thread.
114 NOTREACHED(); 114 NOTREACHED();
115 115
116 WriteToDiskTask write_task(path_, data); 116 WriteToDiskTask write_task(path_, data);
117 write_task.Run(); 117 write_task.Run();
118 } 118 }
119 } 119 }
120 120
(...skipping 19 matching lines...) Expand all
140 DCHECK(serializer_); 140 DCHECK(serializer_);
141 std::string data; 141 std::string data;
142 if (serializer_->SerializeData(&data)) { 142 if (serializer_->SerializeData(&data)) {
143 WriteNow(data); 143 WriteNow(data);
144 } else { 144 } else {
145 LOG(WARNING) << "failed to serialize data to be saved in " 145 LOG(WARNING) << "failed to serialize data to be saved in "
146 << path_.value(); 146 << path_.value();
147 } 147 }
148 serializer_ = NULL; 148 serializer_ = NULL;
149 } 149 }
OLDNEW
« no previous file with comments | « chrome/browser/prefs/testing_pref_store.h ('k') | chrome/common/json_pref_store.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698