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_BUILTIN_H_ | 5 #ifndef BIN_BUILTIN_H_ |
6 #define BIN_BUILTIN_H_ | 6 #define BIN_BUILTIN_H_ |
7 | 7 |
8 #include <stdio.h> | 8 #include <stdio.h> |
9 #include <stdlib.h> | 9 #include <stdlib.h> |
10 | 10 |
(...skipping 12 matching lines...) Expand all Loading... |
23 extern void FUNCTION_NAME(name)(Dart_NativeArguments args); | 23 extern void FUNCTION_NAME(name)(Dart_NativeArguments args); |
24 | 24 |
25 | 25 |
26 class Builtin { | 26 class Builtin { |
27 public: | 27 public: |
28 // Note: Changes to this enum should be accompanied with changes to | 28 // Note: Changes to this enum should be accompanied with changes to |
29 // the builtin_libraries_ array in builtin.cc and builtin_nolib.cc. | 29 // the builtin_libraries_ array in builtin.cc and builtin_nolib.cc. |
30 enum BuiltinLibraryId { | 30 enum BuiltinLibraryId { |
31 kBuiltinLibrary = 0, | 31 kBuiltinLibrary = 0, |
32 kIOLibrary, | 32 kIOLibrary, |
| 33 kHTMLLibrary, |
| 34 kHTMLCommonLibrary, |
| 35 kJSLibrary, |
| 36 kBlinkLibrary, |
| 37 kIndexedDbLibrary, |
| 38 kCachedPatchesLibrary, |
| 39 kWebGlLibrary, |
| 40 kMetaDataLibrary, |
| 41 kWebSqlLibrary, |
| 42 kSvgLibrary, |
| 43 kWebAudioLibrary, |
33 | 44 |
34 kInvalidLibrary, | 45 kInvalidLibrary, |
35 }; | 46 }; |
36 | 47 |
37 // Get source corresponding to built in library specified in 'id'. | 48 // Get source corresponding to built in library specified in 'id'. |
38 static Dart_Handle Source(BuiltinLibraryId id); | 49 static Dart_Handle Source(BuiltinLibraryId id); |
39 | 50 |
40 // Get source of part file specified in 'uri'. | 51 // Get source of part file specified in 'uri'. |
41 static Dart_Handle PartSource(BuiltinLibraryId id, const char* part_uri); | 52 static Dart_Handle PartSource(BuiltinLibraryId id, const char* part_uri); |
42 | 53 |
43 // Setup native resolver method built in library specified in 'id'. | 54 // Setup native resolver method built in library specified in 'id'. |
44 static void SetNativeResolver(BuiltinLibraryId id); | 55 static void SetNativeResolver(BuiltinLibraryId id); |
45 | 56 |
46 static Dart_Handle LoadLibrary(Dart_Handle url, BuiltinLibraryId id); | 57 static Dart_Handle LoadLibrary(Dart_Handle url, BuiltinLibraryId id); |
| 58 static BuiltinLibraryId FindId(const char* url_string); |
47 | 59 |
48 // Check if built in library specified in 'id' is already loaded, if not | 60 // Check if built in library specified in 'id' is already loaded, if not |
49 // load it. | 61 // load it. |
50 static Dart_Handle LoadAndCheckLibrary(BuiltinLibraryId id); | 62 static Dart_Handle LoadAndCheckLibrary(BuiltinLibraryId id); |
51 | 63 |
52 static Dart_Handle SetLoadPort(Dart_Port port); | 64 static Dart_Handle SetLoadPort(Dart_Port port); |
53 | 65 |
54 private: | 66 private: |
55 // Map specified URI to an actual file name from 'source_paths' and read | 67 // Map specified URI to an actual file name from 'source_paths' and read |
56 // the file. | 68 // the file. |
57 static Dart_Handle GetSource(const char** source_paths, const char* uri); | 69 static Dart_Handle GetSource(const char** source_paths, const char* uri); |
58 | 70 |
59 // Native method support. | 71 // Native method support. |
60 static Dart_NativeFunction NativeLookup(Dart_Handle name, | 72 static Dart_NativeFunction NativeLookup(Dart_Handle name, |
61 int argument_count, | 73 int argument_count, |
62 bool* auto_setup_scope); | 74 bool* auto_setup_scope); |
63 | 75 |
64 static const uint8_t* NativeSymbol(Dart_NativeFunction nf); | 76 static const uint8_t* NativeSymbol(Dart_NativeFunction nf); |
65 | 77 |
66 static const char* _builtin_source_paths_[]; | 78 static const char* _builtin_source_paths_[]; |
67 static const char* io_source_paths_[]; | 79 static const char* io_source_paths_[]; |
68 static const char* io_patch_paths_[]; | 80 static const char* io_patch_paths_[]; |
| 81 static const char* html_source_paths_[]; |
| 82 static const char* html_common_source_paths_[]; |
| 83 static const char* js_source_paths_[]; |
| 84 static const char* blink_source_paths_[]; |
| 85 static const char* indexeddb_source_paths_[]; |
| 86 static const char* cached_patches_source_paths_[]; |
| 87 static const char* web_gl_source_paths_[]; |
| 88 static const char* metadata_source_paths_[]; |
| 89 static const char* websql_source_paths_[]; |
| 90 static const char* svg_source_paths_[]; |
| 91 static const char* webaudio_source_paths_[]; |
| 92 |
69 static Dart_Port load_port_; | 93 static Dart_Port load_port_; |
70 | 94 |
71 typedef struct { | 95 typedef struct { |
72 const char* url_; | 96 const char* url_; |
73 const char** source_paths_; | 97 const char** source_paths_; |
74 const char* patch_url_; | 98 const char* patch_url_; |
75 const char** patch_paths_; | 99 const char** patch_paths_; |
76 bool has_natives_; | 100 bool has_natives_; |
77 } builtin_lib_props; | 101 } builtin_lib_props; |
78 static builtin_lib_props builtin_libraries_[]; | 102 static builtin_lib_props builtin_libraries_[]; |
79 | 103 |
80 DISALLOW_ALLOCATION(); | 104 DISALLOW_ALLOCATION(); |
81 DISALLOW_IMPLICIT_CONSTRUCTORS(Builtin); | 105 DISALLOW_IMPLICIT_CONSTRUCTORS(Builtin); |
82 }; | 106 }; |
83 | 107 |
84 } // namespace bin | 108 } // namespace bin |
85 } // namespace dart | 109 } // namespace dart |
86 | 110 |
87 #endif // BIN_BUILTIN_H_ | 111 #endif // BIN_BUILTIN_H_ |
OLD | NEW |