Index: chrome/common/important_file_writer.cc |
=================================================================== |
--- chrome/common/important_file_writer.cc (revision 77169) |
+++ chrome/common/important_file_writer.cc (working copy) |
@@ -106,10 +106,19 @@ |
if (HasPendingWrite()) |
timer_.Stop(); |
- // TODO(sanjeevr): Add a DCHECK for the return value of PostTask. |
- // (Some tests fail if we add the DCHECK and they need to be fixed first). |
- file_message_loop_proxy_->PostTask(FROM_HERE, |
- new WriteToDiskTask(path_, data)); |
+ Task* write_task = new WriteToDiskTask(path_, data); |
+ if (!file_message_loop_proxy_->PostTask(FROM_HERE, write_task)) { |
+ // Posting the task to background message loop is not expected |
+ // to fail, but if it does, avoid loosing data and just hit the disk |
+ // on the current thread. |
+ // TODO(phajdan.jr): Fix test failures on Win and enable DCHECK below. |
+#if !defined(OS_WIN) |
+ NOTREACHED(); |
+#endif |
+ |
+ write_task->Run(); |
sanjeevr
2011/03/07 23:26:25
This will not work because PostTask will delete th
Paweł Hajdan Jr.
2011/03/08 09:11:29
Done.
|
+ delete write_task; |
+ } |
} |
void ImportantFileWriter::ScheduleWrite(DataSerializer* serializer) { |