security/sandbox/chromium/base/critical_closure.h

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

michael@0 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
michael@0 2 // Use of this source code is governed by a BSD-style license that can be
michael@0 3 // found in the LICENSE file.
michael@0 4
michael@0 5 #ifndef BASE_CRITICAL_CLOSURE_H_
michael@0 6 #define BASE_CRITICAL_CLOSURE_H_
michael@0 7
michael@0 8 #include "base/callback.h"
michael@0 9
michael@0 10 namespace base {
michael@0 11
michael@0 12 // Returns a closure that will continue to run for a period of time when the
michael@0 13 // application goes to the background if possible on platforms where
michael@0 14 // applications don't execute while backgrounded, otherwise the original task is
michael@0 15 // returned.
michael@0 16 //
michael@0 17 // Example:
michael@0 18 // file_message_loop_proxy_->PostTask(
michael@0 19 // FROM_HERE,
michael@0 20 // MakeCriticalClosure(base::Bind(&WriteToDiskTask, path_, data)));
michael@0 21 //
michael@0 22 // Note new closures might be posted in this closure. If the new closures need
michael@0 23 // background running time, |MakeCriticalClosure| should be applied on them
michael@0 24 // before posting.
michael@0 25 #if defined(OS_IOS)
michael@0 26 base::Closure MakeCriticalClosure(const base::Closure& closure);
michael@0 27 #else
michael@0 28 inline base::Closure MakeCriticalClosure(const base::Closure& closure) {
michael@0 29 // No-op for platforms where the application does not need to acquire
michael@0 30 // background time for closures to finish when it goes into the background.
michael@0 31 return closure;
michael@0 32 }
michael@0 33 #endif // !defined(OS_IOS)
michael@0 34
michael@0 35 } // namespace base
michael@0 36
michael@0 37 #endif // BASE_CRITICAL_CLOSURE_H_

mercurial