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

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

Issue 16092007: HTTP loading tests and package root support (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 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 | Annotate | Revision Log
« no previous file with comments | « runtime/bin/builtin.dart ('k') | tests/standalone/http_launch_data/http_isolate_main.dart » ('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 "include/dart_api.h" 7 #include "include/dart_api.h"
8 8
9 #include "platform/assert.h" 9 #include "platform/assert.h"
10 #include "platform/globals.h" 10 #include "platform/globals.h"
(...skipping 545 matching lines...) Expand 10 before | Expand all | Expand 10 after
556 if (Dart_IsError(source)) { 556 if (Dart_IsError(source)) {
557 return source; 557 return source;
558 } 558 }
559 return Dart_LoadScript(uri, source, 0, 0); 559 return Dart_LoadScript(uri, source, 0, 0);
560 } 560 }
561 } 561 }
562 562
563 563
564 Dart_Handle DartUtils::LoadScript(const char* script_uri, 564 Dart_Handle DartUtils::LoadScript(const char* script_uri,
565 Dart_Handle builtin_lib) { 565 Dart_Handle builtin_lib) {
566 if (DartUtils::IsHttpSchemeURL(script_uri)) { 566 // Always call ResolveScriptUri because as a side effect it sets
567 return LoadScriptHttp(NewString(script_uri), builtin_lib); 567 // the script entry path which is used when automatically resolving
568 } 568 // package root.
569 Dart_Handle resolved_script_uri; 569 Dart_Handle resolved_script_uri =
570 resolved_script_uri = ResolveScriptUri(NewString(script_uri), builtin_lib); 570 ResolveScriptUri(NewString(script_uri), builtin_lib);
571 if (Dart_IsError(resolved_script_uri)) { 571 if (Dart_IsError(resolved_script_uri)) {
572 return resolved_script_uri; 572 return resolved_script_uri;
573 } 573 }
574 // Handle http: requests separately.
575 if (DartUtils::IsHttpSchemeURL(script_uri)) {
576 return LoadScriptHttp(resolved_script_uri, builtin_lib);
577 }
574 Dart_Handle script_path = DartUtils::FilePathFromUri(resolved_script_uri, 578 Dart_Handle script_path = DartUtils::FilePathFromUri(resolved_script_uri,
575 builtin_lib); 579 builtin_lib);
576 if (Dart_IsError(script_path)) { 580 if (Dart_IsError(script_path)) {
577 return script_path; 581 return script_path;
578 } 582 }
579 const char* script_path_cstr; 583 const char* script_path_cstr;
580 Dart_StringToCString(script_path, &script_path_cstr); 584 Dart_StringToCString(script_path, &script_path_cstr);
581 const char* error_msg = NULL; 585 const char* error_msg = NULL;
582 intptr_t len; 586 intptr_t len;
583 const uint8_t* text_buffer = ReadFileFully(script_path_cstr, 587 const uint8_t* text_buffer = ReadFileFully(script_path_cstr,
(...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after
953 new CObjectString(CObject::NewString(os_error->message())); 957 new CObjectString(CObject::NewString(os_error->message()));
954 CObjectArray* result = new CObjectArray(CObject::NewArray(3)); 958 CObjectArray* result = new CObjectArray(CObject::NewArray(3));
955 result->SetAt(0, new CObjectInt32(CObject::NewInt32(kOSError))); 959 result->SetAt(0, new CObjectInt32(CObject::NewInt32(kOSError)));
956 result->SetAt(1, new CObjectInt32(CObject::NewInt32(os_error->code()))); 960 result->SetAt(1, new CObjectInt32(CObject::NewInt32(os_error->code())));
957 result->SetAt(2, error_message); 961 result->SetAt(2, error_message);
958 return result; 962 return result;
959 } 963 }
960 964
961 } // namespace bin 965 } // namespace bin
962 } // namespace dart 966 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/bin/builtin.dart ('k') | tests/standalone/http_launch_data/http_isolate_main.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698