blob: baf4e0f6bb1f28622f78961ed8ee70c88286e4ce [file] [log] [blame]
jhawkins@chromium.orge194f3d2012-01-05 11:18:18 +09001// Copyright (c) 2012 The Chromium Authors. All rights reserved.
erg@chromium.org493f5f62010-07-16 06:03:54 +09002// 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.org6d4ad682011-05-28 04:35:11 +09007namespace base {
8
sergeyu@chromium.org17c67352011-10-05 00:28:03 +09009ScopedClosureRunner::ScopedClosureRunner(const Closure& closure)
10 : closure_(closure) {
11}
12
13ScopedClosureRunner::~ScopedClosureRunner() {
14 if (!closure_.is_null())
15 closure_.Run();
16}
17
18Closure ScopedClosureRunner::Release() {
19 Closure result = closure_;
20 closure_.Reset();
21 return result;
22}
23
wez@chromium.org6d4ad682011-05-28 04:35:11 +090024} // namespace base