dart_wrapper.h 811 字节
Newer Older
1 2 3 4 5 6 7
// Copyright 2015 The Chromium 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 FLUTTER_LIB_UI_DART_WRAPPER_H_
#define FLUTTER_LIB_UI_DART_WRAPPER_H_

8
#include "flutter/fml/memory/ref_counted.h"
9 10 11 12 13
#include "third_party/tonic/dart_wrappable.h"

namespace blink {

template <typename T>
14
class RefCountedDartWrappable : public fml::RefCountedThreadSafe<T>,
15 16 17
                                public tonic::DartWrappable {
 public:
  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 27 28
  }
};

}  // namespace blink

#endif  // FLUTTER_LIB_UI_DART_WRAPPER_H_