summaryrefslogtreecommitdiffstats
path: root/base/task.h
blob: dbef70be032350c3f552ac41e7db69ef80939634 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
// 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.

// ============================================================================
// ****************************************************************************
// *  THIS HEADER IS DEPRECATED, SEE base/callback.h FOR NEW IMPLEMENTATION   *
// ****************************************************************************
// ============================================================================
// ============================================================================
// ****************************************************************************
// *  THIS HEADER IS DEPRECATED, SEE base/callback.h FOR NEW IMPLEMENTATION   *
// ****************************************************************************
// ============================================================================
// ============================================================================
// ****************************************************************************
// *  THIS HEADER IS DEPRECATED, SEE base/callback.h FOR NEW IMPLEMENTATION   *
// ****************************************************************************
// ============================================================================
// ============================================================================
// ****************************************************************************
// *  THIS HEADER IS DEPRECATED, SEE base/callback.h FOR NEW IMPLEMENTATION   *
// ****************************************************************************
// ============================================================================
// ============================================================================
// ****************************************************************************
// *  THIS HEADER IS DEPRECATED, SEE base/callback.h FOR NEW IMPLEMENTATION   *
// ****************************************************************************
// ============================================================================
#ifndef BASE_TASK_H_
#define BASE_TASK_H_
#pragma once

#include "base/base_export.h"
#include "base/callback.h"
#include "base/debug/alias.h"
#include "base/memory/raw_scoped_refptr_mismatch_checker.h"
#include "base/memory/weak_ptr.h"
#include "base/tuple.h"

namespace base {
const size_t kDeadTask = 0xDEAD7A53;
}

template<typename T>
void DeletePointer(T* obj) {
  delete obj;
}

namespace base {

// ScopedClosureRunner is akin to scoped_ptr for Closures. It ensures that the
// Closure is executed and deleted no matter how the current scope exits.
class BASE_EXPORT ScopedClosureRunner {
 public:
  explicit ScopedClosureRunner(const Closure& closure);
  ~ScopedClosureRunner();

  Closure Release();

 private:
  Closure closure_;

  DISALLOW_IMPLICIT_CONSTRUCTORS(ScopedClosureRunner);
};

}  // namespace base

#endif  // BASE_TASK_H_