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

Side by Side Diff: frog/leg/scanner/vm_scanner_bench.dart

Issue 8883017: Split File into File and RandomAccessFile. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address review comments. Created 9 years 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 | Annotate | Revision Log
« no previous file with comments | « frog/file_system_vm.dart ('k') | frog/leg/tools/mini_parser.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 4
5 #library('vm_scanner_bench'); 5 #library('vm_scanner_bench');
6 #import('scannerlib.dart'); 6 #import('scannerlib.dart');
7 #import('scanner_implementation.dart'); 7 #import('scanner_implementation.dart');
8 #import('scanner_bench.dart'); 8 #import('scanner_bench.dart');
9 #source('byte_strings.dart'); 9 #source('byte_strings.dart');
10 #source('byte_array_scanner.dart'); 10 #source('byte_array_scanner.dart');
11 11
12 class VmScannerBench extends ScannerBench { 12 class VmScannerBench extends ScannerBench {
13 int getBytes(String filename, void callback(List<int> bytes)) { 13 int getBytes(String filename, void callback(List<int> bytes)) {
14 File file = new File(filename); 14 File file = (new File(filename)).openSync();
15 file.openSync();
16 int size = file.lengthSync(); 15 int size = file.lengthSync();
17 List<int> bytes = new List<int>(size + 1); 16 List<int> bytes = new List<int>(size + 1);
18 file.readListSync(bytes, 0, size); 17 file.readListSync(bytes, 0, size);
19 bytes[size] = $EOF; 18 bytes[size] = $EOF;
20 file.closeSync(); 19 file.closeSync();
21 callback(bytes); 20 callback(bytes);
22 return bytes.length - 1; 21 return bytes.length - 1;
23 } 22 }
24 23
25 void checkExistence(String filename) { 24 void checkExistence(String filename) {
26 File file = new File(filename); 25 File file = new File(filename);
27 if (!file.existsSync()) { 26 if (!file.existsSync()) {
28 print("no such file: ${filename}"); 27 print("no such file: ${filename}");
29 } 28 }
30 } 29 }
31 30
32 Scanner makeScanner(bytes) => new ByteArrayScanner(bytes); 31 Scanner makeScanner(bytes) => new ByteArrayScanner(bytes);
33 } 32 }
34 33
35 main() { 34 main() {
36 new VmScannerBench().main(argv); 35 new VmScannerBench().main(argv);
37 } 36 }
OLDNEW
« no previous file with comments | « frog/file_system_vm.dart ('k') | frog/leg/tools/mini_parser.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698