| 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 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 | 112 |
| 113 void DartController::DidLoadMainLibrary(KURL url) { | 113 void DartController::DidLoadMainLibrary(KURL url) { |
| 114 DCHECK(Dart_CurrentIsolate() == dart_state()->isolate()); | 114 DCHECK(Dart_CurrentIsolate() == dart_state()->isolate()); |
| 115 DartApiScope dart_api_scope; | 115 DartApiScope dart_api_scope; |
| 116 | 116 |
| 117 if (LogIfError(Dart_FinalizeLoading(true))) | 117 if (LogIfError(Dart_FinalizeLoading(true))) |
| 118 return; | 118 return; |
| 119 | 119 |
| 120 Dart_Handle library = Dart_LookupLibrary( | 120 Dart_Handle library = Dart_LookupLibrary( |
| 121 StringToDart(dart_state(), url.string())); | 121 StringToDart(dart_state(), url.string())); |
| 122 CHECK(!LogIfError(library)); | 122 // TODO(eseidel): We need to load a 404 page instead! |
| 123 if (LogIfError(library)) |
| 124 return; |
| 123 DartInvokeAppField(library, ToDart("main"), 0, nullptr); | 125 DartInvokeAppField(library, ToDart("main"), 0, nullptr); |
| 124 } | 126 } |
| 125 | 127 |
| 126 void DartController::LoadMainLibrary(const KURL& url, mojo::URLResponsePtr respo
nse) { | 128 void DartController::LoadMainLibrary(const KURL& url, mojo::URLResponsePtr respo
nse) { |
| 127 DartLoader& loader = dart_state()->loader(); | 129 DartLoader& loader = dart_state()->loader(); |
| 128 DartDependencyCatcher dependency_catcher(loader); | 130 DartDependencyCatcher dependency_catcher(loader); |
| 129 loader.LoadLibrary(url, response.Pass()); | 131 loader.LoadLibrary(url, response.Pass()); |
| 130 loader.WaitForDependencies(dependency_catcher.dependencies(), | 132 loader.WaitForDependencies(dependency_catcher.dependencies(), |
| 131 base::Bind(&DartController::DidLoadMainLibrary, wea
k_factory_.GetWeakPtr(), url)); | 133 base::Bind(&DartController::DidLoadMainLibrary, wea
k_factory_.GetWeakPtr(), url)); |
| 132 } | 134 } |
| (...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 387 nullptr, // Isolate interrupt callback. | 389 nullptr, // Isolate interrupt callback. |
| 388 UnhandledExceptionCallback, IsolateShutdownCallback, | 390 UnhandledExceptionCallback, IsolateShutdownCallback, |
| 389 // File IO callbacks. | 391 // File IO callbacks. |
| 390 nullptr, nullptr, nullptr, nullptr, nullptr)); | 392 nullptr, nullptr, nullptr, nullptr, nullptr)); |
| 391 // Wait for load port- ensures handle watcher and service isolates are | 393 // Wait for load port- ensures handle watcher and service isolates are |
| 392 // running. | 394 // running. |
| 393 Dart_ServiceWaitForLoadPort(); | 395 Dart_ServiceWaitForLoadPort(); |
| 394 } | 396 } |
| 395 | 397 |
| 396 } // namespace blink | 398 } // namespace blink |
| OLD | NEW |