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