41 lines
1.1 KiB
Plaintext
41 lines
1.1 KiB
Plaintext
// Copyright 2014 The Chromium Authors
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
// found in the LICENSE file.
|
|
|
|
#include "base/critical_closure.h"
|
|
|
|
#import <UIKit/UIKit.h>
|
|
|
|
namespace base {
|
|
namespace internal {
|
|
|
|
ImmediateCriticalClosure::ImmediateCriticalClosure(StringPiece task_name,
|
|
OnceClosure closure)
|
|
: critical_action_(task_name), closure_(std::move(closure)) {
|
|
CHECK(!closure_.is_null());
|
|
}
|
|
|
|
ImmediateCriticalClosure::~ImmediateCriticalClosure() {}
|
|
|
|
void ImmediateCriticalClosure::Run() {
|
|
CHECK(!closure_.is_null());
|
|
std::move(closure_).Run();
|
|
}
|
|
|
|
PendingCriticalClosure::PendingCriticalClosure(StringPiece task_name,
|
|
OnceClosure closure)
|
|
: task_name_(task_name), closure_(std::move(closure)) {
|
|
CHECK(!closure_.is_null());
|
|
}
|
|
|
|
PendingCriticalClosure::~PendingCriticalClosure() {}
|
|
|
|
void PendingCriticalClosure::Run() {
|
|
CHECK(!closure_.is_null());
|
|
critical_action_.emplace(task_name_);
|
|
std::move(closure_).Run();
|
|
}
|
|
|
|
} // namespace internal
|
|
} // namespace base
|