Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(113)

Side by Side Diff: runtime/bin/dartutils.cc

Issue 1998963003: Rework standalone to use a synchronous loader that does not invoke Dart code (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « runtime/bin/dartutils.h ('k') | runtime/bin/isolate_data.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 #include "bin/dartutils.h" 5 #include "bin/dartutils.h"
6 6
7 #include "bin/crypto.h" 7 #include "bin/crypto.h"
8 #include "bin/directory.h" 8 #include "bin/directory.h"
9 #include "bin/extensions.h" 9 #include "bin/extensions.h"
10 #include "bin/file.h" 10 #include "bin/file.h"
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after
327 327
328 Dart_Handle DartUtils::SetWorkingDirectory() { 328 Dart_Handle DartUtils::SetWorkingDirectory() {
329 IsolateData* isolate_data = 329 IsolateData* isolate_data =
330 reinterpret_cast<IsolateData*>(Dart_CurrentIsolateData()); 330 reinterpret_cast<IsolateData*>(Dart_CurrentIsolateData());
331 Dart_Handle builtin_lib = isolate_data->builtin_lib(); 331 Dart_Handle builtin_lib = isolate_data->builtin_lib();
332 Dart_Handle directory = NewString(original_working_directory); 332 Dart_Handle directory = NewString(original_working_directory);
333 return SingleArgDart_Invoke(builtin_lib, "_setWorkingDirectory", directory); 333 return SingleArgDart_Invoke(builtin_lib, "_setWorkingDirectory", directory);
334 } 334 }
335 335
336 336
337 Dart_Handle DartUtils::ResolveUri(Dart_Handle library_url, Dart_Handle url) {
338 const int kNumArgs = 2;
339 Dart_Handle dart_args[kNumArgs];
340 dart_args[0] = library_url;
341 dart_args[1] = url;
342 return Dart_Invoke(DartUtils::BuiltinLib(),
343 NewString("_resolveUri"),
344 kNumArgs,
345 dart_args);
346 }
347
348
349 Dart_Handle DartUtils::ResolveUriInWorkingDirectory(Dart_Handle script_uri) { 337 Dart_Handle DartUtils::ResolveUriInWorkingDirectory(Dart_Handle script_uri) {
350 const int kNumArgs = 1; 338 const int kNumArgs = 1;
351 Dart_Handle dart_args[kNumArgs]; 339 Dart_Handle dart_args[kNumArgs];
352 dart_args[0] = script_uri; 340 dart_args[0] = script_uri;
353 return Dart_Invoke(DartUtils::BuiltinLib(), 341 return Dart_Invoke(DartUtils::BuiltinLib(),
354 NewString("_resolveInWorkingDirectory"), 342 NewString("_resolveInWorkingDirectory"),
355 kNumArgs, 343 kNumArgs,
356 dart_args); 344 dart_args);
357 } 345 }
358 346
(...skipping 13 matching lines...) Expand all
372 const int kNumArgs = 1; 360 const int kNumArgs = 1;
373 Dart_Handle dart_args[kNumArgs]; 361 Dart_Handle dart_args[kNumArgs];
374 dart_args[0] = library_uri; 362 dart_args[0] = library_uri;
375 return Dart_Invoke(DartUtils::BuiltinLib(), 363 return Dart_Invoke(DartUtils::BuiltinLib(),
376 NewString("_libraryFilePath"), 364 NewString("_libraryFilePath"),
377 kNumArgs, 365 kNumArgs,
378 dart_args); 366 dart_args);
379 } 367 }
380 368
381 369
370 Dart_Handle DartUtils::ResolveUri(Dart_Handle library_url, Dart_Handle url) {
371 const int kNumArgs = 2;
372 Dart_Handle dart_args[kNumArgs];
373 dart_args[0] = library_url;
374 dart_args[1] = url;
375 return Dart_Invoke(DartUtils::BuiltinLib(),
376 NewString("_resolveUri"),
377 kNumArgs,
378 dart_args);
379 }
380
381
382 Dart_Handle DartUtils::ResolveScript(Dart_Handle url) {
383 const int kNumArgs = 1;
384 Dart_Handle dart_args[kNumArgs];
385 dart_args[0] = url;
386 return Dart_Invoke(DartUtils::BuiltinLib(),
387 NewString("_resolveScriptUri"),
388 kNumArgs,
389 dart_args);
390 }
391
392
382 static Dart_Handle LoadDataAsync_Invoke(Dart_Handle tag, 393 static Dart_Handle LoadDataAsync_Invoke(Dart_Handle tag,
383 Dart_Handle url, 394 Dart_Handle url,
384 Dart_Handle library_url) { 395 Dart_Handle library_url) {
385 const int kNumArgs = 3; 396 const int kNumArgs = 3;
386 Dart_Handle dart_args[kNumArgs]; 397 Dart_Handle dart_args[kNumArgs];
387 dart_args[0] = tag; 398 dart_args[0] = tag;
388 dart_args[1] = url; 399 dart_args[1] = url;
389 dart_args[2] = library_url; 400 dart_args[2] = library_url;
390 return Dart_Invoke(DartUtils::BuiltinLib(), 401 return Dart_Invoke(DartUtils::BuiltinLib(),
391 DartUtils::NewString("_loadDataAsync"), 402 DartUtils::NewString("_loadDataAsync"),
(...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after
735 kNumArgs, 746 kNumArgs,
736 dart_args); 747 dart_args);
737 RETURN_IF_ERROR(result); 748 RETURN_IF_ERROR(result);
738 } else if (packages_config != NULL) { 749 } else if (packages_config != NULL) {
739 Dart_Handle result = NewString(packages_config); 750 Dart_Handle result = NewString(packages_config);
740 RETURN_IF_ERROR(result); 751 RETURN_IF_ERROR(result);
741 const int kNumArgs = 1; 752 const int kNumArgs = 1;
742 Dart_Handle dart_args[kNumArgs]; 753 Dart_Handle dart_args[kNumArgs];
743 dart_args[0] = result; 754 dart_args[0] = result;
744 result = Dart_Invoke(DartUtils::BuiltinLib(), 755 result = Dart_Invoke(DartUtils::BuiltinLib(),
745 NewString("_loadPackagesMap"), 756 NewString("_setPackagesMap"),
746 kNumArgs, 757 kNumArgs,
747 dart_args); 758 dart_args);
748 RETURN_IF_ERROR(result); 759 RETURN_IF_ERROR(result);
749 } 760 }
750 return Dart_True(); 761 return Dart_True();
751 } 762 }
752 763
753 764
754 Dart_Handle DartUtils::PrepareForScriptLoading(bool is_service_isolate, 765 Dart_Handle DartUtils::PrepareForScriptLoading(bool is_service_isolate,
755 bool trace_loading) { 766 bool trace_loading) {
(...skipping 503 matching lines...) Expand 10 before | Expand all | Expand 10 after
1259 new CObjectString(CObject::NewString(os_error->message())); 1270 new CObjectString(CObject::NewString(os_error->message()));
1260 CObjectArray* result = new CObjectArray(CObject::NewArray(3)); 1271 CObjectArray* result = new CObjectArray(CObject::NewArray(3));
1261 result->SetAt(0, new CObjectInt32(CObject::NewInt32(kOSError))); 1272 result->SetAt(0, new CObjectInt32(CObject::NewInt32(kOSError)));
1262 result->SetAt(1, new CObjectInt32(CObject::NewInt32(os_error->code()))); 1273 result->SetAt(1, new CObjectInt32(CObject::NewInt32(os_error->code())));
1263 result->SetAt(2, error_message); 1274 result->SetAt(2, error_message);
1264 return result; 1275 return result;
1265 } 1276 }
1266 1277
1267 } // namespace bin 1278 } // namespace bin
1268 } // namespace dart 1279 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/bin/dartutils.h ('k') | runtime/bin/isolate_data.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698