OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "sky/engine/config.h" | 5 #include "sky/engine/config.h" |
6 #include "sky/engine/core/script/dart_controller.h" | 6 #include "sky/engine/core/script/dart_controller.h" |
7 | 7 |
8 #include "base/bind.h" | 8 #include "base/bind.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/single_thread_task_runner.h" | 10 #include "base/single_thread_task_runner.h" |
| 11 #include "base/trace_event/trace_event.h" |
11 #include "dart/runtime/include/dart_mirrors_api.h" | 12 #include "dart/runtime/include/dart_mirrors_api.h" |
12 #include "sky/engine/bindings/builtin.h" | 13 #include "sky/engine/bindings/builtin.h" |
13 #include "sky/engine/bindings/builtin_natives.h" | 14 #include "sky/engine/bindings/builtin_natives.h" |
14 #include "sky/engine/bindings/builtin_sky.h" | 15 #include "sky/engine/bindings/builtin_sky.h" |
15 #include "sky/engine/core/app/AbstractModule.h" | 16 #include "sky/engine/core/app/AbstractModule.h" |
16 #include "sky/engine/core/app/Module.h" | 17 #include "sky/engine/core/app/Module.h" |
17 #include "sky/engine/core/dom/Element.h" | 18 #include "sky/engine/core/dom/Element.h" |
18 #include "sky/engine/core/frame/LocalFrame.h" | 19 #include "sky/engine/core/frame/LocalFrame.h" |
19 #include "sky/engine/core/html/HTMLScriptElement.h" | 20 #include "sky/engine/core/html/HTMLScriptElement.h" |
20 #include "sky/engine/core/html/imports/HTMLImport.h" | 21 #include "sky/engine/core/html/imports/HTMLImport.h" |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 // TODO(eseidel): Better if the library/module retained its dependencies and | 121 // TODO(eseidel): Better if the library/module retained its dependencies and |
121 // dependency waiting could be separate from library creation. | 122 // dependency waiting could be separate from library creation. |
122 dart_state()->loader().WaitForDependencies( | 123 dart_state()->loader().WaitForDependencies( |
123 dependency_catcher.dependencies(), | 124 dependency_catcher.dependencies(), |
124 base::Bind(finished_callback, module, library)); | 125 base::Bind(finished_callback, module, library)); |
125 } | 126 } |
126 | 127 |
127 void DartController::ExecuteLibraryInModule(AbstractModule* module, | 128 void DartController::ExecuteLibraryInModule(AbstractModule* module, |
128 Dart_Handle library, | 129 Dart_Handle library, |
129 HTMLScriptElement* script) { | 130 HTMLScriptElement* script) { |
| 131 TRACE_EVENT1("sky", "DartController::ExecuteLibraryInModule", |
| 132 "url", module->url().ascii().toStdString()); |
130 ASSERT(library); | 133 ASSERT(library); |
131 DCHECK(Dart_CurrentIsolate() == dart_state()->isolate()); | 134 DCHECK(Dart_CurrentIsolate() == dart_state()->isolate()); |
132 DartApiScope dart_api_scope; | 135 DartApiScope dart_api_scope; |
133 | 136 |
134 // Don't continue if we failed to load the module. | 137 // Don't continue if we failed to load the module. |
135 if (LogIfError(Dart_FinalizeLoading(true))) | 138 if (LogIfError(Dart_FinalizeLoading(true))) |
136 return; | 139 return; |
137 const char* name = module->isApplication() ? "main" : "_init"; | 140 const char* name = module->isApplication() ? "main" : "_init"; |
138 | 141 |
139 // main() is required, but init() is not: | 142 // main() is required, but init() is not: |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
300 | 303 |
301 CHECK(Dart_SetVMFlags(argc, argv)); | 304 CHECK(Dart_SetVMFlags(argc, argv)); |
302 CHECK(Dart_Initialize(IsolateCreateCallback, | 305 CHECK(Dart_Initialize(IsolateCreateCallback, |
303 nullptr, // Isolate interrupt callback. | 306 nullptr, // Isolate interrupt callback. |
304 UnhandledExceptionCallback, IsolateShutdownCallback, | 307 UnhandledExceptionCallback, IsolateShutdownCallback, |
305 // File IO callbacks. | 308 // File IO callbacks. |
306 nullptr, nullptr, nullptr, nullptr, nullptr)); | 309 nullptr, nullptr, nullptr, nullptr, nullptr)); |
307 } | 310 } |
308 | 311 |
309 } // namespace blink | 312 } // namespace blink |
OLD | NEW |