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

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

Issue 543713002: Reduce the number of Uris parsed in builtin. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 3 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
« runtime/bin/builtin.dart ('K') | « runtime/bin/builtin.dart ('k') | no next file » | 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 #include "include/dart_native_api.h" 8 #include "include/dart_native_api.h"
9 9
10 #include "platform/assert.h" 10 #include "platform/assert.h"
(...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after
373 // Handle URI canonicalization requests. 373 // Handle URI canonicalization requests.
374 if (tag == Dart_kCanonicalizeUrl) { 374 if (tag == Dart_kCanonicalizeUrl) {
375 // If this is a Dart Scheme URL or 'part' of a io library 375 // If this is a Dart Scheme URL or 'part' of a io library
376 // then it is not modified as it will be handled internally. 376 // then it is not modified as it will be handled internally.
377 if (is_dart_scheme_url || is_io_library) { 377 if (is_dart_scheme_url || is_io_library) {
378 return url; 378 return url;
379 } 379 }
380 // Resolve the url within the context of the library's URL. 380 // Resolve the url within the context of the library's URL.
381 Dart_Handle builtin_lib = 381 Dart_Handle builtin_lib =
382 Builtin::LoadAndCheckLibrary(Builtin::kBuiltinLibrary); 382 Builtin::LoadAndCheckLibrary(Builtin::kBuiltinLibrary);
383 Dart_Handle library_url = Dart_LibraryUrl(library);
384 if (Dart_IsError(library_url)) {
385 return library_url;
386 }
387 return ResolveUri(library_url, url, builtin_lib); 383 return ResolveUri(library_url, url, builtin_lib);
388 } 384 }
389 385
390 // Handle 'import' of dart scheme URIs (i.e they start with 'dart:'). 386 // Handle 'import' of dart scheme URIs (i.e they start with 'dart:').
391 if (is_dart_scheme_url) { 387 if (is_dart_scheme_url) {
392 if (tag == Dart_kImportTag) { 388 if (tag == Dart_kImportTag) {
393 // Handle imports of other built-in libraries present in the SDK. 389 // Handle imports of other built-in libraries present in the SDK.
394 if (DartUtils::IsDartIOLibURL(url_string)) { 390 if (DartUtils::IsDartIOLibURL(url_string)) {
395 return Builtin::LoadLibrary(url, Builtin::kIOLibrary); 391 return Builtin::LoadLibrary(url, Builtin::kIOLibrary);
396 } 392 }
(...skipping 578 matching lines...) Expand 10 before | Expand all | Expand 10 after
975 new CObjectString(CObject::NewString(os_error->message())); 971 new CObjectString(CObject::NewString(os_error->message()));
976 CObjectArray* result = new CObjectArray(CObject::NewArray(3)); 972 CObjectArray* result = new CObjectArray(CObject::NewArray(3));
977 result->SetAt(0, new CObjectInt32(CObject::NewInt32(kOSError))); 973 result->SetAt(0, new CObjectInt32(CObject::NewInt32(kOSError)));
978 result->SetAt(1, new CObjectInt32(CObject::NewInt32(os_error->code()))); 974 result->SetAt(1, new CObjectInt32(CObject::NewInt32(os_error->code())));
979 result->SetAt(2, error_message); 975 result->SetAt(2, error_message);
980 return result; 976 return result;
981 } 977 }
982 978
983 } // namespace bin 979 } // namespace bin
984 } // namespace dart 980 } // namespace dart
OLDNEW
« runtime/bin/builtin.dart ('K') | « runtime/bin/builtin.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698