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

Unified Diff: Source/bindings/core/dart/DartApplicationLoader.cpp

Issue 2543703003: Added setting up VMLibraryHooks for Dartium to support resolvePageUri (Closed)
Patch Set: Added setting up VMLibraryHooks for Dartium to support resolvePageUri Created 3 years, 11 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
Index: Source/bindings/core/dart/DartApplicationLoader.cpp
diff --git a/Source/bindings/core/dart/DartApplicationLoader.cpp b/Source/bindings/core/dart/DartApplicationLoader.cpp
index d5cfc76454a8ad6e79e2060fdad44b2debfe398d..489f57b25c81506643c1d2b9230008242769d40b 100644
--- a/Source/bindings/core/dart/DartApplicationLoader.cpp
+++ b/Source/bindings/core/dart/DartApplicationLoader.cpp
@@ -372,6 +372,7 @@ void DartApplicationLoader::load(PassRefPtr<DartErrorEventDispatcher> errorEvent
// invoked.
if (m_state == Ready) {
// Call the entry point on the main script URL.
+ setupVMLibraryHooks();
callEntryPoint();
}
}
@@ -516,6 +517,21 @@ Dart_Handle DartApplicationLoader::topLevelLibrary()
return library;
}
+void DartApplicationLoader::setupVMLibraryHooks()
+{
+ Dart_Handle builtin_library = Dart_LookupLibrary(Dart_NewStringFromCString("dart:_builtin"));
+ RELEASE_ASSERT(!Dart_IsError(builtin_library));
siva 2017/01/06 21:39:33 Wouldn't need this library if the setup code was a
+
+ // Call Dartium version of _setupHooks to configure VMLibraryHooks.
+ Dart_Handle dartium_setup_class = Dart_GetType(builtin_library, Dart_NewStringFromCString("DartiumSetup"), 0, 0);
+ RELEASE_ASSERT(!Dart_IsError(dartium_setup_class));
+ Dart_Handle result = Dart_Invoke(dartium_setup_class, Dart_NewStringFromCString("_setupHooks"), 0, NULL);
+ if (Dart_IsError(result)) {
+ reportError("Unable to invoke _setupHooks", "dart:_builtin");
+ }
+}
+
+
void DartApplicationLoader::findDependences(const String& url, const String& source, intptr_t lineNumber)
{
ASSERT(m_pendingLibraries.contains(url) || m_pendingSource.contains(url));
@@ -762,7 +778,7 @@ private:
ResourcePtr<ScriptResource> m_scriptResource;
};
-static String resolveUrl(String mainLibraryURL, const String& url, const String& packageRootOverride)
+String DartApplicationLoader::resolveUrl(String mainLibraryURL, const String& url, const String& packageRootOverride)
{
if (!url.startsWith("package:") || url.startsWith("package://"))
return url;

Powered by Google App Engine
This is Rietveld 408576698