| 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_DARTUTILS_H_ | 5 #ifndef BIN_DARTUTILS_H_ |
| 6 #define BIN_DARTUTILS_H_ | 6 #define BIN_DARTUTILS_H_ |
| 7 | 7 |
| 8 #include "include/dart_api.h" | 8 #include "include/dart_api.h" |
| 9 #include "include/dart_native_api.h" | 9 #include "include/dart_native_api.h" |
| 10 | 10 |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 static bool IsDartSchemeURL(const char* url_name); | 111 static bool IsDartSchemeURL(const char* url_name); |
| 112 static bool IsDartExtensionSchemeURL(const char* url_name); | 112 static bool IsDartExtensionSchemeURL(const char* url_name); |
| 113 static bool IsDartIOLibURL(const char* url_name); | 113 static bool IsDartIOLibURL(const char* url_name); |
| 114 static bool IsDartBuiltinLibURL(const char* url_name); | 114 static bool IsDartBuiltinLibURL(const char* url_name); |
| 115 static bool IsHttpSchemeURL(const char* url_name); | 115 static bool IsHttpSchemeURL(const char* url_name); |
| 116 static void* OpenFile(const char* name, bool write); | 116 static void* OpenFile(const char* name, bool write); |
| 117 static void ReadFile(const uint8_t** data, intptr_t* file_len, void* stream); | 117 static void ReadFile(const uint8_t** data, intptr_t* file_len, void* stream); |
| 118 static void WriteFile(const void* buffer, intptr_t num_bytes, void* stream); | 118 static void WriteFile(const void* buffer, intptr_t num_bytes, void* stream); |
| 119 static void CloseFile(void* stream); | 119 static void CloseFile(void* stream); |
| 120 static bool EntropySource(uint8_t* buffer, intptr_t length); | 120 static bool EntropySource(uint8_t* buffer, intptr_t length); |
| 121 | |
| 122 static Dart_Handle ReadStringFromFile(const char* filename); | 121 static Dart_Handle ReadStringFromFile(const char* filename); |
| 123 static Dart_Handle ReadStringFromHttp(const char* filename); | |
| 124 static Dart_Handle LibraryTagHandler(Dart_LibraryTag tag, | 122 static Dart_Handle LibraryTagHandler(Dart_LibraryTag tag, |
| 125 Dart_Handle library, | 123 Dart_Handle library, |
| 126 Dart_Handle url); | 124 Dart_Handle url); |
| 127 static Dart_Handle LoadScript(const char* script_uri, | 125 static Dart_Handle LoadScript(const char* script_uri, |
| 128 Dart_Handle builtin_lib); | 126 Dart_Handle builtin_lib); |
| 129 static Dart_Handle LoadScriptHttp(Dart_Handle script_uri, | |
| 130 Dart_Handle builtin_lib); | |
| 131 static Dart_Handle LoadSource(Dart_Handle library, | 127 static Dart_Handle LoadSource(Dart_Handle library, |
| 132 Dart_Handle url, | 128 Dart_Handle url, |
| 133 Dart_LibraryTag tag, | 129 Dart_LibraryTag tag, |
| 134 const char* filename); | 130 Dart_Handle builtin_lib); |
| 135 static Dart_Handle PrepareForScriptLoading(const char* package_root, | 131 static Dart_Handle PrepareForScriptLoading(const char* package_root, |
| 136 Dart_Handle builtin_lib); | 132 Dart_Handle builtin_lib); |
| 137 | 133 |
| 138 static bool PostNull(Dart_Port port_id); | 134 static bool PostNull(Dart_Port port_id); |
| 139 static bool PostInt32(Dart_Port port_id, int32_t value); | 135 static bool PostInt32(Dart_Port port_id, int32_t value); |
| 140 static bool PostInt64(Dart_Port port_id, int64_t value); | 136 static bool PostInt64(Dart_Port port_id, int64_t value); |
| 141 | 137 |
| 142 static Dart_Handle GetDartType(const char* library_url, | 138 static Dart_Handle GetDartType(const char* library_url, |
| 143 const char* class_name); | 139 const char* class_name); |
| 144 // Create a new Dart OSError object with the current OS error. | 140 // Create a new Dart OSError object with the current OS error. |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 181 static Dart_Handle FilePathFromUri(Dart_Handle script_uri, | 177 static Dart_Handle FilePathFromUri(Dart_Handle script_uri, |
| 182 Dart_Handle builtin_lib); | 178 Dart_Handle builtin_lib); |
| 183 | 179 |
| 184 static Dart_Handle ExtensionPathFromUri(Dart_Handle extension_uri, | 180 static Dart_Handle ExtensionPathFromUri(Dart_Handle extension_uri, |
| 185 Dart_Handle builtin_lib); | 181 Dart_Handle builtin_lib); |
| 186 | 182 |
| 187 static Dart_Handle ResolveUri(Dart_Handle library_url, | 183 static Dart_Handle ResolveUri(Dart_Handle library_url, |
| 188 Dart_Handle url, | 184 Dart_Handle url, |
| 189 Dart_Handle builtin_lib); | 185 Dart_Handle builtin_lib); |
| 190 | 186 |
| 191 static Dart_Handle LoadScriptDataAsync(Dart_Handle script_uri, | |
| 192 Dart_Handle builtin_lib); | |
| 193 | |
| 194 // Sniffs the specified text_buffer to see if it contains the magic number | 187 // Sniffs the specified text_buffer to see if it contains the magic number |
| 195 // representing a script snapshot. If the text_buffer is a script snapshot | 188 // representing a script snapshot. If the text_buffer is a script snapshot |
| 196 // the return value is an updated pointer to the text_buffer pointing past | 189 // the return value is an updated pointer to the text_buffer pointing past |
| 197 // the magic number value. The 'buffer_len' parameter is also appropriately | 190 // the magic number value. The 'buffer_len' parameter is also appropriately |
| 198 // adjusted. | 191 // adjusted. |
| 199 static const uint8_t* SniffForMagicNumber(const uint8_t* text_buffer, | 192 static const uint8_t* SniffForMagicNumber(const uint8_t* text_buffer, |
| 200 intptr_t* buffer_len, | 193 intptr_t* buffer_len, |
| 201 bool* is_snapshot); | 194 bool* is_snapshot); |
| 202 | 195 |
| 203 // Write a magic number to indicate a script snapshot file. | 196 // Write a magic number to indicate a script snapshot file. |
| (...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 551 | 544 |
| 552 ~ScopedBlockingCall() { | 545 ~ScopedBlockingCall() { |
| 553 Dart_IsolateUnblocked(); | 546 Dart_IsolateUnblocked(); |
| 554 } | 547 } |
| 555 }; | 548 }; |
| 556 | 549 |
| 557 } // namespace bin | 550 } // namespace bin |
| 558 } // namespace dart | 551 } // namespace dart |
| 559 | 552 |
| 560 #endif // BIN_DARTUTILS_H_ | 553 #endif // BIN_DARTUTILS_H_ |
| OLD | NEW |