critical_closure_internal_ios.mm 1018 B

12345678910111213141516171819202122232425262728293031323334
  1. // Copyright 2014 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. #include "base/critical_closure.h"
  5. #import <UIKit/UIKit.h>
  6. namespace base {
  7. namespace internal {
  8. ImmediateCriticalClosure::ImmediateCriticalClosure(StringPiece task_name,
  9. OnceClosure closure)
  10. : critical_action_(task_name), closure_(std::move(closure)) {}
  11. ImmediateCriticalClosure::~ImmediateCriticalClosure() {}
  12. void ImmediateCriticalClosure::Run() {
  13. std::move(closure_).Run();
  14. }
  15. PendingCriticalClosure::PendingCriticalClosure(StringPiece task_name,
  16. OnceClosure closure)
  17. : task_name_(task_name), closure_(std::move(closure)) {}
  18. PendingCriticalClosure::~PendingCriticalClosure() {}
  19. void PendingCriticalClosure::Run() {
  20. critical_action_.emplace(task_name_);
  21. std::move(closure_).Run();
  22. }
  23. } // namespace internal
  24. } // namespace base