OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 #ifndef BIN_EXTENSIONS_H_ | 5 #ifndef BIN_EXTENSIONS_H_ |
6 #define BIN_EXTENSIONS_H_ | 6 #define BIN_EXTENSIONS_H_ |
7 | 7 |
8 #include "include/dart_api.h" | 8 #include "include/dart_api.h" |
9 #include "platform/globals.h" | 9 #include "platform/globals.h" |
10 | 10 |
11 | |
12 namespace dart { | 11 namespace dart { |
13 namespace bin { | 12 namespace bin { |
14 | 13 |
15 class Extensions { | 14 class Extensions { |
16 public: | 15 public: |
17 // TODO(whesse): Make extension load from a relative path relative to | 16 // TODO(whesse): Make extension load from a relative path relative to |
18 // the library it is in. Currently loads from current working directory. | 17 // the library it is in. Currently loads from current working directory. |
19 static Dart_Handle LoadExtension(const char* extension_directory, | 18 static Dart_Handle LoadExtension(const char* extension_directory, |
20 const char* extension_filename, | 19 const char* extension_filename, |
21 const char* extension_name, | 20 const char* extension_name, |
22 Dart_Handle parent_library); | 21 Dart_Handle parent_library); |
23 | 22 |
24 // Platform-specific implementations. | 23 // Platform-specific implementations. |
25 static void* LoadExtensionLibrary(const char* library_file); | 24 static void* LoadExtensionLibrary(const char* library_file); |
26 static void* ResolveSymbol(void* lib_handle, const char* symbol); | 25 static void* ResolveSymbol(void* lib_handle, const char* symbol); |
27 | 26 |
28 private: | 27 private: |
29 static Dart_Handle GetError(); | 28 static Dart_Handle GetError(); |
30 | 29 |
31 // The returned string must be freed. | 30 // The returned string is scope allocated. |
32 static char* Concatenate(const char** strings); | 31 static const char* Concatenate(const char** strings); |
33 | 32 |
34 DISALLOW_ALLOCATION(); | 33 DISALLOW_ALLOCATION(); |
35 DISALLOW_IMPLICIT_CONSTRUCTORS(Extensions); | 34 DISALLOW_IMPLICIT_CONSTRUCTORS(Extensions); |
36 }; | 35 }; |
37 | 36 |
38 } // namespace bin | 37 } // namespace bin |
39 } // namespace dart | 38 } // namespace dart |
40 | 39 |
41 #endif // BIN_EXTENSIONS_H_ | 40 #endif // BIN_EXTENSIONS_H_ |
OLD | NEW |