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 15 matching lines...) Expand all Loading... |
26 static Dart_Handle LoadUrlContents(Dart_Handle url, | 26 static Dart_Handle LoadUrlContents(Dart_Handle url, |
27 uint8_t** payload, | 27 uint8_t** payload, |
28 intptr_t* payload_length); | 28 intptr_t* payload_length); |
29 | 29 |
30 | 30 |
31 // A static tag handler that hides all usage of a loader for an isolate. | 31 // A static tag handler that hides all usage of a loader for an isolate. |
32 static Dart_Handle LibraryTagHandler(Dart_LibraryTag tag, | 32 static Dart_Handle LibraryTagHandler(Dart_LibraryTag tag, |
33 Dart_Handle library, | 33 Dart_Handle library, |
34 Dart_Handle url); | 34 Dart_Handle url); |
35 | 35 |
36 Dart_Handle error() const { | 36 Dart_Handle error() const { return error_; } |
37 return error_; | |
38 } | |
39 | 37 |
40 static void InitOnce(); | 38 static void InitOnce(); |
41 | 39 |
42 private: | 40 private: |
43 // The port assigned to our native message handler. | 41 // The port assigned to our native message handler. |
44 Dart_Port port_; | 42 Dart_Port port_; |
45 // Each Loader is associated with an Isolate via its IsolateData. | 43 // Each Loader is associated with an Isolate via its IsolateData. |
46 IsolateData* isolate_data_; | 44 IsolateData* isolate_data_; |
47 // Remember the first error that occurs during loading. | 45 // Remember the first error that occurs during loading. |
48 Dart_Handle error_; | 46 Dart_Handle error_; |
(...skipping 30 matching lines...) Expand all Loading... |
79 return *static_cast<volatile intptr_t*>(&results_length_); | 77 return *static_cast<volatile intptr_t*>(&results_length_); |
80 } | 78 } |
81 | 79 |
82 // Send the loader init request to the service isolate. | 80 // Send the loader init request to the service isolate. |
83 void Init(const char* package_root, | 81 void Init(const char* package_root, |
84 const char* packages_file, | 82 const char* packages_file, |
85 const char* working_directory, | 83 const char* working_directory, |
86 const char* root_script_uri); | 84 const char* root_script_uri); |
87 | 85 |
88 // Send a request for a dart-ext: import to the service isolate. | 86 // Send a request for a dart-ext: import to the service isolate. |
89 void SendImportExtensionRequest(Dart_Handle url, | 87 void SendImportExtensionRequest(Dart_Handle url, Dart_Handle library_url); |
90 Dart_Handle library_url); | |
91 | 88 |
92 // Send a request from the tag handler to the service isolate. | 89 // Send a request from the tag handler to the service isolate. |
93 void SendRequest(Dart_LibraryTag tag, | 90 void SendRequest(Dart_LibraryTag tag, |
94 Dart_Handle url, | 91 Dart_Handle url, |
95 Dart_Handle library_url); | 92 Dart_Handle library_url); |
96 | 93 |
97 /// Queue |message| and notify the loader that a message is available. | 94 /// Queue |message| and notify the loader that a message is available. |
98 void QueueMessage(Dart_CObject* message); | 95 void QueueMessage(Dart_CObject* message); |
99 | 96 |
100 /// Blocks the caller until the loader is finished. | 97 /// Blocks the caller until the loader is finished. |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
140 | 137 |
141 // This is the global callback for the native message handlers. | 138 // This is the global callback for the native message handlers. |
142 static void NativeMessageHandler(Dart_Port dest_port_id, | 139 static void NativeMessageHandler(Dart_Port dest_port_id, |
143 Dart_CObject* message); | 140 Dart_CObject* message); |
144 }; | 141 }; |
145 | 142 |
146 } // namespace bin | 143 } // namespace bin |
147 } // namespace dart | 144 } // namespace dart |
148 | 145 |
149 #endif // RUNTIME_BIN_LOADER_H_ | 146 #endif // RUNTIME_BIN_LOADER_H_ |
OLD | NEW |