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

Side by Side Diff: pkg/analyzer/lib/src/generated/source_io.dart

Issue 263913003: New analyzer snapshot. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 7 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 | Annotate | Revision Log
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 // This code was auto-generated, is not intended to be edited, and is subject to 5 // This code was auto-generated, is not intended to be edited, and is subject to
6 // significant change. Please see the README file for more information. 6 // significant change. Please see the README file for more information.
7 7
8 library engine.source.io; 8 library engine.source.io;
9 9
10 import 'source.dart'; 10 import 'source.dart';
11 import 'java_core.dart'; 11 import 'java_core.dart';
12 import 'java_io.dart'; 12 import 'java_io.dart';
13 import 'utilities_general.dart'; 13 import 'utilities_general.dart';
14 import 'instrumentation.dart';
14 import 'engine.dart'; 15 import 'engine.dart';
15 export 'source.dart'; 16 export 'source.dart';
16 17
17 /** 18 /**
18 * Instances of the class [DirectoryBasedSourceContainer] represent a source con tainer that 19 * Instances of the class [DirectoryBasedSourceContainer] represent a source con tainer that
19 * contains all sources within a given directory. 20 * contains all sources within a given directory.
20 */ 21 */
21 class DirectoryBasedSourceContainer implements SourceContainer { 22 class DirectoryBasedSourceContainer implements SourceContainer {
22 /** 23 /**
23 * Append the system file separator to the given path unless the path already ends with a 24 * Append the system file separator to the given path unless the path already ends with a
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 119
119 @override 120 @override
120 bool exists() => file.isFile(); 121 bool exists() => file.isFile();
121 122
122 @override 123 @override
123 TimestampedData<String> get contents { 124 TimestampedData<String> get contents {
124 TimeCounter_TimeCounterHandle handle = PerformanceStatistics.io.start(); 125 TimeCounter_TimeCounterHandle handle = PerformanceStatistics.io.start();
125 try { 126 try {
126 return contentsFromFile; 127 return contentsFromFile;
127 } finally { 128 } finally {
128 handle.stop(); 129 _reportIfSlowIO(handle.stop());
129 } 130 }
130 } 131 }
131 132
132 @override 133 @override
133 String get encoding { 134 String get encoding {
134 if (_encoding == null) { 135 if (_encoding == null) {
135 _encoding = "${new String.fromCharCode(uriKind.encoding)}${file.toURI().to String()}"; 136 _encoding = "${new String.fromCharCode(uriKind.encoding)}${file.toURI().to String()}";
136 } 137 }
137 return _encoding; 138 return _encoding;
138 } 139 }
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 * because contexts can have local overrides of the content of a source that t he source is not 178 * because contexts can have local overrides of the content of a source that t he source is not
178 * aware of. 179 * aware of.
179 * 180 *
180 * @return the contents of the source paired with the modification stamp of th e source 181 * @return the contents of the source paired with the modification stamp of th e source
181 * @throws Exception if the contents of this source could not be accessed 182 * @throws Exception if the contents of this source could not be accessed
182 * @see #getContents() 183 * @see #getContents()
183 */ 184 */
184 TimestampedData<String> get contentsFromFile { 185 TimestampedData<String> get contentsFromFile {
185 return new TimestampedData<String>(file.lastModified(), file.readAsStringSyn c()); 186 return new TimestampedData<String>(file.lastModified(), file.readAsStringSyn c());
186 } 187 }
188
189 /**
190 * Record the time the IO took if it was slow
191 */
192 void _reportIfSlowIO(int nanos) {
193 //If slower than 10ms
194 if (nanos > 10 * TimeCounter.NANOS_PER_MILLI) {
195 InstrumentationBuilder builder = Instrumentation.builder2("SlowIO");
196 try {
197 builder.data3("fileName", fullName);
198 builder.metric2("IO-Time-Nanos", nanos);
199 } finally {
200 builder.log();
201 }
202 }
203 }
187 } 204 }
188 205
189 /** 206 /**
190 * Instances of the class `FileUriResolver` resolve `file` URI's. 207 * Instances of the class `FileUriResolver` resolve `file` URI's.
191 */ 208 */
192 class FileUriResolver extends UriResolver { 209 class FileUriResolver extends UriResolver {
193 /** 210 /**
194 * The name of the `file` scheme. 211 * The name of the `file` scheme.
195 */ 212 */
196 static String FILE_SCHEME = "file"; 213 static String FILE_SCHEME = "file";
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after
509 for (JavaFile dir in _relativeDirectories) { 526 for (JavaFile dir in _relativeDirectories) {
510 JavaFile file = new JavaFile.relative(dir, filePath); 527 JavaFile file = new JavaFile.relative(dir, filePath);
511 if (file.exists()) { 528 if (file.exists()) {
512 return new FileBasedSource.con2(file, UriKind.FILE_URI); 529 return new FileBasedSource.con2(file, UriKind.FILE_URI);
513 } 530 }
514 } 531 }
515 } 532 }
516 return null; 533 return null;
517 } 534 }
518 } 535 }
OLDNEW
« no previous file with comments | « pkg/analyzer/lib/src/generated/sdk_io.dart ('k') | pkg/analyzer/lib/src/generated/utilities_general.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698