| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 library builtin; | 5 library builtin; |
| 6 // NOTE: Do not import 'dart:io' in builtin. | 6 // NOTE: Do not import 'dart:io' in builtin. |
| 7 import 'dart:collection'; | 7 import 'dart:collection'; |
| 8 import 'dart:isolate'; | 8 import 'dart:isolate'; |
| 9 import 'dart:typed_data'; | 9 import 'dart:typed_data'; |
| 10 | 10 |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 | 84 |
| 85 // Special handling for Windows paths so that they are compatible with URI | 85 // Special handling for Windows paths so that they are compatible with URI |
| 86 // handling. | 86 // handling. |
| 87 // Embedder sets this to true if we are running on Windows. | 87 // Embedder sets this to true if we are running on Windows. |
| 88 bool _isWindows = false; | 88 bool _isWindows = false; |
| 89 | 89 |
| 90 | 90 |
| 91 // A class wrapping the load error message in an Error object. | 91 // A class wrapping the load error message in an Error object. |
| 92 class _LoadError extends Error { | 92 class _LoadError extends Error { |
| 93 final String message; | 93 final String message; |
| 94 _LoadError(this.message); | 94 final String uri; |
| 95 _LoadError(this.uri, this.message); |
| 95 | 96 |
| 96 String toString() => 'Load Error: $message'; | 97 String toString() => 'Load Error for "$uri": $message'; |
| 97 } | 98 } |
| 98 | 99 |
| 99 // Class collecting all of the information about a particular load request. | 100 // Class collecting all of the information about a particular load request. |
| 100 class _LoadRequest { | 101 class _LoadRequest { |
| 101 final int _id; | 102 final int _id; |
| 102 final int _tag; | 103 final int _tag; |
| 103 final String _uri; | 104 final String _uri; |
| 104 final String _libraryUri; | 105 final String _libraryUri; |
| 105 | 106 |
| 106 _LoadRequest(this._id, this._tag, this._uri, this._libraryUri); | 107 _LoadRequest(this._id, this._tag, this._uri, this._libraryUri); |
| (...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 273 void _handleLoaderReply(msg) { | 274 void _handleLoaderReply(msg) { |
| 274 int id = msg[0]; | 275 int id = msg[0]; |
| 275 var dataOrError = msg[1]; | 276 var dataOrError = msg[1]; |
| 276 assert((id >= 0) && (id < _reqId)); | 277 assert((id >= 0) && (id < _reqId)); |
| 277 var req = _reqMap[id]; | 278 var req = _reqMap[id]; |
| 278 try { | 279 try { |
| 279 if (dataOrError is Uint8List) { | 280 if (dataOrError is Uint8List) { |
| 280 _loadScript(req, dataOrError); | 281 _loadScript(req, dataOrError); |
| 281 } else { | 282 } else { |
| 282 assert(dataOrError is String); | 283 assert(dataOrError is String); |
| 283 var error = new _LoadError(dataOrError.toString()); | 284 var error = new _LoadError(req._uri, dataOrError.toString()); |
| 284 _asyncLoadError(req, error); | 285 _asyncLoadError(req, error); |
| 285 } | 286 } |
| 286 } catch(e, s) { | 287 } catch(e, s) { |
| 287 // Wrap inside a _LoadError unless we are already propagating a | 288 // Wrap inside a _LoadError unless we are already propagating a |
| 288 // previous _LoadError. | 289 // previous _LoadError. |
| 289 var error = (e is _LoadError) ? e : new _LoadError(e.toString()); | 290 var error = (e is _LoadError) ? e : new _LoadError(req._uri, e.toString()); |
| 290 assert(req != null); | 291 assert(req != null); |
| 291 _asyncLoadError(req, error); | 292 _asyncLoadError(req, error); |
| 292 } | 293 } |
| 293 } | 294 } |
| 294 | 295 |
| 295 | 296 |
| 296 void _startLoadRequest(int tag, | 297 void _startLoadRequest(int tag, |
| 297 String uri, | 298 String uri, |
| 298 String libraryUri, | 299 String libraryUri, |
| 299 Uri resourceUri) { | 300 Uri resourceUri) { |
| (...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 506 } else { | 507 } else { |
| 507 name = userUri.substring(index + 1); | 508 name = userUri.substring(index + 1); |
| 508 path = userUri.substring(0, index + 1); | 509 path = userUri.substring(0, index + 1); |
| 509 } | 510 } |
| 510 | 511 |
| 511 path = _filePathFromUri(path); | 512 path = _filePathFromUri(path); |
| 512 var filename = _platformExtensionFileName(name); | 513 var filename = _platformExtensionFileName(name); |
| 513 | 514 |
| 514 return [path, filename, name]; | 515 return [path, filename, name]; |
| 515 } | 516 } |
| OLD | NEW |