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

Side by Side Diff: runtime/vm/dart_api_impl.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: address-code-review-comments 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/include/dart_api.h ('k') | runtime/vm/unit_test.cc » ('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) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 "include/dart_api.h" 5 #include "include/dart_api.h"
6 #include "include/dart_mirrors_api.h" 6 #include "include/dart_mirrors_api.h"
7 #include "include/dart_native_api.h" 7 #include "include/dart_native_api.h"
8 8
9 #include "platform/assert.h" 9 #include "platform/assert.h"
10 #include "lib/stacktrace.h" 10 #include "lib/stacktrace.h"
(...skipping 5153 matching lines...) Expand 10 before | Expand all | Expand 10 after
5164 5164
5165 DART_EXPORT Dart_Handle Dart_SetLibraryTagHandler( 5165 DART_EXPORT Dart_Handle Dart_SetLibraryTagHandler(
5166 Dart_LibraryTagHandler handler) { 5166 Dart_LibraryTagHandler handler) {
5167 Isolate* isolate = Isolate::Current(); 5167 Isolate* isolate = Isolate::Current();
5168 CHECK_ISOLATE(isolate); 5168 CHECK_ISOLATE(isolate);
5169 isolate->set_library_tag_handler(handler); 5169 isolate->set_library_tag_handler(handler);
5170 return Api::Success(); 5170 return Api::Success();
5171 } 5171 }
5172 5172
5173 5173
5174 DART_EXPORT Dart_Handle Dart_DefaultCanonicalizeUrl(Dart_Handle library, 5174 DART_EXPORT Dart_Handle Dart_DefaultCanonicalizeUrl(Dart_Handle base_url,
5175 Dart_Handle url) { 5175 Dart_Handle url) {
5176 API_TIMELINE_DURATION; 5176 API_TIMELINE_DURATION;
5177 DARTSCOPE(Thread::Current()); 5177 DARTSCOPE(Thread::Current());
5178 CHECK_CALLBACK_STATE(T); 5178 CHECK_CALLBACK_STATE(T);
5179 5179
5180 const Library& lib = Api::UnwrapLibraryHandle(Z, library); 5180 const String& base_uri = Api::UnwrapStringHandle(Z, base_url);
5181 if (lib.IsNull()) { 5181 if (base_uri.IsNull()) {
5182 RETURN_TYPE_ERROR(Z, library, Library); 5182 RETURN_TYPE_ERROR(Z, base_url, String);
5183 } 5183 }
5184 const String& uri = Api::UnwrapStringHandle(Z, url); 5184 const String& uri = Api::UnwrapStringHandle(Z, url);
5185 if (uri.IsNull()) { 5185 if (uri.IsNull()) {
5186 RETURN_TYPE_ERROR(Z, url, String); 5186 RETURN_TYPE_ERROR(Z, url, String);
5187 } 5187 }
5188 5188
5189 const String& lib_uri = String::Handle(Z, lib.url());
5190 const char* resolved_uri; 5189 const char* resolved_uri;
5191 if (!ResolveUri(uri.ToCString(), lib_uri.ToCString(), &resolved_uri)) { 5190 if (!ResolveUri(uri.ToCString(), base_uri.ToCString(), &resolved_uri)) {
5192 return Api::NewError("%s: Unable to canonicalize uri '%s'.", 5191 return Api::NewError("%s: Unable to canonicalize uri '%s'.",
5193 CURRENT_FUNC, uri.ToCString()); 5192 CURRENT_FUNC, uri.ToCString());
5194 } 5193 }
5195 return Api::NewHandle(T, String::New(resolved_uri)); 5194 return Api::NewHandle(T, String::New(resolved_uri));
5196 } 5195 }
5197 5196
5198 5197
5199 // NOTE: Need to pass 'result' as a parameter here in order to avoid 5198 // NOTE: Need to pass 'result' as a parameter here in order to avoid
5200 // warning: variable 'result' might be clobbered by 'longjmp' or 'vfork' 5199 // warning: variable 'result' might be clobbered by 'longjmp' or 'vfork'
5201 // which shows up because of the use of setjmp. 5200 // which shows up because of the use of setjmp.
(...skipping 1238 matching lines...) Expand 10 before | Expand all | Expand 10 after
6440 6439
6441 DART_EXPORT bool Dart_IsPrecompiledRuntime() { 6440 DART_EXPORT bool Dart_IsPrecompiledRuntime() {
6442 #if defined(DART_PRECOMPILED_RUNTIME) 6441 #if defined(DART_PRECOMPILED_RUNTIME)
6443 return true; 6442 return true;
6444 #else 6443 #else
6445 return false; 6444 return false;
6446 #endif 6445 #endif
6447 } 6446 }
6448 6447
6449 } // namespace dart 6448 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/include/dart_api.h ('k') | runtime/vm/unit_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698