| 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_loader.h" | 6 #include "sky/engine/core/script/dart_loader.h" |
| 7 | 7 |
| 8 #include "base/callback.h" | 8 #include "base/callback.h" |
| 9 #include "mojo/common/data_pipe_drainer.h" | 9 #include "mojo/common/data_pipe_drainer.h" |
| 10 #include "sky/engine/core/script/dart_dependency_catcher.h" | 10 #include "sky/engine/core/script/dart_dependency_catcher.h" |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 namespace { | 23 namespace { |
| 24 | 24 |
| 25 Dart_Handle CanonicalizeURL(DartState* state, | 25 Dart_Handle CanonicalizeURL(DartState* state, |
| 26 Dart_Handle library, | 26 Dart_Handle library, |
| 27 Dart_Handle url) { | 27 Dart_Handle url) { |
| 28 String string = StringFromDart(url); | 28 String string = StringFromDart(url); |
| 29 if (string.startsWith("dart:") || string.startsWith("mojo:")) | 29 if (string.startsWith("dart:") || string.startsWith("mojo:")) |
| 30 return url; | 30 return url; |
| 31 // TODO(dart): Figure out how 'package:' should work in sky. | 31 // TODO(dart): Figure out how 'package:' should work in sky. |
| 32 if (string.startsWith("package:")) { | 32 if (string.startsWith("package:")) { |
| 33 string.replace("package:", "/gen/"); | 33 string.replace("package:", "/packages/"); |
| 34 } | 34 } |
| 35 String library_url_string = StringFromDart(Dart_LibraryUrl(library)); | 35 String library_url_string = StringFromDart(Dart_LibraryUrl(library)); |
| 36 KURL library_url = KURL(ParsedURLString, library_url_string); | 36 KURL library_url = KURL(ParsedURLString, library_url_string); |
| 37 KURL resolved_url = KURL(library_url, string); | 37 KURL resolved_url = KURL(library_url, string); |
| 38 return StringToDart(state, resolved_url.string()); | 38 return StringToDart(state, resolved_url.string()); |
| 39 } | 39 } |
| 40 | 40 |
| 41 } // namespace | 41 } // namespace |
| 42 | 42 |
| 43 // A DartLoader::Job represents a network load. It fetches data from the network | 43 // A DartLoader::Job represents a network load. It fetches data from the network |
| (...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 283 | 283 |
| 284 WatcherSignaler watcher_signaler(*this, job); | 284 WatcherSignaler watcher_signaler(*this, job); |
| 285 | 285 |
| 286 LOG(ERROR) << "Library Load failed: " << job->url().string().utf8().data(); | 286 LOG(ERROR) << "Library Load failed: " << job->url().string().utf8().data(); |
| 287 // TODO(eseidel): Call Dart_LibraryHandleError in the SourceJob case? | 287 // TODO(eseidel): Call Dart_LibraryHandleError in the SourceJob case? |
| 288 | 288 |
| 289 jobs_.remove(job); | 289 jobs_.remove(job); |
| 290 } | 290 } |
| 291 | 291 |
| 292 } // namespace blink | 292 } // namespace blink |
| OLD | NEW |