1// Copyright 2013 The Flutter 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
5#ifndef FLUTTER_LIB_UI_DART_WRAPPER_H_
6#define FLUTTER_LIB_UI_DART_WRAPPER_H_
7
8#include "flutter/fml/memory/ref_counted.h"
9#include "third_party/tonic/dart_wrappable.h"
10
11namespace flutter {
12
13template <typename T>
14class RefCountedDartWrappable : public fml::RefCountedThreadSafe<T>,
15 public tonic::DartWrappable {
16 public:
17 virtual void RetainDartWrappableReference() const override {
18 fml::RefCountedThreadSafe<T>::AddRef();
19 }
20
21 virtual void ReleaseDartWrappableReference() const override {
22 fml::RefCountedThreadSafe<T>::Release();
23 }
24};
25
26} // namespace flutter
27
28#endif // FLUTTER_LIB_UI_DART_WRAPPER_H_
29