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

Side by Side Diff: pkg/analyzer/lib/src/dart/analysis/file_byte_store.dart

Issue 2442993002: API for the new AnalysisDriver. (Closed)
Patch Set: Unsaved changes. Created 4 years, 2 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
OLDNEW
(Empty)
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
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.
4
5 import 'package:analyzer/file_system/file_system.dart';
6 import 'package:analyzer/src/dart/analysis/byte_store.dart';
7
8 /**
9 * [ByteStore] that stores values as [File]s.
Paul Berry 2016/10/23 10:39:19 Should this class implement some sort of LRU polic
scheglov 2016/10/23 20:54:34 Yes, we should. I'm adding TODO.
10 */
11 class FileByteStore implements ByteStore {
12 final Folder folder;
13
14 FileByteStore(this.folder);
15
16 @override
17 List<int> get(String key) {
18 try {
19 File file = folder.getChildAssumingFile(key);
20 return file.readAsBytesSync();
21 } catch (_) {
22 return null;
23 }
24 }
25
26 @override
27 void put(String key, List<int> bytes) {
28 try {
29 File file = folder.getChildAssumingFile(key);
30 file.writeAsBytesSync(bytes);
31 } catch (_) {}
32 }
33 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698