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

Side by Side Diff: sdk/lib/_internal/compiler/implementation/source_file_provider.dart

Issue 557383002: dart2js: Support https. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Addressed comments. Created 6 years, 3 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | tests/compiler/dart2js/http_launch_data/pkcert/README » ('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 (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 source_file_provider; 5 library source_file_provider;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 import 'dart:convert'; 8 import 'dart:convert';
9 import 'dart:io'; 9 import 'dart:io';
10 import 'dart:math' as math; 10 import 'dart:math' as math;
(...skipping 22 matching lines...) Expand all
33 Map<String, SourceFile> sourceFiles = <String, SourceFile>{}; 33 Map<String, SourceFile> sourceFiles = <String, SourceFile>{};
34 int dartCharactersRead = 0; 34 int dartCharactersRead = 0;
35 35
36 Future<String> readStringFromUri(Uri resourceUri) { 36 Future<String> readStringFromUri(Uri resourceUri) {
37 return readUtf8BytesFromUri(resourceUri).then(UTF8.decode); 37 return readUtf8BytesFromUri(resourceUri).then(UTF8.decode);
38 } 38 }
39 39
40 Future<List<int>> readUtf8BytesFromUri(Uri resourceUri) { 40 Future<List<int>> readUtf8BytesFromUri(Uri resourceUri) {
41 if (resourceUri.scheme == 'file') { 41 if (resourceUri.scheme == 'file') {
42 return _readFromFile(resourceUri); 42 return _readFromFile(resourceUri);
43 } else if (resourceUri.scheme == 'http') { 43 } else if (resourceUri.scheme == 'http' || resourceUri.scheme == 'https') {
44 return _readFromHttp(resourceUri); 44 return _readFromHttp(resourceUri);
45 } else { 45 } else {
46 throw new ArgumentError("Unknown scheme in uri '$resourceUri'"); 46 throw new ArgumentError("Unknown scheme in uri '$resourceUri'");
47 } 47 }
48 } 48 }
49 49
50 Future<List<int>> _readFromFile(Uri resourceUri) { 50 Future<List<int>> _readFromFile(Uri resourceUri) {
51 assert(resourceUri.scheme == 'file'); 51 assert(resourceUri.scheme == 'file');
52 List<int> source; 52 List<int> source;
53 try { 53 try {
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after
313 var onAdd, onClose; 313 var onAdd, onClose;
314 314
315 EventSinkWrapper(this.onAdd, this.onClose); 315 EventSinkWrapper(this.onAdd, this.onClose);
316 316
317 void add(String data) => onAdd(data); 317 void add(String data) => onAdd(data);
318 318
319 void addError(error, [StackTrace stackTrace]) => throw error; 319 void addError(error, [StackTrace stackTrace]) => throw error;
320 320
321 void close() => onClose(); 321 void close() => onClose();
322 } 322 }
OLDNEW
« no previous file with comments | « no previous file | tests/compiler/dart2js/http_launch_data/pkcert/README » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698