Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
third_party
tonic
dart_persistent_value.h
Go to the documentation of this file.
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 LIB_TONIC_DART_PERSISTENT_VALUE_H_
6
#define LIB_TONIC_DART_PERSISTENT_VALUE_H_
7
8
#include <memory>
9
10
#include "third_party/dart/runtime/include/dart_api.h"
11
#include "
tonic/common/macros.h
"
12
13
namespace
tonic
{
14
class
DartState
;
15
16
// DartPersistentValue is a bookkeeping class to help pair calls to
17
// Dart_NewPersistentHandle with Dart_DeletePersistentHandle. Consider using
18
// this class instead of holding a Dart_PersistentHandle directly so that you
19
// don't leak the Dart_PersistentHandle.
20
class
DartPersistentValue
{
21
public
:
22
DartPersistentValue
();
23
DartPersistentValue
(
DartPersistentValue
&& other);
24
DartPersistentValue
(
DartState
*
dart_state
,
Dart_Handle
value
);
25
~DartPersistentValue
();
26
27
Dart_PersistentHandle
value
()
const
{
return
value_; }
28
bool
is_empty
()
const
{
return
!value_; }
29
30
void
Set(
DartState
*
dart_state
,
Dart_Handle
value
);
31
void
Clear
();
32
Dart_Handle
Get
();
33
Dart_Handle
Release
();
34
35
const
std::weak_ptr<DartState>&
dart_state
()
const
{
return
dart_state_; }
36
37
private
:
38
std::weak_ptr<DartState> dart_state_;
39
Dart_PersistentHandle
value_;
40
41
TONIC_DISALLOW_COPY_AND_ASSIGN
(
DartPersistentValue
);
42
};
43
44
}
// namespace tonic
45
46
#endif
// LIB_TONIC_DART_PERSISTENT_VALUE_H_
tonic::DartPersistentValue
Definition
dart_persistent_value.h:20
tonic::DartPersistentValue::~DartPersistentValue
~DartPersistentValue()
Definition
dart_persistent_value.cc:26
tonic::DartPersistentValue::Get
Dart_Handle Get()
Definition
dart_persistent_value.cc:66
tonic::DartPersistentValue::dart_state
const std::weak_ptr< DartState > & dart_state() const
Definition
dart_persistent_value.h:35
tonic::DartPersistentValue::DartPersistentValue
DartPersistentValue()
Definition
dart_persistent_value.cc:12
tonic::DartPersistentValue::Clear
void Clear()
Definition
dart_persistent_value.cc:36
tonic::DartPersistentValue::Release
Dart_Handle Release()
Definition
dart_persistent_value.cc:72
tonic::DartPersistentValue::is_empty
bool is_empty() const
Definition
dart_persistent_value.h:28
tonic::DartPersistentValue::value
Dart_PersistentHandle value() const
Definition
dart_persistent_value.h:27
tonic::DartState
Definition
dart_state.h:28
Dart_Handle
struct _Dart_Handle * Dart_Handle
Definition
dart_api.h:258
Dart_PersistentHandle
Dart_Handle Dart_PersistentHandle
Definition
dart_api.h:259
flutter::testing::DartState
FixtureTest DartState
Definition
dart_state_unittest.cc:14
tonic
Definition
image_filter.h:14
macros.h
TONIC_DISALLOW_COPY_AND_ASSIGN
#define TONIC_DISALLOW_COPY_AND_ASSIGN(TypeName)
Definition
macros.h:19
Generated on Fri Apr 26 2024 06:18:16 for Flutter Engine by
1.9.8