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

Unified Diff: sky/engine/core/script/dart_controller.cc

Issue 950493003: Add a basic sky-element custom element (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 10 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: sky/engine/core/script/dart_controller.cc
diff --git a/sky/engine/core/script/dart_controller.cc b/sky/engine/core/script/dart_controller.cc
index 8d17fbc3b7d317cac5987341d762f624877807d8..ecbcad02b91a5f1ee8bb362530aed47a3a71d289 100644
--- a/sky/engine/core/script/dart_controller.cc
+++ b/sky/engine/core/script/dart_controller.cc
@@ -16,6 +16,7 @@
#include "sky/engine/core/app/Module.h"
#include "sky/engine/core/dom/Element.h"
#include "sky/engine/core/frame/LocalFrame.h"
+#include "sky/engine/core/html/HTMLScriptElement.h"
#include "sky/engine/core/html/imports/HTMLImport.h"
#include "sky/engine/core/html/imports/HTMLImportChild.h"
#include "sky/engine/core/loader/FrameLoaderClient.h"
@@ -29,6 +30,7 @@
#include "sky/engine/tonic/dart_gc_controller.h"
#include "sky/engine/tonic/dart_isolate_scope.h"
#include "sky/engine/tonic/dart_state.h"
+#include "sky/engine/tonic/dart_wrappable.h"
#include "sky/engine/wtf/text/TextPosition.h"
namespace blink {
@@ -122,7 +124,8 @@ void DartController::LoadScriptInModule(
}
void DartController::ExecuteLibraryInModule(AbstractModule* module,
- Dart_Handle library) {
+ Dart_Handle library,
+ HTMLScriptElement* script) {
ASSERT(library);
DCHECK(Dart_CurrentIsolate() == dart_state()->isolate());
DartApiScope dart_api_scope;
@@ -130,16 +133,23 @@ void DartController::ExecuteLibraryInModule(AbstractModule* module,
// Don't continue if we failed to load the module.
if (LogIfError(Dart_FinalizeLoading(true)))
return;
- const char* name = module->isApplication() ? "main" : "init";
+ const char* name = module->isApplication() ? "main" : "_init";
// main() is required, but init() is not:
// TODO(rmacnak): Dart_LookupFunction won't find re-exports, etc.
Dart_Handle entry = Dart_LookupFunction(library, ToDart(name));
- if (!Dart_IsFunction(entry) && !module->isApplication())
+ if (module->isApplication()) {
+ LogIfError(Dart_Invoke(library, ToDart(name), 0, nullptr));
+ return;
+ }
+
+ if (!Dart_IsFunction(entry))
return;
- Dart_Handle result = Dart_Invoke(library, ToDart(name), 0, nullptr);
- LogIfError(result);
+ Dart_Handle args[] = {
+ ToDart(script),
+ };
+ LogIfError(Dart_Invoke(library, ToDart(name), arraysize(args), args));
}
static void UnhandledExceptionCallback(Dart_Handle error) {

Powered by Google App Engine
This is Rietveld 408576698