| 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" |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 113 | 113 |
| 114 if (LogIfError(Dart_FinalizeLoading(true))) | 114 if (LogIfError(Dart_FinalizeLoading(true))) |
| 115 return; | 115 return; |
| 116 | 116 |
| 117 Dart_Handle library = Dart_LookupLibrary( | 117 Dart_Handle library = Dart_LookupLibrary( |
| 118 StringToDart(dart_state(), url.string())); | 118 StringToDart(dart_state(), url.string())); |
| 119 CHECK(!LogIfError(library)); | 119 CHECK(!LogIfError(library)); |
| 120 DartInvokeAppField(library, ToDart("main"), 0, nullptr); | 120 DartInvokeAppField(library, ToDart("main"), 0, nullptr); |
| 121 } | 121 } |
| 122 | 122 |
| 123 void DartController::LoadMainLibrary(const KURL& url) { | 123 void DartController::LoadMainLibrary(const KURL& url, mojo::URLResponsePtr respo
nse) { |
| 124 DartLoader& loader = dart_state()->loader(); | 124 DartLoader& loader = dart_state()->loader(); |
| 125 DartDependencyCatcher dependency_catcher(loader); | 125 DartDependencyCatcher dependency_catcher(loader); |
| 126 loader.LoadLibrary(url); | 126 loader.LoadLibrary(url, response.Pass()); |
| 127 loader.WaitForDependencies(dependency_catcher.dependencies(), | 127 loader.WaitForDependencies(dependency_catcher.dependencies(), |
| 128 base::Bind(&DartController::DidLoadMainLibrary, wea
k_factory_.GetWeakPtr(), url)); | 128 base::Bind(&DartController::DidLoadMainLibrary, wea
k_factory_.GetWeakPtr(), url)); |
| 129 } | 129 } |
| 130 | 130 |
| 131 void DartController::LoadScriptInModule( | 131 void DartController::LoadScriptInModule( |
| 132 AbstractModule* module, | 132 AbstractModule* module, |
| 133 const String& source, | 133 const String& source, |
| 134 const TextPosition& position, | 134 const TextPosition& position, |
| 135 const LoadFinishedCallback& finished_callback) { | 135 const LoadFinishedCallback& finished_callback) { |
| 136 DartIsolateScope isolate_scope(dart_state()->isolate()); | 136 DartIsolateScope isolate_scope(dart_state()->isolate()); |
| (...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 381 nullptr, // Isolate interrupt callback. | 381 nullptr, // Isolate interrupt callback. |
| 382 UnhandledExceptionCallback, IsolateShutdownCallback, | 382 UnhandledExceptionCallback, IsolateShutdownCallback, |
| 383 // File IO callbacks. | 383 // File IO callbacks. |
| 384 nullptr, nullptr, nullptr, nullptr, nullptr)); | 384 nullptr, nullptr, nullptr, nullptr, nullptr)); |
| 385 // Wait for load port- ensures handle watcher and service isolates are | 385 // Wait for load port- ensures handle watcher and service isolates are |
| 386 // running. | 386 // running. |
| 387 Dart_ServiceWaitForLoadPort(); | 387 Dart_ServiceWaitForLoadPort(); |
| 388 } | 388 } |
| 389 | 389 |
| 390 } // namespace blink | 390 } // namespace blink |
| OLD | NEW |