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

Side by Side Diff: pkg/analyzer/lib/file_system/physical_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 unified diff | Download patch
OLDNEW
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 library analyzer.file_system.physical_file_system; 5 library analyzer.file_system.physical_file_system;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 import 'dart:core'; 8 import 'dart:core';
9 import 'dart:io' as io; 9 import 'dart:io' as io;
10 10
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 /** 120 /**
121 * A `dart:io` based implementation of [File]. 121 * A `dart:io` based implementation of [File].
122 */ 122 */
123 class _PhysicalFile extends _PhysicalResource implements File { 123 class _PhysicalFile extends _PhysicalResource implements File {
124 _PhysicalFile(io.File file) : super(file); 124 _PhysicalFile(io.File file) : super(file);
125 125
126 @override 126 @override
127 Stream<WatchEvent> get changes => new FileWatcher(_entry.path).events; 127 Stream<WatchEvent> get changes => new FileWatcher(_entry.path).events;
128 128
129 @override 129 @override
130 int get lengthSync {
131 try {
132 return _file.lengthSync();
133 } on io.FileSystemException catch (exception) {
134 throw new FileSystemException(exception.path, exception.message);
135 }
136 }
137
138 @override
130 int get modificationStamp { 139 int get modificationStamp {
131 try { 140 try {
132 return _file.lastModifiedSync().millisecondsSinceEpoch; 141 return _file.lastModifiedSync().millisecondsSinceEpoch;
133 } on io.FileSystemException catch (exception) { 142 } on io.FileSystemException catch (exception) {
134 throw new FileSystemException(exception.path, exception.message); 143 throw new FileSystemException(exception.path, exception.message);
135 } 144 }
136 } 145 }
137 146
138 /** 147 /**
139 * Return the underlying file being represented by this wrapper. 148 * Return the underlying file being represented by this wrapper.
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after
404 timer.cancel(); 413 timer.cancel();
405 } 414 }
406 }); 415 });
407 return completer.future; 416 return completer.future;
408 } 417 }
409 _isSpawning = true; 418 _isSpawning = true;
410 _runner = await IsolateRunner.spawn(); 419 _runner = await IsolateRunner.spawn();
411 return _runner; 420 return _runner;
412 } 421 }
413 } 422 }
OLDNEW
« no previous file with comments | « pkg/analyzer/lib/file_system/memory_file_system.dart ('k') | pkg/analyzer/test/file_system/memory_file_system_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698