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

Unified Diff: pkg/analyzer/lib/src/dart/analysis/byte_store.dart

Issue 2500533002: Add MemoryByteStore and use it in tests. (Closed)
Patch Set: Created 4 years, 1 month 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | pkg/analyzer/test/src/dart/analysis/driver_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/lib/src/dart/analysis/byte_store.dart
diff --git a/pkg/analyzer/lib/src/dart/analysis/byte_store.dart b/pkg/analyzer/lib/src/dart/analysis/byte_store.dart
index ab8e8ed01625a8136f9922404b35a9c78e82b15c..e8079ee98b1a21c0576f53075a08c81dd0d7ed6c 100644
--- a/pkg/analyzer/lib/src/dart/analysis/byte_store.dart
+++ b/pkg/analyzer/lib/src/dart/analysis/byte_store.dart
@@ -30,6 +30,23 @@ abstract class ByteStore {
}
/**
+ * [ByteStore] which stores data only in memory.
+ */
+class MemoryByteStore implements ByteStore {
+ final Map<String, List<int>> _map = {};
+
+ @override
+ List<int> get(String key) {
+ return _map[key];
+ }
+
+ @override
+ void put(String key, List<int> bytes) {
+ _map[key] = bytes;
+ }
+}
+
+/**
* A wrapper around [ByteStore] which adds an in-memory LRU cache to it.
*/
class MemoryCachingByteStore implements ByteStore {
« no previous file with comments | « no previous file | pkg/analyzer/test/src/dart/analysis/driver_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698