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

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

Issue 926753002: Improve DartLoader error handling. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Remove saw_error 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
« no previous file with comments | « sky/engine/core/script/dart_loader.h ('k') | sky/engine/tonic/dart_error.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sky/engine/core/script/dart_loader.cc
diff --git a/sky/engine/core/script/dart_loader.cc b/sky/engine/core/script/dart_loader.cc
index 4345dda3c099db161affa41fedbc171cf2a83df4..cc5fc195d48a40290ecc1ba5770012e61cc16745 100644
--- a/sky/engine/core/script/dart_loader.cc
+++ b/sky/engine/core/script/dart_loader.cc
@@ -59,7 +59,10 @@ class DartLoader::Job : public DartDependency,
private:
// MojoFetcher::Client
void OnReceivedResponse(mojo::URLResponsePtr response) override {
- // TODO(abarth): Handle network errors.
+ if (response->status_code != 200) {
+ loader_->DidFailJob(this);
+ return;
+ }
drainer_ = adoptPtr(new DataPipeDrainer(this, response->body.Pass()));
}
@@ -175,7 +178,8 @@ class DartLoader::WatcherSignaler {
};
DartLoader::DartLoader(DartState* dart_state)
- : dart_state_(dart_state->GetWeakPtr()), dependency_catcher_(nullptr) {
+ : dart_state_(dart_state->GetWeakPtr()),
+ dependency_catcher_(nullptr) {
abarth-chromium 2015/02/14 00:28:06 git cl format will probably undo this change.
}
DartLoader::~DartLoader() {
@@ -262,4 +266,17 @@ void DartLoader::DidCompleteSourceJob(SourceJob* job,
jobs_.remove(job);
}
+void DartLoader::DidFailJob(Job* job) {
+ DCHECK(dart_state_);
+ DartIsolateScope scope(dart_state_->isolate());
+ DartApiScope api_scope;
+
+ WatcherSignaler watcher_signaler(*this, job);
+
+ LOG(ERROR) << "Library Load failed: " << job->url().string().utf8().data();
+ // TODO(eseidel): Call Dart_LibraryHandleError in the SourceJob case?
+
+ jobs_.remove(job);
+}
+
} // namespace blink
« no previous file with comments | « sky/engine/core/script/dart_loader.h ('k') | sky/engine/tonic/dart_error.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698