jhawkins@chromium.org | e194f3d | 2012-01-05 11:18:18 +0900 | [diff] [blame^] | 1 | // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
erg@chromium.org | 493f5f6 | 2010-07-16 06:03:54 +0900 | [diff] [blame] | 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
| 5 | #include "base/task.h" |
| 6 | |
wez@chromium.org | 6d4ad68 | 2011-05-28 04:35:11 +0900 | [diff] [blame] | 7 | namespace base { |
| 8 | |
sergeyu@chromium.org | 17c6735 | 2011-10-05 00:28:03 +0900 | [diff] [blame] | 9 | ScopedClosureRunner::ScopedClosureRunner(const Closure& closure) |
| 10 | : closure_(closure) { |
| 11 | } |
| 12 | |
| 13 | ScopedClosureRunner::~ScopedClosureRunner() { |
| 14 | if (!closure_.is_null()) |
| 15 | closure_.Run(); |
| 16 | } |
| 17 | |
| 18 | Closure ScopedClosureRunner::Release() { |
| 19 | Closure result = closure_; |
| 20 | closure_.Reset(); |
| 21 | return result; |
| 22 | } |
| 23 | |
wez@chromium.org | 6d4ad68 | 2011-05-28 04:35:11 +0900 | [diff] [blame] | 24 | } // namespace base |