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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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(Dart_LibraryTag tag, |
93 Dart_Handle url, | 96 Dart_Handle url, |
94 Dart_Handle library_url); | 97 Dart_Handle library_url); |
95 | 98 |
| 99 static Dart_Handle SendAndProcessReply(Dart_LibraryTag tag, |
| 100 Dart_Handle url, |
| 101 uint8_t** payload, |
| 102 intptr_t* payload_length); |
| 103 |
96 // Send a request from the tag handler to the kernel isolate. | 104 // Send a request from the tag handler to the kernel isolate. |
97 void SendKernelRequest(Dart_LibraryTag tag, Dart_Handle url); | 105 void SendKernelRequest(Dart_LibraryTag tag, Dart_Handle url); |
98 | 106 |
99 /// Queue |message| and notify the loader that a message is available. | 107 /// Queue |message| and notify the loader that a message is available. |
100 void QueueMessage(Dart_CObject* message); | 108 void QueueMessage(Dart_CObject* message); |
101 | 109 |
102 /// Blocks the caller until the loader is finished. | 110 /// Blocks the caller until the loader is finished. |
103 void BlockUntilComplete(ProcessResult process_result); | 111 void BlockUntilComplete(ProcessResult process_result); |
104 | 112 |
105 /// Returns false if |result| is an error and the loader should quit. | 113 /// Returns false if |result| is an error and the loader should quit. |
106 static bool ProcessResultLocked(Loader* loader, IOResult* result); | 114 static bool ProcessResultLocked(Loader* loader, IOResult* result); |
107 | 115 |
108 /// Returns false if |result| is an error and the loader should quit. | 116 /// Returns false if |result| is an error and the loader should quit. |
109 static bool ProcessUrlLoadResultLocked(Loader* loader, IOResult* result); | 117 static bool ProcessPayloadResultLocked(Loader* loader, IOResult* result); |
110 | 118 |
111 /// Returns false if an error occurred and the loader should quit. | 119 /// Returns false if an error occurred and the loader should quit. |
112 bool ProcessQueueLocked(ProcessResult process_result); | 120 bool ProcessQueueLocked(ProcessResult process_result); |
113 | 121 |
114 // Special inner tag handler for dart: uris. | 122 // Special inner tag handler for dart: uris. |
115 static Dart_Handle DartColonLibraryTagHandler(Dart_LibraryTag tag, | 123 static Dart_Handle DartColonLibraryTagHandler(Dart_LibraryTag tag, |
116 Dart_Handle library, | 124 Dart_Handle library, |
117 Dart_Handle url, | 125 Dart_Handle url, |
118 const char* library_url_string, | 126 const char* library_url_string, |
119 const char* url_string); | 127 const char* url_string); |
(...skipping 22 matching lines...) Expand all Loading... |
142 | 150 |
143 // This is the global callback for the native message handlers. | 151 // This is the global callback for the native message handlers. |
144 static void NativeMessageHandler(Dart_Port dest_port_id, | 152 static void NativeMessageHandler(Dart_Port dest_port_id, |
145 Dart_CObject* message); | 153 Dart_CObject* message); |
146 }; | 154 }; |
147 | 155 |
148 } // namespace bin | 156 } // namespace bin |
149 } // namespace dart | 157 } // namespace dart |
150 | 158 |
151 #endif // RUNTIME_BIN_LOADER_H_ | 159 #endif // RUNTIME_BIN_LOADER_H_ |
OLD | NEW |