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

Side by Side Diff: runtime/lib/uri_patch.dart

Issue 2767533002: Revert "Fix observatory tests broken by running dartfmt." (Closed)
Patch Set: Created 3 years, 9 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
« no previous file with comments | « runtime/lib/type_patch.dart ('k') | runtime/lib/vmservice_patch.dart » ('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 // VM implementation of Uri. 5 // VM implementation of Uri.
6 typedef Uri _UriBaseClosure(); 6 typedef Uri _UriBaseClosure();
7 7
8 Uri _unsupportedUriBase() { 8 Uri _unsupportedUriBase() {
9 throw new UnsupportedError("'Uri.base' is not supported"); 9 throw new UnsupportedError("'Uri.base' is not supported");
10 } 10 }
11 11
12 // _uriBaseClosure can be overwritten by the embedder to supply a different 12 // _uriBaseClosure can be overwritten by the embedder to supply a different
13 // value for Uri.base. 13 // value for Uri.base.
14 _UriBaseClosure _uriBaseClosure = _unsupportedUriBase; 14 _UriBaseClosure _uriBaseClosure = _unsupportedUriBase;
15 15
16 @patch 16 @patch class Uri {
17 class Uri { 17 @patch static Uri get base => _uriBaseClosure();
18 @patch
19 static Uri get base => _uriBaseClosure();
20 } 18 }
21 19
22 @patch 20 @patch class _Uri {
23 class _Uri {
24 static final bool _isWindowsCached = _isWindowsPlatform; 21 static final bool _isWindowsCached = _isWindowsPlatform;
25 22
26 static bool get _isWindowsPlatform native "Uri_isWindowsPlatform"; 23 static bool get _isWindowsPlatform native "Uri_isWindowsPlatform";
27 24
28 @patch 25 @patch static bool get _isWindows => _isWindowsCached;
29 static bool get _isWindows => _isWindowsCached;
30 26
31 @patch 27 @patch static String _uriEncode(List<int> canonicalTable,
32 static String _uriEncode(List<int> canonicalTable, String text, 28 String text,
33 Encoding encoding, bool spaceToPlus) { 29 Encoding encoding,
30 bool spaceToPlus) {
34 // First check if the text will be changed by encoding. 31 // First check if the text will be changed by encoding.
35 int i = 0; 32 int i = 0;
36 if (identical(encoding, UTF8) || 33 if (identical(encoding, UTF8) ||
37 identical(encoding, LATIN1) || 34 identical(encoding, LATIN1) ||
38 identical(encoding, ASCII)) { 35 identical(encoding, ASCII)) {
39 // Encoding is compatible with the original string. 36 // Encoding is compatible with the original string.
40 // Find first character that needs encoding. 37 // Find first character that needs encoding.
41 for (; i < text.length; i++) { 38 for (; i < text.length; i++) {
42 var char = text.codeUnitAt(i); 39 var char = text.codeUnitAt(i);
43 if (char >= 128 || 40 if (char >= 128 ||
(...skipping 15 matching lines...) Expand all
59 var bytes = encoding.encode(text); 56 var bytes = encoding.encode(text);
60 for (; i < bytes.length; i++) { 57 for (; i < bytes.length; i++) {
61 int byte = bytes[i]; 58 int byte = bytes[i];
62 if (byte < 128 && 59 if (byte < 128 &&
63 ((canonicalTable[byte >> 4] & (1 << (byte & 0x0f))) != 0)) { 60 ((canonicalTable[byte >> 4] & (1 << (byte & 0x0f))) != 0)) {
64 result.writeCharCode(byte); 61 result.writeCharCode(byte);
65 } else if (spaceToPlus && byte == _SPACE) { 62 } else if (spaceToPlus && byte == _SPACE) {
66 result.writeCharCode(_PLUS); 63 result.writeCharCode(_PLUS);
67 } else { 64 } else {
68 const String hexDigits = '0123456789ABCDEF'; 65 const String hexDigits = '0123456789ABCDEF';
69 result 66 result..writeCharCode(_PERCENT)
70 ..writeCharCode(_PERCENT) 67 ..writeCharCode(hexDigits.codeUnitAt(byte >> 4))
71 ..writeCharCode(hexDigits.codeUnitAt(byte >> 4)) 68 ..writeCharCode(hexDigits.codeUnitAt(byte & 0x0f));
72 ..writeCharCode(hexDigits.codeUnitAt(byte & 0x0f));
73 } 69 }
74 } 70 }
75 return result.toString(); 71 return result.toString();
76 } 72 }
77 } 73 }
OLDNEW
« no previous file with comments | « runtime/lib/type_patch.dart ('k') | runtime/lib/vmservice_patch.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698