<commit_before>// 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;
}

// Task ------------------------------------------------------------------------
//
// A task is a generic runnable thingy, usually used for running code on a
// different thread or for scheduling future tasks off of the message loop.

class BASE_EXPORT Task {
 public:
  Task();
  virtual ~Task();

  // Tasks are automatically deleted after Run is called.
  virtual void Run() = 0;
};

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

template<typename T>
void ReleasePointer(T* obj) {
  obj->Release();
}

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 subtle {

// This class is meant for use in the implementation of MessageLoop classes
// such as MessageLoop, MessageLoopProxy, BrowserThread, and WorkerPool to<commit_msg>Re-remove ReleasePointer.<commit_after>// 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;
}

// Task ------------------------------------------------------------------------
//
// A task is a generic runnable thingy, usually used for running code on a
// different thread or for scheduling future tasks off of the message loop.

class BASE_EXPORT Task {
 public:
  Task();
  virtual ~Task();

  // Tasks are automatically deleted after Run is called.
  virtual void Run() = 0;
};

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 subtle {

// This class is meant for use in the implementation of MessageLoop classes
// such as MessageLoop, MessageLoopProxy, BrowserThread, and WorkerPool to
{'fraction_non_alphanumeric': 0.500277932184547, 'fraction_numerical': 0.0025013896609227346, 'mean_word_length': 5.789622641509434, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '592535', 'n_tokens_mistral': 1608, 'n_tokens_neox': 1377, 'n_words': 432}