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

Unified Diff: pkg/analyzer/lib/file_system/memory_file_system.dart

Issue 2490023003: Add File.lengthSync to use it for FileByteStore eviction. (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
Index: pkg/analyzer/lib/file_system/memory_file_system.dart
diff --git a/pkg/analyzer/lib/file_system/memory_file_system.dart b/pkg/analyzer/lib/file_system/memory_file_system.dart
index 44f8a062661923f70ce486d50f28fc451d42d679..42731be1b09940893addb31a4f68e197b71bcd2d 100644
--- a/pkg/analyzer/lib/file_system/memory_file_system.dart
+++ b/pkg/analyzer/lib/file_system/memory_file_system.dart
@@ -306,6 +306,11 @@ class _MemoryDummyLink extends _MemoryResource implements File {
bool get exists => false;
@override
+ int get lengthSync {
+ throw new FileSystemException(path, 'File could not be read');
+ }
+
+ @override
int get modificationStamp {
int stamp = _provider._pathToTimestamp[path];
if (stamp == null) {
@@ -371,6 +376,11 @@ class _MemoryFile extends _MemoryResource implements File {
bool get exists => _provider._pathToResource[path] is _MemoryFile;
@override
+ int get lengthSync {
+ return readAsBytesSync().length;
+ }
+
+ @override
int get modificationStamp {
int stamp = _provider._pathToTimestamp[path];
if (stamp == null) {
« no previous file with comments | « pkg/analyzer/lib/file_system/file_system.dart ('k') | pkg/analyzer/lib/file_system/physical_file_system.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698