| 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 RUNTIME_BIN_DARTUTILS_H_ | 5 #ifndef RUNTIME_BIN_DARTUTILS_H_ |
| 6 #define RUNTIME_BIN_DARTUTILS_H_ | 6 #define RUNTIME_BIN_DARTUTILS_H_ |
| 7 | 7 |
| 8 #include "bin/isolate_data.h" | 8 #include "bin/isolate_data.h" |
| 9 #include "include/dart_api.h" | 9 #include "include/dart_api.h" |
| 10 #include "include/dart_native_api.h" | 10 #include "include/dart_native_api.h" |
| (...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 193 static Dart_Handle GetCanonicalizableWorkingDirectory(); | 193 static Dart_Handle GetCanonicalizableWorkingDirectory(); |
| 194 | 194 |
| 195 static const char* MapLibraryUrl(const char* url_string); | 195 static const char* MapLibraryUrl(const char* url_string); |
| 196 | 196 |
| 197 static Dart_Handle ResolveUriInWorkingDirectory(Dart_Handle script_uri); | 197 static Dart_Handle ResolveUriInWorkingDirectory(Dart_Handle script_uri); |
| 198 static Dart_Handle ResolveScript(Dart_Handle url); | 198 static Dart_Handle ResolveScript(Dart_Handle url); |
| 199 | 199 |
| 200 enum MagicNumber { | 200 enum MagicNumber { |
| 201 kSnapshotMagicNumber, | 201 kSnapshotMagicNumber, |
| 202 kKernelMagicNumber, | 202 kKernelMagicNumber, |
| 203 kGzipMagicNumber, |
| 203 kUnknownMagicNumber | 204 kUnknownMagicNumber |
| 204 }; | 205 }; |
| 205 | 206 |
| 206 // static const uint8_t* GetMagicNumber(MagicNumber number); | 207 // Checks if the buffer is a script snapshot, kernel file, or gzip file. |
| 207 | 208 static MagicNumber SniffForMagicNumber(const uint8_t* text_buffer, |
| 208 // Sniffs the specified text_buffer to see if it contains the magic number | 209 intptr_t buffer_len); |
| 209 // representing a script snapshot. If the text_buffer is a script snapshot | |
| 210 // the return value is an updated pointer to the text_buffer pointing past | |
| 211 // the magic number value. The 'buffer_len' parameter is also appropriately | |
| 212 // adjusted. | |
| 213 static MagicNumber SniffForMagicNumber(const uint8_t** text_buffer, | |
| 214 intptr_t* buffer_len); | |
| 215 | 210 |
| 216 // Write a magic number to indicate a script snapshot file. | 211 // Write a magic number to indicate a script snapshot file. |
| 217 static void WriteMagicNumber(File* file); | 212 static void WriteSnapshotMagicNumber(File* file); |
| 213 static void SkipSnapshotMagicNumber(const uint8_t** buffer, intptr_t* length); |
| 218 | 214 |
| 219 // Global state that stores the original working directory.. | 215 // Global state that stores the original working directory.. |
| 220 static const char* original_working_directory; | 216 static const char* original_working_directory; |
| 221 | 217 |
| 222 // Global state that captures the URL mappings specified on the command line. | 218 // Global state that captures the URL mappings specified on the command line. |
| 223 static CommandLineOptions* url_mapping; | 219 static CommandLineOptions* url_mapping; |
| 224 | 220 |
| 225 static const char* const kDartScheme; | 221 static const char* const kDartScheme; |
| 226 static const char* const kDartExtensionScheme; | 222 static const char* const kDartExtensionScheme; |
| 227 static const char* const kAsyncLibURL; | 223 static const char* const kAsyncLibURL; |
| (...skipping 413 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 641 bool is_typed_data_; | 637 bool is_typed_data_; |
| 642 | 638 |
| 643 DISALLOW_ALLOCATION(); | 639 DISALLOW_ALLOCATION(); |
| 644 DISALLOW_COPY_AND_ASSIGN(ScopedMemBuffer); | 640 DISALLOW_COPY_AND_ASSIGN(ScopedMemBuffer); |
| 645 }; | 641 }; |
| 646 | 642 |
| 647 } // namespace bin | 643 } // namespace bin |
| 648 } // namespace dart | 644 } // namespace dart |
| 649 | 645 |
| 650 #endif // RUNTIME_BIN_DARTUTILS_H_ | 646 #endif // RUNTIME_BIN_DARTUTILS_H_ |
| OLD | NEW |