| OLD | NEW |
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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 package com.google.dart.compiler.end2end.inc; | 4 package com.google.dart.compiler.end2end.inc; |
| 5 | 5 |
| 6 import com.google.common.collect.Maps; | 6 import com.google.common.collect.Maps; |
| 7 import com.google.dart.compiler.DartSource; | 7 import com.google.dart.compiler.DartSource; |
| 8 import com.google.dart.compiler.LibrarySource; | 8 import com.google.dart.compiler.LibrarySource; |
| 9 import com.google.dart.compiler.Source; | 9 import com.google.dart.compiler.Source; |
| 10 import com.google.dart.compiler.UrlDartSource; | 10 import com.google.dart.compiler.UrlDartSource; |
| 11 | 11 |
| 12 import java.io.IOException; | 12 import java.io.IOException; |
| 13 import java.io.Reader; | 13 import java.io.Reader; |
| 14 import java.io.StringReader; | 14 import java.io.StringReader; |
| 15 import java.net.URI; | 15 import java.net.URI; |
| 16 import java.net.URISyntaxException; | 16 import java.net.URISyntaxException; |
| 17 import java.util.Date; | |
| 18 import java.util.Map; | 17 import java.util.Map; |
| 19 | 18 |
| 20 /** | 19 /** |
| 21 * {@link LibrarySource} which provides content for all {@link Source}s from mem
ory. | 20 * {@link LibrarySource} which provides content for all {@link Source}s from mem
ory. |
| 22 */ | 21 */ |
| 23 public class MemoryLibrarySource implements LibrarySource { | 22 public class MemoryLibrarySource implements LibrarySource { |
| 24 private final String libName; | 23 private final String libName; |
| 25 private final String libContent; | 24 private final String libContent; |
| 26 private final Map<String, String> sourceContentMap = Maps.newHashMap(); | 25 private final Map<String, String> sourceContentMap = Maps.newHashMap(); |
| 27 private final Map<String, Long> sourceLastModifiedMap = Maps.newHashMap(); | 26 private final Map<String, Long> sourceLastModifiedMap = Maps.newHashMap(); |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 return new StringReader(content); | 95 return new StringReader(content); |
| 97 } | 96 } |
| 98 }; | 97 }; |
| 99 } | 98 } |
| 100 | 99 |
| 101 /** | 100 /** |
| 102 * Sets the given content for the source. | 101 * Sets the given content for the source. |
| 103 */ | 102 */ |
| 104 public void setContent(String relPath, String content) { | 103 public void setContent(String relPath, String content) { |
| 105 sourceContentMap.put(relPath, content); | 104 sourceContentMap.put(relPath, content); |
| 106 sourceLastModifiedMap.put(relPath, new Date().getTime()); | 105 sourceLastModifiedMap.put(relPath, System.currentTimeMillis()); |
| 107 } | 106 } |
| 108 } | 107 } |
| OLD | NEW |