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

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

Issue 685863003: Make table entries on analysis server's '/status' page clickable. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Changes based on code review Created 6 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 | 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; 8 library engine;
9 9
10 import 'dart:collection'; 10 import 'dart:collection';
(...skipping 1595 matching lines...) Expand 10 before | Expand all | Expand 10 after
1606 // 1606 //
1607 WorkManager_WorkIterator iterator = _workManager.iterator(); 1607 WorkManager_WorkIterator iterator = _workManager.iterator();
1608 while (iterator.hasNext) { 1608 while (iterator.hasNext) {
1609 Source source = iterator.next(); 1609 Source source = iterator.next();
1610 _getSourcesNeedingProcessing(source, _cache.get(source), false, hintsEnabl ed, sources); 1610 _getSourcesNeedingProcessing(source, _cache.get(source), false, hintsEnabl ed, sources);
1611 } 1611 }
1612 return new List<Source>.from(sources); 1612 return new List<Source>.from(sources);
1613 } 1613 }
1614 1614
1615 @override 1615 @override
1616 AnalysisContextStatistics get statistics { 1616 void visitCacheItems(void callback(Source source, SourceEntry dartEntry,
1617 DataDescriptor rowDesc,
1618 CacheState state)) {
1619 void handleCacheItem(Source source, SourceEntry dartEntry,
1620 DataDescriptor descriptor) {
1621 callback(source, dartEntry, descriptor, dartEntry.getState(descriptor));
1622 }
1623 void handleCacheItemInLibrary(DartEntry dartEntry, Source librarySource,
1624 DataDescriptor descriptor) {
1625 callback(librarySource, dartEntry, descriptor,
1626 dartEntry.getStateInLibrary(descriptor, librarySource));
1627 }
1628
1617 bool hintsEnabled = _options.hint; 1629 bool hintsEnabled = _options.hint;
1618 AnalysisContextStatisticsImpl statistics = new AnalysisContextStatisticsImpl ();
1619 MapIterator<Source, SourceEntry> iterator = _cache.iterator(); 1630 MapIterator<Source, SourceEntry> iterator = _cache.iterator();
1620 while (iterator.moveNext()) { 1631 while (iterator.moveNext()) {
1632 Source source = iterator.key;
1621 SourceEntry sourceEntry = iterator.value; 1633 SourceEntry sourceEntry = iterator.value;
1622 if (sourceEntry is DartEntry) { 1634 if (sourceEntry is DartEntry) {
1623 Source source = iterator.key;
1624 DartEntry dartEntry = sourceEntry; 1635 DartEntry dartEntry = sourceEntry;
1625 SourceKind kind = dartEntry.getValue(DartEntry.SOURCE_KIND); 1636 SourceKind kind = dartEntry.getValue(DartEntry.SOURCE_KIND);
1626 // get library independent values 1637 // get library independent values
1627 statistics.putCacheItem(dartEntry, SourceEntry.LINE_INFO); 1638 handleCacheItem(source, dartEntry, SourceEntry.LINE_INFO);
1628 statistics.putCacheItem(dartEntry, DartEntry.PARSE_ERRORS); 1639 handleCacheItem(source, dartEntry, DartEntry.PARSE_ERRORS);
1629 statistics.putCacheItem(dartEntry, DartEntry.PARSED_UNIT); 1640 handleCacheItem(source, dartEntry, DartEntry.PARSED_UNIT);
1630 statistics.putCacheItem(dartEntry, DartEntry.SOURCE_KIND); 1641 handleCacheItem(source, dartEntry, DartEntry.SOURCE_KIND);
1631 if (kind == SourceKind.LIBRARY) { 1642 if (kind == SourceKind.LIBRARY) {
1632 statistics.putCacheItem(dartEntry, DartEntry.ELEMENT); 1643 handleCacheItem(source, dartEntry, DartEntry.ELEMENT);
1633 statistics.putCacheItem(dartEntry, DartEntry.EXPORTED_LIBRARIES); 1644 handleCacheItem(source, dartEntry, DartEntry.EXPORTED_LIBRARIES);
1634 statistics.putCacheItem(dartEntry, DartEntry.IMPORTED_LIBRARIES); 1645 handleCacheItem(source, dartEntry, DartEntry.IMPORTED_LIBRARIES);
1635 statistics.putCacheItem(dartEntry, DartEntry.INCLUDED_PARTS); 1646 handleCacheItem(source, dartEntry, DartEntry.INCLUDED_PARTS);
1636 statistics.putCacheItem(dartEntry, DartEntry.IS_CLIENT); 1647 handleCacheItem(source, dartEntry, DartEntry.IS_CLIENT);
1637 statistics.putCacheItem(dartEntry, DartEntry.IS_LAUNCHABLE); 1648 handleCacheItem(source, dartEntry, DartEntry.IS_LAUNCHABLE);
1638 // The public namespace isn't computed by performAnalysisTask() and th erefore isn't 1649 // The public namespace isn't computed by performAnalysisTask() and th erefore isn't
1639 // interesting. 1650 // interesting.
1640 //statistics.putCacheItem(dartEntry, DartEntry.PUBLIC_NAMESPACE); 1651 //handleCacheItem(key, dartEntry, DartEntry.PUBLIC_NAMESPACE);
1641 } 1652 }
1642 // get library-specific values 1653 // get library-specific values
1643 List<Source> librarySources = getLibrariesContaining(source); 1654 List<Source> librarySources = getLibrariesContaining(source);
1644 for (Source librarySource in librarySources) { 1655 for (Source librarySource in librarySources) {
1645 statistics.putCacheItemInLibrary(dartEntry, librarySource, DartEntry.R ESOLUTION_ERRORS); 1656 handleCacheItemInLibrary(dartEntry, librarySource, DartEntry.RESOLUTIO N_ERRORS);
1646 statistics.putCacheItemInLibrary(dartEntry, librarySource, DartEntry.R ESOLVED_UNIT); 1657 handleCacheItemInLibrary(dartEntry, librarySource, DartEntry.RESOLVED_ UNIT);
1647 if (_generateSdkErrors || !source.isInSystemLibrary) { 1658 if (_generateSdkErrors || !source.isInSystemLibrary) {
1648 statistics.putCacheItemInLibrary(dartEntry, librarySource, DartEntry .VERIFICATION_ERRORS); 1659 handleCacheItemInLibrary(dartEntry, librarySource, DartEntry.VERIFIC ATION_ERRORS);
1649 if (hintsEnabled) { 1660 if (hintsEnabled) {
1650 statistics.putCacheItemInLibrary(dartEntry, librarySource, DartEnt ry.HINTS); 1661 handleCacheItemInLibrary(dartEntry, librarySource, DartEntry.HINTS );
1651 } 1662 }
1652 } 1663 }
1653 } 1664 }
1654 } else if (sourceEntry is HtmlEntry) { 1665 } else if (sourceEntry is HtmlEntry) {
1655 HtmlEntry htmlEntry = sourceEntry; 1666 HtmlEntry htmlEntry = sourceEntry;
1656 statistics.putCacheItem(htmlEntry, SourceEntry.LINE_INFO); 1667 handleCacheItem(source, htmlEntry, SourceEntry.LINE_INFO);
1657 statistics.putCacheItem(htmlEntry, HtmlEntry.PARSE_ERRORS); 1668 handleCacheItem(source, htmlEntry, HtmlEntry.PARSE_ERRORS);
1658 statistics.putCacheItem(htmlEntry, HtmlEntry.PARSED_UNIT); 1669 handleCacheItem(source, htmlEntry, HtmlEntry.PARSED_UNIT);
1659 statistics.putCacheItem(htmlEntry, HtmlEntry.RESOLUTION_ERRORS); 1670 handleCacheItem(source, htmlEntry, HtmlEntry.RESOLUTION_ERRORS);
1660 statistics.putCacheItem(htmlEntry, HtmlEntry.RESOLVED_UNIT); 1671 handleCacheItem(source, htmlEntry, HtmlEntry.RESOLVED_UNIT);
1661 // We are not currently recording any hints related to HTML. 1672 // We are not currently recording any hints related to HTML.
1662 // statistics.putCacheItem(htmlEntry, HtmlEntry.HINTS); 1673 // handleCacheItem(key, htmlEntry, HtmlEntry.HINTS);
1663 } 1674 }
1664 } 1675 }
1676 }
1677
1678 @override
1679 AnalysisContextStatistics get statistics {
1680 AnalysisContextStatisticsImpl statistics = new AnalysisContextStatisticsImpl ();
1681 visitCacheItems(statistics._internalPutCacheItem);
1665 statistics.partitionData = _cache.partitionData; 1682 statistics.partitionData = _cache.partitionData;
1666 return statistics; 1683 return statistics;
1667 } 1684 }
1668 1685
1669 @override 1686 @override
1670 TypeProvider get typeProvider { 1687 TypeProvider get typeProvider {
1671 Source coreSource = sourceFactory.forUri(DartSdk.DART_CORE); 1688 Source coreSource = sourceFactory.forUri(DartSdk.DART_CORE);
1672 if (coreSource == null) { 1689 if (coreSource == null) {
1673 throw new AnalysisException("Could not create a source for dart:core"); 1690 throw new AnalysisException("Could not create a source for dart:core");
1674 } 1691 }
(...skipping 3431 matching lines...) Expand 10 before | Expand all | Expand 10 after
5106 5123
5107 @override 5124 @override
5108 List<CaughtException> get exceptions => new List.from(_exceptions); 5125 List<CaughtException> get exceptions => new List.from(_exceptions);
5109 5126
5110 @override 5127 @override
5111 List<AnalysisContextStatistics_PartitionData> get partitionData => _partitionD ata; 5128 List<AnalysisContextStatistics_PartitionData> get partitionData => _partitionD ata;
5112 5129
5113 @override 5130 @override
5114 List<Source> get sources => _sources; 5131 List<Source> get sources => _sources;
5115 5132
5116 void putCacheItem(SourceEntry dartEntry, DataDescriptor descriptor) {
5117 _internalPutCacheItem(dartEntry, descriptor, dartEntry.getState(descriptor)) ;
5118 }
5119
5120 void putCacheItemInLibrary(DartEntry dartEntry, Source librarySource, DataDesc riptor descriptor) {
5121 _internalPutCacheItem(dartEntry, descriptor, dartEntry.getStateInLibrary(des criptor, librarySource));
5122 }
5123
5124 /** 5133 /**
5125 * Set the partition data returned by this object to the given data. 5134 * Set the partition data returned by this object to the given data.
5126 */ 5135 */
5127 void set partitionData(List<AnalysisContextStatistics_PartitionData> data) { 5136 void set partitionData(List<AnalysisContextStatistics_PartitionData> data) {
5128 _partitionData = data; 5137 _partitionData = data;
5129 } 5138 }
5130 5139
5131 void _internalPutCacheItem(SourceEntry dartEntry, DataDescriptor rowDesc, Cach eState state) { 5140 void _internalPutCacheItem(Source source, SourceEntry dartEntry,
5141 DataDescriptor rowDesc, CacheState state) {
5132 String rowName = rowDesc.toString(); 5142 String rowName = rowDesc.toString();
5133 AnalysisContextStatisticsImpl_CacheRowImpl row = _dataMap[rowName] as Analys isContextStatisticsImpl_CacheRowImpl; 5143 AnalysisContextStatisticsImpl_CacheRowImpl row = _dataMap[rowName] as Analys isContextStatisticsImpl_CacheRowImpl;
5134 if (row == null) { 5144 if (row == null) {
5135 row = new AnalysisContextStatisticsImpl_CacheRowImpl(rowName); 5145 row = new AnalysisContextStatisticsImpl_CacheRowImpl(rowName);
5136 _dataMap[rowName] = row; 5146 _dataMap[rowName] = row;
5137 } 5147 }
5138 row._incState(state); 5148 row._incState(state);
5139 if (state == CacheState.ERROR) { 5149 if (state == CacheState.ERROR) {
5140 CaughtException exception = dartEntry.exception; 5150 CaughtException exception = dartEntry.exception;
5141 if (exception != null) { 5151 if (exception != null) {
5142 _exceptions.add(exception); 5152 _exceptions.add(exception);
5143 } 5153 }
5144 } 5154 }
5145 } 5155 }
5146 } 5156 }
5147 5157
5148 class AnalysisContextStatisticsImpl_CacheRowImpl implements AnalysisContextStati stics_CacheRow { 5158 class AnalysisContextStatisticsImpl_CacheRowImpl implements AnalysisContextStati stics_CacheRow {
5149 final String name; 5159 final String name;
5150 5160
5151 int _errorCount = 0; 5161 Map<CacheState, int> _counts = <CacheState, int>{};
5152
5153 int _flushedCount = 0;
5154
5155 int _inProcessCount = 0;
5156
5157 int _invalidCount = 0;
5158
5159 int _validCount = 0;
5160 5162
5161 AnalysisContextStatisticsImpl_CacheRowImpl(this.name); 5163 AnalysisContextStatisticsImpl_CacheRowImpl(this.name);
5162 5164
5163 @override 5165 @override
5164 bool operator ==(Object obj) => obj is AnalysisContextStatisticsImpl_CacheRowI mpl && obj.name == name; 5166 bool operator ==(Object obj) => obj is AnalysisContextStatisticsImpl_CacheRowI mpl && obj.name == name;
5165 5167
5166 @override 5168 @override
5167 int get errorCount => _errorCount; 5169 int get errorCount => getCount(CacheState.ERROR);
5168 5170
5169 @override 5171 @override
5170 int get flushedCount => _flushedCount; 5172 int get flushedCount => getCount(CacheState.FLUSHED);
5171 5173
5172 @override 5174 @override
5173 int get inProcessCount => _inProcessCount; 5175 int get inProcessCount => getCount(CacheState.IN_PROCESS);
5174 5176
5175 @override 5177 @override
5176 int get invalidCount => _invalidCount; 5178 int get invalidCount => getCount(CacheState.INVALID);
5177 5179
5178 @override 5180 @override
5179 int get validCount => _validCount; 5181 int get validCount => getCount(CacheState.VALID);
5180 5182
5181 @override 5183 @override
5182 int get hashCode => name.hashCode; 5184 int get hashCode => name.hashCode;
5183 5185
5186 @override
5187 int getCount(CacheState state) {
5188 int count = _counts[state];
5189 if (count != null) {
5190 return count;
5191 } else {
5192 return 0;
5193 }
5194 }
5195
5184 void _incState(CacheState state) { 5196 void _incState(CacheState state) {
5185 if (state == CacheState.ERROR) { 5197 if (_counts[state] == null) {
5186 _errorCount++; 5198 _counts[state] = 1;
5187 } 5199 } else {
5188 if (state == CacheState.FLUSHED) { 5200 _counts[state]++;
5189 _flushedCount++;
5190 }
5191 if (state == CacheState.IN_PROCESS) {
5192 _inProcessCount++;
5193 }
5194 if (state == CacheState.INVALID) {
5195 _invalidCount++;
5196 }
5197 if (state == CacheState.VALID) {
5198 _validCount++;
5199 } 5201 }
5200 } 5202 }
5201 } 5203 }
5202 5204
5203 class AnalysisContextStatisticsImpl_PartitionDataImpl implements AnalysisContext Statistics_PartitionData { 5205 class AnalysisContextStatisticsImpl_PartitionDataImpl implements AnalysisContext Statistics_PartitionData {
5204 final int astCount; 5206 final int astCount;
5205 5207
5206 final int totalCount; 5208 final int totalCount;
5207 5209
5208 AnalysisContextStatisticsImpl_PartitionDataImpl(this.astCount, this.totalCount ); 5210 AnalysisContextStatisticsImpl_PartitionDataImpl(this.astCount, this.totalCount );
5209 } 5211 }
5210 5212
5211 /** 5213 /**
5212 * Information about single piece of data in the cache. 5214 * Information about single piece of data in the cache.
5213 */ 5215 */
5214 abstract class AnalysisContextStatistics_CacheRow { 5216 abstract class AnalysisContextStatistics_CacheRow {
5215 /** 5217 /**
5218 * List of possible states which can be queried.
5219 */
5220 static const List<CacheState> STATES = const <CacheState>[
5221 CacheState.ERROR, CacheState.FLUSHED, CacheState.IN_PROCESS,
5222 CacheState.INVALID, CacheState.VALID];
5223
5224 /**
5225 * Return the number of entries whose state is [state].
5226 */
5227 int getCount(CacheState state);
5228
5229 /**
5216 * Return the number of entries whose state is [CacheState.ERROR]. 5230 * Return the number of entries whose state is [CacheState.ERROR].
5217 */ 5231 */
5218 int get errorCount; 5232 int get errorCount;
5219 5233
5220 /** 5234 /**
5221 * Return the number of entries whose state is [CacheState.FLUSHED]. 5235 * Return the number of entries whose state is [CacheState.FLUSHED].
5222 */ 5236 */
5223 int get flushedCount; 5237 int get flushedCount;
5224 5238
5225 /** 5239 /**
(...skipping 4976 matching lines...) Expand 10 before | Expand all | Expand 10 after
10202 void set sourceFactory(SourceFactory factory) { 10216 void set sourceFactory(SourceFactory factory) {
10203 InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis- setSourceFactory"); 10217 InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis- setSourceFactory");
10204 _checkThread(instrumentation); 10218 _checkThread(instrumentation);
10205 try { 10219 try {
10206 instrumentation.metric3("contextId", _contextId); 10220 instrumentation.metric3("contextId", _contextId);
10207 _basis.sourceFactory = factory; 10221 _basis.sourceFactory = factory;
10208 } finally { 10222 } finally {
10209 instrumentation.log(); 10223 instrumentation.log();
10210 } 10224 }
10211 } 10225 }
10226
10227 @override
10228 void visitCacheItems(void callback(Source source, SourceEntry dartEntry,
10229 DataDescriptor rowDesc,
10230 CacheState state)) {
10231 _basis.visitCacheItems(callback);
10232 }
10212 } 10233 }
10213 10234
10214 /** 10235 /**
10215 * The interface `InternalAnalysisContext` defines additional behavior for an an alysis context 10236 * The interface `InternalAnalysisContext` defines additional behavior for an an alysis context
10216 * that is required by internal users of the context. 10237 * that is required by internal users of the context.
10217 */ 10238 */
10218 abstract class InternalAnalysisContext implements AnalysisContext { 10239 abstract class InternalAnalysisContext implements AnalysisContext {
10219 /** 10240 /**
10220 * Add the given source with the given information to this context. 10241 * Add the given source with the given information to this context.
10221 * 10242 *
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
10299 TypeProvider get typeProvider; 10320 TypeProvider get typeProvider;
10300 10321
10301 /** 10322 /**
10302 * Given a table mapping the source for the libraries represented by the corre sponding elements to 10323 * Given a table mapping the source for the libraries represented by the corre sponding elements to
10303 * the elements representing the libraries, record those mappings. 10324 * the elements representing the libraries, record those mappings.
10304 * 10325 *
10305 * @param elementMap a table mapping the source for the libraries represented by the elements to 10326 * @param elementMap a table mapping the source for the libraries represented by the elements to
10306 * the elements representing the libraries 10327 * the elements representing the libraries
10307 */ 10328 */
10308 void recordLibraryElements(Map<Source, LibraryElement> elementMap); 10329 void recordLibraryElements(Map<Source, LibraryElement> elementMap);
10330
10331 /**
10332 * Call the given callback function for eache cache item in the context.
10333 */
10334 void visitCacheItems(void callback(Source source, SourceEntry dartEntry,
10335 DataDescriptor rowDesc,
10336 CacheState state));
10309 } 10337 }
10310 10338
10311 /** 10339 /**
10312 * The interface `Logger` defines the behavior of objects that can be used to re ceive 10340 * The interface `Logger` defines the behavior of objects that can be used to re ceive
10313 * information about errors within the analysis engine. Implementations usually write this 10341 * information about errors within the analysis engine. Implementations usually write this
10314 * information to a file, but can also record the information for later use (suc h as during testing) 10342 * information to a file, but can also record the information for later use (suc h as during testing)
10315 * or even ignore the information. 10343 * or even ignore the information.
10316 */ 10344 */
10317 abstract class Logger { 10345 abstract class Logger {
10318 static final Logger NULL = new Logger_NullLogger(); 10346 static final Logger NULL = new Logger_NullLogger();
(...skipping 3153 matching lines...) Expand 10 before | Expand all | Expand 10 after
13472 _index++; 13500 _index++;
13473 if (_index >= _manager._workQueues[_queueIndex].length) { 13501 if (_index >= _manager._workQueues[_queueIndex].length) {
13474 _index = 0; 13502 _index = 0;
13475 _queueIndex++; 13503 _queueIndex++;
13476 while (_queueIndex < _manager._workQueues.length && _manager._workQueues[_ queueIndex].isEmpty) { 13504 while (_queueIndex < _manager._workQueues.length && _manager._workQueues[_ queueIndex].isEmpty) {
13477 _queueIndex++; 13505 _queueIndex++;
13478 } 13506 }
13479 } 13507 }
13480 } 13508 }
13481 } 13509 }
OLDNEW
« no previous file with comments | « pkg/analysis_server/lib/src/get_handler.dart ('k') | pkg/analyzer/test/generated/engine_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698