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

Side by Side Diff: sky/engine/core/script/dart_controller.cc

Issue 1182633002: Don't crash when main.dart is a 404. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Passes presubmit Created 5 years, 6 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 unified diff | Download patch
« no previous file with comments | « no previous file | sky/engine/core/script/dart_loader.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « no previous file | sky/engine/core/script/dart_loader.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698