Chromium Code Reviews| Index: runtime/bin/loader.cc |
| diff --git a/runtime/bin/loader.cc b/runtime/bin/loader.cc |
| index 70ee44471d6628f2a7a1892515fe274d6a771c2b..37fd806091b1ccc3a69a5f282b7a9fdfaa7d5d23 100644 |
| --- a/runtime/bin/loader.cc |
| +++ b/runtime/bin/loader.cc |
| @@ -20,6 +20,7 @@ namespace bin { |
| static bool trace_loader = false; |
| // Keep in sync with loader.dart. |
| static const intptr_t _Dart_kImportExtension = 9; |
| +static const intptr_t _Dart_kResolveAsFilePath = 10; |
| Loader::Loader(IsolateData* isolate_data) |
| : port_(ILLEGAL_PORT), |
| @@ -424,7 +425,7 @@ bool Loader::ProcessResultLocked(Loader* loader, Loader::IOResult* result) { |
| } |
| -bool Loader::ProcessUrlLoadResultLocked(Loader* loader, |
| +bool Loader::ProcessPayloadResultLocked(Loader* loader, |
| Loader::IOResult* result) { |
| // A negative result tag indicates a loading error occurred in the service |
| // isolate. The payload is a C string of the error message. |
| @@ -517,9 +518,10 @@ Dart_Handle Loader::ReloadNativeExtensions() { |
| } |
| -Dart_Handle Loader::LoadUrlContents(Dart_Handle url, |
| - uint8_t** payload, |
| - intptr_t* payload_length) { |
| +Dart_Handle Loader::SendAndProcessReply(Dart_LibraryTag tag, |
| + Dart_Handle url, |
| + uint8_t** payload, |
| + intptr_t* payload_length) { |
| IsolateData* isolate_data = |
| reinterpret_cast<IsolateData*>(Dart_CurrentIsolateData()); |
| ASSERT(isolate_data != NULL); |
| @@ -534,10 +536,10 @@ Dart_Handle Loader::LoadUrlContents(Dart_Handle url, |
| ASSERT(isolate_data->HasLoader()); |
| // Now send a load request to the service isolate. |
| - loader->SendRequest(Dart_kScriptTag, url, Dart_Null()); |
| + loader->SendRequest(tag, url, Dart_Null()); |
| // Wait for a reply to the load request. |
| - loader->BlockUntilComplete(ProcessUrlLoadResultLocked); |
| + loader->BlockUntilComplete(ProcessPayloadResultLocked); |
| // Copy fields from the loader before deleting it. |
| // The payload array itself which was malloced above is freed by |
| @@ -557,6 +559,23 @@ Dart_Handle Loader::LoadUrlContents(Dart_Handle url, |
| } |
| +Dart_Handle Loader::LoadUrlContents(Dart_Handle url, |
| + uint8_t** payload, |
| + intptr_t* payload_length) { |
| + return SendAndProcessReply(Dart_kScriptTag, url, payload, payload_length); |
| +} |
| + |
| + |
| +Dart_Handle Loader::ResolveAsFilePath(Dart_Handle url, |
| + uint8_t** payload, |
| + intptr_t* payload_length) { |
| + // TODO(28863) The use of tags that aren't declared in dart_api.h's enum |
|
Cutch
2017/02/23 19:09:58
I don't understand the issue here? These tags are
rmacnak
2017/02/23 19:27:41
The cast here invokes undefined behavior because _
|
| + // is undefined behavior. |
| + Dart_LibraryTag tag = static_cast<Dart_LibraryTag>(_Dart_kResolveAsFilePath); |
| + return SendAndProcessReply(tag, url, payload, payload_length); |
| +} |
| + |
| + |
| Dart_Handle Loader::LibraryTagHandler(Dart_LibraryTag tag, |
| Dart_Handle library, |
| Dart_Handle url) { |