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

Unified Diff: chrome/common/important_file_writer.cc

Issue 6627060: ImportantFileWriter: check return value of PostTask... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' 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 side-by-side diff with in-line comments
Download patch
Index: chrome/common/important_file_writer.cc
===================================================================
--- chrome/common/important_file_writer.cc (revision 77440)
+++ 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));
+ if (!file_message_loop_proxy_->PostTask(FROM_HERE,
+ new WriteToDiskTask(path_, data))) {
+ // Posting the task to background message loop is not expected
+ // to fail, but if it does, avoid losing data and just hit the disk
+ // on the current thread.
+ // TODO(phajdan.jr): Fix test failures on Win and enable code below.
+#if !defined(OS_WIN)
+ NOTREACHED();
+
+ WriteToDiskTask write_task(path_, data);
+ write_task.Run();
+#endif
+ }
}
void ImportantFileWriter::ScheduleWrite(DataSerializer* serializer) {
« no previous file with comments | « chrome/browser/ui/views/bookmarks/bookmark_bar_view_unittest.cc ('k') | chrome/test/browser_with_test_window_test.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698