Index: base/critical_closure.h |
diff --git a/base/critical_closure.h b/base/critical_closure.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..e7c3d505b7c8c9834bef2366a2fc8c6c5441f4af |
--- /dev/null |
+++ b/base/critical_closure.h |
@@ -0,0 +1,28 @@ |
+// Copyright (c) 2012 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef BASE_CRITICAL_CLOSURE_H_ |
+#define BASE_CRITICAL_CLOSURE_H_ |
+ |
+#include "base/callback.h" |
+ |
+namespace base { |
+ |
+// Returns a closure that is protected when the application goes to the |
Mark Mentovai
2012/07/31 23:16:33
You don’t say what “protected” means, but it’s tot
Chen Yu
2012/08/01 11:26:13
Done.
|
+// background (on platforms where applications don't execute while backgrounded) |
+// if possible, otherwise the original task is returned. |
+// |
+// Example: |
+// file_message_loop_proxy_->PostTask( |
+// FROM_HERE, |
+// MakeCriticalClosure(base::Bind(&WriteToDiskTask, path_, data))); |
+// |
+// Note new closures might be posted in this closure. If the new closures need |
+// to be protected, |MakeCriticalClosure| should be applied on them before |
+// posting. |
+base::Closure MakeCriticalClosure(const base::Closure& closure); |
+ |
+} // namespace base |
+ |
+#endif // BASE_CRITICAL_CLOSURE_H_ |