| OLD | NEW |
| 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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_LOADER_H_ | 5 #ifndef RUNTIME_BIN_LOADER_H_ |
| 6 #define RUNTIME_BIN_LOADER_H_ | 6 #define RUNTIME_BIN_LOADER_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 11 matching lines...) Expand all Loading... |
| 22 | 22 |
| 23 static void InitForSnapshot(const char* snapshot_uri); | 23 static void InitForSnapshot(const char* snapshot_uri); |
| 24 | 24 |
| 25 static Dart_Handle ReloadNativeExtensions(); | 25 static Dart_Handle ReloadNativeExtensions(); |
| 26 | 26 |
| 27 // Loads contents of the specified url. | 27 // Loads contents of the specified url. |
| 28 static Dart_Handle LoadUrlContents(Dart_Handle url, | 28 static Dart_Handle LoadUrlContents(Dart_Handle url, |
| 29 uint8_t** payload, | 29 uint8_t** payload, |
| 30 intptr_t* payload_length); | 30 intptr_t* payload_length); |
| 31 | 31 |
| 32 static Dart_Handle ResolveAsFilePath(Dart_Handle url, |
| 33 uint8_t** payload, |
| 34 intptr_t* payload_length); |
| 32 | 35 |
| 33 // A static tag handler that hides all usage of a loader for an isolate. | 36 // A static tag handler that hides all usage of a loader for an isolate. |
| 34 static Dart_Handle LibraryTagHandler(Dart_LibraryTag tag, | 37 static Dart_Handle LibraryTagHandler(Dart_LibraryTag tag, |
| 35 Dart_Handle library, | 38 Dart_Handle library, |
| 36 Dart_Handle url); | 39 Dart_Handle url); |
| 37 | 40 |
| 38 Dart_Handle error() const { return error_; } | 41 Dart_Handle error() const { return error_; } |
| 39 | 42 |
| 40 static void InitOnce(); | 43 static void InitOnce(); |
| 41 | 44 |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 // Send the loader init request to the service isolate. | 85 // Send the loader init request to the service isolate. |
| 83 void Init(const char* package_root, | 86 void Init(const char* package_root, |
| 84 const char* packages_file, | 87 const char* packages_file, |
| 85 const char* working_directory, | 88 const char* working_directory, |
| 86 const char* root_script_uri); | 89 const char* root_script_uri); |
| 87 | 90 |
| 88 // Send a request for a dart-ext: import to the service isolate. | 91 // Send a request for a dart-ext: import to the service isolate. |
| 89 void SendImportExtensionRequest(Dart_Handle url, Dart_Handle library_url); | 92 void SendImportExtensionRequest(Dart_Handle url, Dart_Handle library_url); |
| 90 | 93 |
| 91 // Send a request from the tag handler to the service isolate. | 94 // Send a request from the tag handler to the service isolate. |
| 92 void SendRequest(Dart_LibraryTag tag, | 95 void SendRequest(intptr_t tag, Dart_Handle url, Dart_Handle library_url); |
| 93 Dart_Handle url, | 96 |
| 94 Dart_Handle library_url); | 97 static Dart_Handle SendAndProcessReply(intptr_t tag, |
| 98 Dart_Handle url, |
| 99 uint8_t** payload, |
| 100 intptr_t* payload_length); |
| 95 | 101 |
| 96 // Send a request from the tag handler to the kernel isolate. | 102 // Send a request from the tag handler to the kernel isolate. |
| 97 void SendKernelRequest(Dart_LibraryTag tag, Dart_Handle url); | 103 void SendKernelRequest(Dart_LibraryTag tag, Dart_Handle url); |
| 98 | 104 |
| 99 /// Queue |message| and notify the loader that a message is available. | 105 /// Queue |message| and notify the loader that a message is available. |
| 100 void QueueMessage(Dart_CObject* message); | 106 void QueueMessage(Dart_CObject* message); |
| 101 | 107 |
| 102 /// Blocks the caller until the loader is finished. | 108 /// Blocks the caller until the loader is finished. |
| 103 void BlockUntilComplete(ProcessResult process_result); | 109 void BlockUntilComplete(ProcessResult process_result); |
| 104 | 110 |
| 105 /// Returns false if |result| is an error and the loader should quit. | 111 /// Returns false if |result| is an error and the loader should quit. |
| 106 static bool ProcessResultLocked(Loader* loader, IOResult* result); | 112 static bool ProcessResultLocked(Loader* loader, IOResult* result); |
| 107 | 113 |
| 108 /// Returns false if |result| is an error and the loader should quit. | 114 /// Returns false if |result| is an error and the loader should quit. |
| 109 static bool ProcessUrlLoadResultLocked(Loader* loader, IOResult* result); | 115 static bool ProcessPayloadResultLocked(Loader* loader, IOResult* result); |
| 110 | 116 |
| 111 /// Returns false if an error occurred and the loader should quit. | 117 /// Returns false if an error occurred and the loader should quit. |
| 112 bool ProcessQueueLocked(ProcessResult process_result); | 118 bool ProcessQueueLocked(ProcessResult process_result); |
| 113 | 119 |
| 114 // Special inner tag handler for dart: uris. | 120 // Special inner tag handler for dart: uris. |
| 115 static Dart_Handle DartColonLibraryTagHandler(Dart_LibraryTag tag, | 121 static Dart_Handle DartColonLibraryTagHandler(Dart_LibraryTag tag, |
| 116 Dart_Handle library, | 122 Dart_Handle library, |
| 117 Dart_Handle url, | 123 Dart_Handle url, |
| 118 const char* library_url_string, | 124 const char* library_url_string, |
| 119 const char* url_string); | 125 const char* url_string); |
| (...skipping 22 matching lines...) Expand all Loading... |
| 142 | 148 |
| 143 // This is the global callback for the native message handlers. | 149 // This is the global callback for the native message handlers. |
| 144 static void NativeMessageHandler(Dart_Port dest_port_id, | 150 static void NativeMessageHandler(Dart_Port dest_port_id, |
| 145 Dart_CObject* message); | 151 Dart_CObject* message); |
| 146 }; | 152 }; |
| 147 | 153 |
| 148 } // namespace bin | 154 } // namespace bin |
| 149 } // namespace dart | 155 } // namespace dart |
| 150 | 156 |
| 151 #endif // RUNTIME_BIN_LOADER_H_ | 157 #endif // RUNTIME_BIN_LOADER_H_ |
| OLD | NEW |