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

Unified Diff: runtime/vm/dart_api_impl.cc

Issue 2011543002: Canonicalize uris in C++ instead of Dart for the standalone embedder. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: fixz release build Created 4 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/include/dart_api.h ('k') | runtime/vm/isolate_reload_test.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/dart_api_impl.cc
diff --git a/runtime/vm/dart_api_impl.cc b/runtime/vm/dart_api_impl.cc
index 5d5a531508229bd64f02dfc9ff37d330fe37ba18..002d334e261df3cddaf1474342b105456085af1a 100644
--- a/runtime/vm/dart_api_impl.cc
+++ b/runtime/vm/dart_api_impl.cc
@@ -42,6 +42,7 @@
#include "vm/timeline.h"
#include "vm/timer.h"
#include "vm/unicode.h"
+#include "vm/uri.h"
#include "vm/verifier.h"
#include "vm/version.h"
@@ -5168,6 +5169,31 @@ DART_EXPORT Dart_Handle Dart_SetLibraryTagHandler(
}
+DART_EXPORT Dart_Handle Dart_DefaultCanonicalizeUrl(Dart_Handle library,
+ Dart_Handle url) {
+ API_TIMELINE_DURATION;
+ DARTSCOPE(Thread::Current());
+ CHECK_CALLBACK_STATE(T);
+
+ const Library& lib = Api::UnwrapLibraryHandle(Z, library);
+ if (lib.IsNull()) {
+ RETURN_TYPE_ERROR(Z, library, Library);
+ }
+ const String& uri = Api::UnwrapStringHandle(Z, url);
+ if (uri.IsNull()) {
+ RETURN_TYPE_ERROR(Z, url, String);
+ }
+
+ const String& lib_uri = String::Handle(Z, lib.url());
+ const char* resolved_uri;
+ if (!ResolveUri(uri.ToCString(), lib_uri.ToCString(), &resolved_uri)) {
+ return Api::NewError("%s: Unable to canonicalize uri '%s'.",
+ CURRENT_FUNC, uri.ToCString());
+ }
+ return Api::NewHandle(T, String::New(resolved_uri));
+}
+
+
// NOTE: Need to pass 'result' as a parameter here in order to avoid
// warning: variable 'result' might be clobbered by 'longjmp' or 'vfork'
// which shows up because of the use of setjmp.
« no previous file with comments | « runtime/include/dart_api.h ('k') | runtime/vm/isolate_reload_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698