Flutter Engine
dart_library_natives.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_LIBRARY_NATIVES_H_
6 #define LIB_TONIC_DART_LIBRARY_NATIVES_H_
7 
8 #include <initializer_list>
9 #include <string>
10 #include <unordered_map>
11 
12 #include "third_party/dart/runtime/include/dart_api.h"
13 #include "tonic/common/macros.h"
14 
15 namespace tonic {
16 
18  public:
21 
22  struct Entry {
23  const char* symbol;
24  Dart_NativeFunction native_function;
27  };
28 
29  void Register(std::initializer_list<Entry> entries);
30 
31  Dart_NativeFunction GetNativeFunction(Dart_Handle name,
32  int argument_count,
33  bool* auto_setup_scope);
34  const uint8_t* GetSymbol(Dart_NativeFunction native_function);
35 
36  private:
37  std::unordered_map<std::string, Entry> entries_;
38  std::unordered_map<Dart_NativeFunction, const char*> symbols_;
39 
41 };
42 
43 } // namespace tonic
44 
45 #endif // LIB_TONIC_DART_LIBRARY_NATIVES_H_
const char * symbol
int argument_count
Dart_NativeFunction native_function
const uint8_t * GetSymbol(Dart_NativeFunction native_function)
void Register(std::initializer_list< Entry > entries)
const char * name
Definition: fuchsia.cc:50
Dart_NativeFunction GetNativeFunction(Dart_Handle name, int argument_count, bool *auto_setup_scope)
bool auto_setup_scope
#define TONIC_DISALLOW_COPY_AND_ASSIGN(TypeName)
Definition: macros.h:19