Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Classes | Namespaces | Macros | Functions
dart_api_impl.h File Reference
#include <memory>
#include "vm/allocation.h"
#include "vm/heap/safepoint.h"
#include "vm/native_arguments.h"
#include "vm/object.h"
#include "vm/timeline.h"

Go to the source code of this file.

Classes

class  dart::Api
 
class  dart::Api::Scope
 

Namespaces

namespace  dart
 

Macros

#define CURRENT_FUNC   CanonicalFunction(__FUNCTION__)
 
#define CHECK_ISOLATE_GROUP(isolate_group)
 
#define CHECK_ISOLATE(isolate)
 
#define CHECK_NO_ISOLATE(isolate)
 
#define CHECK_API_SCOPE(thread)
 
#define DARTSCOPE(thread)
 
#define RETURN_TYPE_ERROR(zone, dart_handle, type)
 
#define RETURN_NULL_ERROR(parameter)
 
#define CHECK_NULL(parameter)
 
#define CHECK_LENGTH(length, max_elements)
 
#define API_TIMELINE_DURATION(thread)
 
#define API_TIMELINE_BEGIN_END(thread)
 
#define DECLARE_UNWRAP(Type)    static const Type& Unwrap##Type##Handle(Zone* zone, Dart_Handle object);
 
#define START_NO_CALLBACK_SCOPE(thread)   thread->IncrementNoCallbackScopeDepth()
 
#define END_NO_CALLBACK_SCOPE(thread)
 
#define CHECK_CALLBACK_STATE(thread)
 
#define ASSERT_CALLBACK_STATE(thread)    ASSERT(thread->no_callback_scope_depth() == 0)
 

Functions

const char * dart::CanonicalFunction (const char *func)
 
Isolatedart::CreateWithinExistingIsolateGroup (IsolateGroup *group, const char *name, char **error)
 

Macro Definition Documentation

◆ API_TIMELINE_BEGIN_END

#define API_TIMELINE_BEGIN_END (   thread)
Value:
do { \
} while (false)

Definition at line 128 of file dart_api_impl.h.

129 { \
130 } while (false)

◆ API_TIMELINE_DURATION

#define API_TIMELINE_DURATION (   thread)
Value:
do { \
} while (false)

Definition at line 125 of file dart_api_impl.h.

126 { \
127 } while (false)

◆ ASSERT_CALLBACK_STATE

#define ASSERT_CALLBACK_STATE (   thread)     ASSERT(thread->no_callback_scope_depth() == 0)

Definition at line 352 of file dart_api_impl.h.

◆ CHECK_API_SCOPE

#define CHECK_API_SCOPE (   thread)
Value:
do { \
Thread* tmpT = (thread); \
Isolate* tmpI = tmpT == nullptr ? nullptr : tmpT->isolate(); \
CHECK_ISOLATE(tmpI); \
if (tmpT->api_top_scope() == nullptr) { \
FATAL( \
"%s expects to find a current scope. Did you forget to call " \
"Dart_EnterScope?", \
} \
} while (0);
#define CURRENT_FUNC

Definition at line 64 of file dart_api_impl.h.

65 { \
66 Thread* tmpT = (thread); \
67 Isolate* tmpI = tmpT == nullptr ? nullptr : tmpT->isolate(); \
68 CHECK_ISOLATE(tmpI); \
69 if (tmpT->api_top_scope() == nullptr) { \
70 FATAL( \
71 "%s expects to find a current scope. Did you forget to call " \
72 "Dart_EnterScope?", \
73 CURRENT_FUNC); \
74 } \
75 } while (0);

◆ CHECK_CALLBACK_STATE

#define CHECK_CALLBACK_STATE (   thread)
Value:
if (thread->no_callback_scope_depth() != 0) { \
return reinterpret_cast<Dart_Handle>(Api::NoCallbacksError()); \
} \
if (thread->is_unwind_in_progress()) { \
return reinterpret_cast<Dart_Handle>(Api::UnwindInProgressError()); \
}
struct _Dart_Handle * Dart_Handle
Definition dart_api.h:258

Definition at line 344 of file dart_api_impl.h.

345 { \
346 return reinterpret_cast<Dart_Handle>(Api::NoCallbacksError()); \
347 } \
348 if (thread->is_unwind_in_progress()) { \
349 return reinterpret_cast<Dart_Handle>(Api::UnwindInProgressError()); \
350 }

◆ CHECK_ISOLATE

#define CHECK_ISOLATE (   isolate)
Value:
do { \
if ((isolate) == nullptr) { \
FATAL( \
"%s expects there to be a current isolate. Did you " \
"forget to call Dart_CreateIsolateGroup or Dart_EnterIsolate?", \
} \
} while (0)

Definition at line 42 of file dart_api_impl.h.

43 { \
44 if ((isolate) == nullptr) { \
45 FATAL( \
46 "%s expects there to be a current isolate. Did you " \
47 "forget to call Dart_CreateIsolateGroup or Dart_EnterIsolate?", \
48 CURRENT_FUNC); \
49 } \
50 } while (0)

◆ CHECK_ISOLATE_GROUP

#define CHECK_ISOLATE_GROUP (   isolate_group)
Value:
do { \
if ((isolate_group) == nullptr) { \
FATAL( \
"%s expects there to be a current isolate group. Did you " \
"forget to call Dart_CreateIsolateGroup or Dart_EnterIsolate?", \
} \
} while (0)

Definition at line 31 of file dart_api_impl.h.

32 { \
33 if ((isolate_group) == nullptr) { \
34 FATAL( \
35 "%s expects there to be a current isolate group. Did you " \
36 "forget to call Dart_CreateIsolateGroup or Dart_EnterIsolate?", \
37 CURRENT_FUNC); \
38 } \
39 } while (0)

◆ CHECK_LENGTH

#define CHECK_LENGTH (   length,
  max_elements 
)
Value:
do { \
intptr_t len = (length); \
intptr_t max = (max_elements); \
if (len < 0 || len > max) { \
return Api::NewError( \
"%s expects argument '%s' to be in the range [0..%" Pd "].", \
} \
} while (0)
static float max(float r, float g, float b)
Definition hsl.cpp:49
size_t length
#define Pd
Definition globals.h:408

Definition at line 106 of file dart_api_impl.h.

107 { \
108 intptr_t len = (length); \
109 intptr_t max = (max_elements); \
110 if (len < 0 || len > max) { \
111 return Api::NewError( \
112 "%s expects argument '%s' to be in the range [0..%" Pd "].", \
113 CURRENT_FUNC, #length, max); \
114 } \
115 } while (0)

◆ CHECK_NO_ISOLATE

#define CHECK_NO_ISOLATE (   isolate)
Value:
do { \
if ((isolate) != nullptr) { \
FATAL( \
"%s expects there to be no current isolate. Did you " \
"forget to call Dart_ExitIsolate?", \
} \
} while (0)

Definition at line 53 of file dart_api_impl.h.

54 { \
55 if ((isolate) != nullptr) { \
56 FATAL( \
57 "%s expects there to be no current isolate. Did you " \
58 "forget to call Dart_ExitIsolate?", \
59 CURRENT_FUNC); \
60 } \
61 } while (0)

◆ CHECK_NULL

#define CHECK_NULL (   parameter)
Value:
if (parameter == nullptr) { \
RETURN_NULL_ERROR(parameter); \
}

Definition at line 101 of file dart_api_impl.h.

102 { \
103 RETURN_NULL_ERROR(parameter); \
104 }

◆ CURRENT_FUNC

#define CURRENT_FUNC   CanonicalFunction(__FUNCTION__)

Definition at line 28 of file dart_api_impl.h.

◆ DARTSCOPE

#define DARTSCOPE (   thread)
Value:
Thread* T = (thread); \
CHECK_API_SCOPE(T); \
TransitionNativeToVM transition(T); \
HANDLESCOPE(T);
#define T

Definition at line 77 of file dart_api_impl.h.

◆ DECLARE_UNWRAP

#define DECLARE_UNWRAP (   Type)     static const Type& Unwrap##Type##Handle(Zone* zone, Dart_Handle object);

Definition at line 155 of file dart_api_impl.h.

◆ END_NO_CALLBACK_SCOPE

#define END_NO_CALLBACK_SCOPE (   thread)
Value:
do { \
thread->DecrementNoCallbackScopeDepth(); \
if (thread->no_callback_scope_depth() == 0) { \
thread->heap()->CheckExternalGC(thread); \
} \
} while (false)

Definition at line 336 of file dart_api_impl.h.

337 { \
338 thread->DecrementNoCallbackScopeDepth(); \
339 if (thread->no_callback_scope_depth() == 0) { \
340 thread->heap()->CheckExternalGC(thread); \
341 } \
342 } while (false)

◆ RETURN_NULL_ERROR

#define RETURN_NULL_ERROR (   parameter)
Value:
return Api::NewError("%s expects argument '%s' to be non-null.", \
CURRENT_FUNC, #parameter)

Definition at line 97 of file dart_api_impl.h.

◆ RETURN_TYPE_ERROR

#define RETURN_TYPE_ERROR (   zone,
  dart_handle,
  type 
)
Value:
do { \
const Object& tmp = \
Object::Handle(zone, Api::UnwrapHandle((dart_handle))); \
if (tmp.IsNull()) { \
return Api::NewArgumentError("%s expects argument '%s' to be non-null.", \
CURRENT_FUNC, #dart_handle); \
} else if (tmp.IsError()) { \
return dart_handle; \
} \
return Api::NewArgumentError("%s expects argument '%s' to be of type %s.", \
CURRENT_FUNC, #dart_handle, #type); \
} while (0)

Definition at line 83 of file dart_api_impl.h.

84 { \
85 const Object& tmp = \
86 Object::Handle(zone, Api::UnwrapHandle((dart_handle))); \
87 if (tmp.IsNull()) { \
88 return Api::NewArgumentError("%s expects argument '%s' to be non-null.", \
89 CURRENT_FUNC, #dart_handle); \
90 } else if (tmp.IsError()) { \
91 return dart_handle; \
92 } \
93 return Api::NewArgumentError("%s expects argument '%s' to be of type %s.", \
94 CURRENT_FUNC, #dart_handle, #type); \
95 } while (0)

◆ START_NO_CALLBACK_SCOPE

#define START_NO_CALLBACK_SCOPE (   thread)    thread->IncrementNoCallbackScopeDepth()

Definition at line 333 of file dart_api_impl.h.