Chromium Code Reviews| 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" |
| 11 #include "sky/engine/core/script/dom_dart_state.h" | 11 #include "sky/engine/core/script/dom_dart_state.h" |
| 12 #include "sky/engine/platform/fetcher/MojoFetcher.h" | 12 #include "sky/engine/platform/fetcher/MojoFetcher.h" |
| 13 #include "sky/engine/platform/weborigin/KURL.h" | 13 #include "sky/engine/platform/weborigin/KURL.h" |
| 14 #include "sky/engine/tonic/dart_api_scope.h" | 14 #include "sky/engine/tonic/dart_api_scope.h" |
| 15 #include "sky/engine/tonic/dart_converter.h" | 15 #include "sky/engine/tonic/dart_converter.h" |
| 16 #include "sky/engine/tonic/dart_error.h" | 16 #include "sky/engine/tonic/dart_error.h" |
| 17 #include "sky/engine/tonic/dart_isolate_scope.h" | 17 #include "sky/engine/tonic/dart_isolate_scope.h" |
| 18 #include "sky/engine/wtf/MainThread.h" | 18 #include "sky/engine/wtf/MainThread.h" |
| 19 | 19 |
| 20 using mojo::common::DataPipeDrainer; | 20 using mojo::common::DataPipeDrainer; |
| 21 | 21 |
| 22 namespace blink { | 22 namespace blink { |
| 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 String original = string; | |
|
abarth-chromium
2015/03/13 20:38:02
Remove?
| |
| 29 if (string.startsWith("dart:") || string.startsWith("mojo:")) | 30 if (string.startsWith("dart:") || string.startsWith("mojo:")) |
| 30 return url; | 31 return url; |
| 31 // TODO(dart): Figure out how 'package:' should work in sky. | 32 // TODO(dart): Figure out how 'package:' should work in sky. |
| 32 if (string.startsWith("package:")) { | 33 if (string.startsWith("package:")) { |
| 33 string.replace("package:", "/gen/"); | 34 string.replace("package:", "/packages/"); |
| 34 } | 35 } |
| 35 String library_url_string = StringFromDart(Dart_LibraryUrl(library)); | 36 String library_url_string = StringFromDart(Dart_LibraryUrl(library)); |
| 36 KURL library_url = KURL(ParsedURLString, library_url_string); | 37 KURL library_url = KURL(ParsedURLString, library_url_string); |
| 37 KURL resolved_url = KURL(library_url, string); | 38 KURL resolved_url = KURL(library_url, string); |
| 38 return StringToDart(state, resolved_url.string()); | 39 return StringToDart(state, resolved_url.string()); |
| 39 } | 40 } |
| 40 | 41 |
| 41 } // namespace | 42 } // namespace |
| 42 | 43 |
| 43 // A DartLoader::Job represents a network load. It fetches data from the network | 44 // 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 | 284 |
| 284 WatcherSignaler watcher_signaler(*this, job); | 285 WatcherSignaler watcher_signaler(*this, job); |
| 285 | 286 |
| 286 LOG(ERROR) << "Library Load failed: " << job->url().string().utf8().data(); | 287 LOG(ERROR) << "Library Load failed: " << job->url().string().utf8().data(); |
| 287 // TODO(eseidel): Call Dart_LibraryHandleError in the SourceJob case? | 288 // TODO(eseidel): Call Dart_LibraryHandleError in the SourceJob case? |
| 288 | 289 |
| 289 jobs_.remove(job); | 290 jobs_.remove(job); |
| 290 } | 291 } |
| 291 | 292 |
| 292 } // namespace blink | 293 } // namespace blink |
| OLD | NEW |