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

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

Issue 2068833002: Change Dart_DefaultCanonicalizeUrl to accept the library url string instead of a library, this is u… (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 | « no previous file | runtime/bin/loader.cc » ('j') | runtime/include/dart_api.h » ('J')
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 390 matching lines...) Expand 10 before | Expand all | Expand 10 after
401 return Dart_Invoke(DartUtils::BuiltinLib(), 401 return Dart_Invoke(DartUtils::BuiltinLib(),
402 DartUtils::NewString("_loadDataAsync"), 402 DartUtils::NewString("_loadDataAsync"),
403 kNumArgs, 403 kNumArgs,
404 dart_args); 404 dart_args);
405 } 405 }
406 406
407 407
408 Dart_Handle DartUtils::LibraryTagHandler(Dart_LibraryTag tag, 408 Dart_Handle DartUtils::LibraryTagHandler(Dart_LibraryTag tag,
409 Dart_Handle library, 409 Dart_Handle library,
410 Dart_Handle url) { 410 Dart_Handle url) {
411 Dart_Handle library_url = Dart_LibraryUrl(library);
412 if (Dart_IsError(library_url)) {
Cutch 2016/06/14 21:38:31 Should this only happen if library_url is needed?
siva 2016/06/14 22:23:29 If you see further down in the else branch it does
413 return library_url;
414 }
411 if (tag == Dart_kCanonicalizeUrl) { 415 if (tag == Dart_kCanonicalizeUrl) {
412 return Dart_DefaultCanonicalizeUrl(library, url); 416 return Dart_DefaultCanonicalizeUrl(library_url, url);
413 }
414 if (!Dart_IsLibrary(library)) {
415 return Dart_NewApiError("not a library");
416 } 417 }
417 if (!Dart_IsString(url)) { 418 if (!Dart_IsString(url)) {
418 return Dart_NewApiError("url is not a string"); 419 return Dart_NewApiError("url is not a string");
419 } 420 }
420 const char* url_string = NULL; 421 const char* url_string = NULL;
421 Dart_Handle result = Dart_StringToCString(url, &url_string); 422 Dart_Handle result = Dart_StringToCString(url, &url_string);
422 if (Dart_IsError(result)) { 423 if (Dart_IsError(result)) {
423 return result; 424 return result;
424 } 425 }
425 Dart_Handle library_url = Dart_LibraryUrl(library);
426 const char* library_url_string = NULL; 426 const char* library_url_string = NULL;
427 result = Dart_StringToCString(library_url, &library_url_string); 427 result = Dart_StringToCString(library_url, &library_url_string);
428 if (Dart_IsError(result)) { 428 if (Dart_IsError(result)) {
429 return result; 429 return result;
430 } 430 }
431 431
432 bool is_dart_scheme_url = DartUtils::IsDartSchemeURL(url_string); 432 bool is_dart_scheme_url = DartUtils::IsDartSchemeURL(url_string);
433 bool is_dart_library = DartUtils::IsDartSchemeURL(library_url_string); 433 bool is_dart_library = DartUtils::IsDartSchemeURL(library_url_string);
434 434
435 // Handle canonicalization, 'import' and 'part' of 'dart:' libraries. 435 // Handle canonicalization, 'import' and 'part' of 'dart:' libraries.
(...skipping 834 matching lines...) Expand 10 before | Expand all | Expand 10 after
1270 new CObjectString(CObject::NewString(os_error->message())); 1270 new CObjectString(CObject::NewString(os_error->message()));
1271 CObjectArray* result = new CObjectArray(CObject::NewArray(3)); 1271 CObjectArray* result = new CObjectArray(CObject::NewArray(3));
1272 result->SetAt(0, new CObjectInt32(CObject::NewInt32(kOSError))); 1272 result->SetAt(0, new CObjectInt32(CObject::NewInt32(kOSError)));
1273 result->SetAt(1, new CObjectInt32(CObject::NewInt32(os_error->code()))); 1273 result->SetAt(1, new CObjectInt32(CObject::NewInt32(os_error->code())));
1274 result->SetAt(2, error_message); 1274 result->SetAt(2, error_message);
1275 return result; 1275 return result;
1276 } 1276 }
1277 1277
1278 } // namespace bin 1278 } // namespace bin
1279 } // namespace dart 1279 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | runtime/bin/loader.cc » ('j') | runtime/include/dart_api.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698