| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 // This code was auto-generated, is not intended to be edited, and is subject to | 5 // This code was auto-generated, is not intended to be edited, and is subject to |
| 6 // significant change. Please see the README file for more information. | 6 // significant change. Please see the README file for more information. |
| 7 | 7 |
| 8 library engine.source; | 8 library engine.source; |
| 9 | 9 |
| 10 import 'java_core.dart'; | 10 import 'java_core.dart'; |
| (...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 189 * | 189 * |
| 190 * @param containingSource the source containing the given URI | 190 * @param containingSource the source containing the given URI |
| 191 * @param containedUri the (possibly relative) URI to be resolved against the
containing source | 191 * @param containedUri the (possibly relative) URI to be resolved against the
containing source |
| 192 * @return the source representing the contained URI | 192 * @return the source representing the contained URI |
| 193 */ | 193 */ |
| 194 Source resolveUri(Source containingSource, String containedUri) { | 194 Source resolveUri(Source containingSource, String containedUri) { |
| 195 if (containedUri == null || containedUri.isEmpty) { | 195 if (containedUri == null || containedUri.isEmpty) { |
| 196 return null; | 196 return null; |
| 197 } | 197 } |
| 198 try { | 198 try { |
| 199 // Force the creation of an escaped URI to deal with spaces, etc. |
| 199 return resolveUri2(containingSource, parseUriWithException(containedUri)); | 200 return resolveUri2(containingSource, parseUriWithException(containedUri)); |
| 200 } on URISyntaxException catch (exception) { | 201 } on URISyntaxException catch (exception) { |
| 201 return null; | 202 return null; |
| 202 } | 203 } |
| 203 } | 204 } |
| 204 | 205 |
| 205 /** | 206 /** |
| 206 * Return an absolute URI that represents the given source. | 207 * Return an absolute URI that represents the given source. |
| 207 * | 208 * |
| 208 * @param source the source to get URI for | 209 * @param source the source to get URI for |
| (...skipping 680 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 889 * @param contents the new contents of the source | 890 * @param contents the new contents of the source |
| 890 * @return the original cached contents or `null` if none | 891 * @return the original cached contents or `null` if none |
| 891 */ | 892 */ |
| 892 String setContents(Source source, String contents) { | 893 String setContents(Source source, String contents) { |
| 893 if (contents == null) { | 894 if (contents == null) { |
| 894 _stampMap.remove(source); | 895 _stampMap.remove(source); |
| 895 return _contentMap.remove(source); | 896 return _contentMap.remove(source); |
| 896 } else { | 897 } else { |
| 897 int newStamp = JavaSystem.currentTimeMillis(); | 898 int newStamp = JavaSystem.currentTimeMillis(); |
| 898 int oldStamp = javaMapPut(_stampMap, source, newStamp); | 899 int oldStamp = javaMapPut(_stampMap, source, newStamp); |
| 900 // Occasionally, if this method is called in rapid succession, the timesta
mps are equal. |
| 901 // Guard against this by artificially incrementing the new timestamp |
| 899 if (newStamp == oldStamp) { | 902 if (newStamp == oldStamp) { |
| 900 _stampMap[source] = newStamp + 1; | 903 _stampMap[source] = newStamp + 1; |
| 901 } | 904 } |
| 902 return javaMapPut(_contentMap, source, contents); | 905 return javaMapPut(_contentMap, source, contents); |
| 903 } | 906 } |
| 904 } | 907 } |
| 905 } | 908 } |
| OLD | NEW |