// 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 will continue to run for a period of time when the
// application goes to the background if possible on platforms where
// applications don't execute while backgrounded, 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
// background running time, |MakeCriticalClosure| should be applied on them
// before posting.
#if defined(OS_IOS)
base::Closure MakeCriticalClosure(const base::Closure& closure);
#else
base::Closure MakeCriticalClosure(const base::Closure& closure) {
  // No-op for platforms where the application does not need to acquire
  // background time for closures to finish when it goes into the background.
  return closure;
}
#endif  // !defined(OS_IOS)

}  // namespace base

#endif  // BASE_CRITICAL_CLOSURE_H_

// 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 will continue to run for a period of time when the
// application goes to the background if possible on platforms where
// applications don't execute while backgrounded, 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
// background running time, |MakeCriticalClosure| should be applied on them
// before posting.
#if defined(OS_IOS)
base::Closure MakeCriticalClosure(const base::Closure& closure);
#else
inline base::Closure MakeCriticalClosure(const base::Closure& closure) {
  // No-op for platforms where the application does not need to acquire
  // background time for closures to finish when it goes into the background.
  return closure;
}
#endif  // !defined(OS_IOS)

}  // namespace base

#endif  // BASE_CRITICAL_CLOSURE_H_

Add inline annotation for base::MakeCriticalClosure() in platform other than ios.
Add inline annotation for base::MakeCriticalClosure() in platform other than ios.

The implementation of this method is basically noop in platforms other than ios and it is put in the header file; this change adds inline annotation to avoid duplicate symbol link error on other platforms.

BUG=NONE


Review URL: https://chromiumcodereview.appspot.com/10837182

git-svn-id: de016e52bd170d2d4f2344f9bf92d50478b649e0@150831 0039d316-1c4b-4281-b951-d872f2087c98
