flutter_flutter/third_party/tonic/dart_microtask_queue.h
Chinmay Garde 276481c4d3
Move tonic into //flutter/third_party. (#15895)
Tonic used to be used by multiple consumers outside of Flutter Engine. Due to
this, it has an unnecessary abstraction layer as well as utilities duplicated in
FML and other engine subsystems. The sole user of Tonic is now the Flutter
Engine. It is intended that the Flutter Engine team now owns this subsystem,
remove unnecessary utilities and document the headers. This is the first step in
the transition. No history is being imported as the initial history was already
lost in the transition of this component to fuchsia.googlesource. As this
component was unmaintained there, I could see no additional value in importing
the history of the patches there.

No functional change. Just moved the repo from //third_party to
//flutter/third_party and updates GN refs.
2020-01-25 17:01:56 -08:00

43 lines
992 B
C++

// Copyright 2013 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef LIB_TONIC_DART_MICROTASK_QUEUE_H_
#define LIB_TONIC_DART_MICROTASK_QUEUE_H_
#include <vector>
#include "third_party/dart/runtime/include/dart_api.h"
#include "tonic/dart_persistent_value.h"
#include "tonic/logging/dart_error.h"
namespace tonic {
class DartMicrotaskQueue {
public:
DartMicrotaskQueue();
~DartMicrotaskQueue();
static void StartForCurrentThread();
static DartMicrotaskQueue* GetForCurrentThread();
void ScheduleMicrotask(Dart_Handle callback);
void RunMicrotasks();
void Destroy();
bool HasMicrotasks() const { return !queue_.empty(); }
DartErrorHandleType GetLastError();
private:
typedef std::vector<DartPersistentValue> MicrotaskQueue;
DartErrorHandleType last_error_;
MicrotaskQueue queue_;
};
} // namespace tonic
#endif // LIB_TONIC_DART_MICROTASK_QUEUE_H_