• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1// Copyright 2014 The Chromium Authors
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/critical_closure.h"
6
7#import <UIKit/UIKit.h>
8
9namespace base::internal {
10
11ImmediateCriticalClosure::ImmediateCriticalClosure(StringPiece task_name,
12                                                   OnceClosure closure)
13    : critical_action_(task_name), closure_(std::move(closure)) {
14  CHECK(!closure_.is_null());
15}
16
17ImmediateCriticalClosure::~ImmediateCriticalClosure() {}
18
19void ImmediateCriticalClosure::Run() {
20  CHECK(!closure_.is_null());
21  std::move(closure_).Run();
22}
23
24PendingCriticalClosure::PendingCriticalClosure(StringPiece task_name,
25                                               OnceClosure closure)
26    : task_name_(task_name), closure_(std::move(closure)) {
27  CHECK(!closure_.is_null());
28}
29
30PendingCriticalClosure::~PendingCriticalClosure() {}
31
32void PendingCriticalClosure::Run() {
33  CHECK(!closure_.is_null());
34  critical_action_.emplace(task_name_);
35  std::move(closure_).Run();
36}
37
38}  // namespace base::internal
39