| 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 | 5 |
| 6 #include "bin/loader.h" | 6 #include "bin/loader.h" |
| 7 | 7 |
| 8 #include "bin/builtin.h" | 8 #include "bin/builtin.h" |
| 9 #include "bin/dartutils.h" | 9 #include "bin/dartutils.h" |
| 10 #include "bin/extensions.h" | 10 #include "bin/extensions.h" |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 const char* packages_file, | 133 const char* packages_file, |
| 134 const char* working_directory, | 134 const char* working_directory, |
| 135 const char* root_script_uri) { | 135 const char* root_script_uri) { |
| 136 // This port delivers loading messages to the service isolate. | 136 // This port delivers loading messages to the service isolate. |
| 137 Dart_Port loader_port = Builtin::LoadPort(); | 137 Dart_Port loader_port = Builtin::LoadPort(); |
| 138 ASSERT(loader_port != ILLEGAL_PORT); | 138 ASSERT(loader_port != ILLEGAL_PORT); |
| 139 | 139 |
| 140 // Keep in sync with loader.dart. | 140 // Keep in sync with loader.dart. |
| 141 const intptr_t _Dart_kInitLoader = 4; | 141 const intptr_t _Dart_kInitLoader = 4; |
| 142 | 142 |
| 143 Dart_Handle request = Dart_NewList(8); | 143 Dart_Handle request = Dart_NewList(9); |
| 144 Dart_ListSetAt(request, 0, trace_loader ? Dart_True() : Dart_False()); | 144 Dart_ListSetAt(request, 0, trace_loader ? Dart_True() : Dart_False()); |
| 145 Dart_ListSetAt(request, 1, Dart_NewInteger(Dart_GetMainPortId())); | 145 Dart_ListSetAt(request, 1, Dart_NewInteger(Dart_GetMainPortId())); |
| 146 Dart_ListSetAt(request, 2, Dart_NewInteger(_Dart_kInitLoader)); | 146 Dart_ListSetAt(request, 2, Dart_NewInteger(_Dart_kInitLoader)); |
| 147 Dart_ListSetAt(request, 3, Dart_NewSendPort(port_)); | 147 Dart_ListSetAt(request, 3, Dart_NewSendPort(port_)); |
| 148 Dart_ListSetAt(request, 4, (package_root == NULL) | 148 Dart_ListSetAt(request, 4, (package_root == NULL) |
| 149 ? Dart_Null() | 149 ? Dart_Null() |
| 150 : Dart_NewStringFromCString(package_root)); | 150 : Dart_NewStringFromCString(package_root)); |
| 151 Dart_ListSetAt(request, 5, (packages_file == NULL) | 151 Dart_ListSetAt(request, 5, (packages_file == NULL) |
| 152 ? Dart_Null() | 152 ? Dart_Null() |
| 153 : Dart_NewStringFromCString(packages_file)); | 153 : Dart_NewStringFromCString(packages_file)); |
| 154 Dart_ListSetAt(request, 6, Dart_NewStringFromCString(working_directory)); | 154 Dart_ListSetAt(request, 6, Dart_NewStringFromCString(working_directory)); |
| 155 Dart_ListSetAt(request, 7, (root_script_uri == NULL) | 155 Dart_ListSetAt(request, 7, (root_script_uri == NULL) |
| 156 ? Dart_Null() | 156 ? Dart_Null() |
| 157 : Dart_NewStringFromCString(root_script_uri)); | 157 : Dart_NewStringFromCString(root_script_uri)); |
| 158 Dart_ListSetAt(request, 8, Dart_NewBoolean(Dart_IsReloading())); |
| 159 |
| 158 | 160 |
| 159 bool success = Dart_Post(loader_port, request); | 161 bool success = Dart_Post(loader_port, request); |
| 160 ASSERT(success); | 162 ASSERT(success); |
| 161 } | 163 } |
| 162 | 164 |
| 163 | 165 |
| 164 void Loader::SendImportExtensionRequest(Dart_Handle url, | 166 void Loader::SendImportExtensionRequest(Dart_Handle url, |
| 165 Dart_Handle library_url) { | 167 Dart_Handle library_url) { |
| 166 // This port delivers loading messages to the service isolate. | 168 // This port delivers loading messages to the service isolate. |
| 167 Dart_Port loader_port = Builtin::LoadPort(); | 169 Dart_Port loader_port = Builtin::LoadPort(); |
| (...skipping 738 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 906 MutexLocker ml(loader_infos_lock_); | 908 MutexLocker ml(loader_infos_lock_); |
| 907 Loader* loader = LoaderForLocked(dest_port_id); | 909 Loader* loader = LoaderForLocked(dest_port_id); |
| 908 if (loader == NULL) { | 910 if (loader == NULL) { |
| 909 return; | 911 return; |
| 910 } | 912 } |
| 911 loader->QueueMessage(message); | 913 loader->QueueMessage(message); |
| 912 } | 914 } |
| 913 | 915 |
| 914 } // namespace bin | 916 } // namespace bin |
| 915 } // namespace dart | 917 } // namespace dart |
| OLD | NEW |