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

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

Issue 924563002: Flush entries for unreferenced sources (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Clean up Created 5 years, 10 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
« no previous file with comments | « no previous file | pkg/analyzer/test/generated/engine_test.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) 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:math" as math; 10 import "dart:math" as math;
(...skipping 5156 matching lines...) Expand 10 before | Expand all | Expand 10 after
5167 if (sourceEntry.exception != null) { 5167 if (sourceEntry.exception != null) {
5168 if (!exists(source)) { 5168 if (!exists(source)) {
5169 missingSources.add(source); 5169 missingSources.add(source);
5170 } 5170 }
5171 } 5171 }
5172 } 5172 }
5173 int count = changedSources.length; 5173 int count = changedSources.length;
5174 for (int i = 0; i < count; i++) { 5174 for (int i = 0; i < count; i++) {
5175 _sourceChanged(changedSources[i]); 5175 _sourceChanged(changedSources[i]);
5176 } 5176 }
5177 int removalCount = 0;
5178 for (Source source in missingSources) {
5179 if (getLibrariesContaining(source).isEmpty &&
5180 getLibrariesDependingOn(source).isEmpty) {
5181 _cache.remove(source);
5182 removalCount++;
5183 }
5184 }
5177 int consistencyCheckEnd = JavaSystem.nanoTime(); 5185 int consistencyCheckEnd = JavaSystem.nanoTime();
5178 if (changedSources.length > 0 || missingSources.length > 0) { 5186 if (changedSources.length > 0 || missingSources.length > 0) {
5179 StringBuffer buffer = new StringBuffer(); 5187 StringBuffer buffer = new StringBuffer();
5180 buffer.write("Consistency check took "); 5188 buffer.write("Consistency check took ");
5181 buffer.write((consistencyCheckEnd - consistencyCheckStart) / 1000000.0); 5189 buffer.write((consistencyCheckEnd - consistencyCheckStart) / 1000000.0);
5182 buffer.writeln(" ms and found"); 5190 buffer.writeln(" ms and found");
5183 buffer.write(" "); 5191 buffer.write(" ");
5184 buffer.write(changedSources.length); 5192 buffer.write(changedSources.length);
5185 buffer.writeln(" inconsistent entries"); 5193 buffer.writeln(" inconsistent entries");
5186 buffer.write(" "); 5194 buffer.write(" ");
5187 buffer.write(missingSources.length); 5195 buffer.write(missingSources.length);
5188 buffer.writeln(" missing sources"); 5196 buffer.write(" missing sources (");
5197 buffer.write(removalCount);
5198 buffer.writeln(" removed");
5189 for (Source source in missingSources) { 5199 for (Source source in missingSources) {
5190 buffer.write(" "); 5200 buffer.write(" ");
5191 buffer.writeln(source.fullName); 5201 buffer.writeln(source.fullName);
5192 } 5202 }
5193 _logInformation(buffer.toString()); 5203 _logInformation(buffer.toString());
5194 } 5204 }
5195 return changedSources.length > 0; 5205 return changedSources.length > 0;
5196 } 5206 }
5197 5207
5198 void _validateLastIncrementalResolutionResult() { 5208 void _validateLastIncrementalResolutionResult() {
(...skipping 6638 matching lines...) Expand 10 before | Expand all | Expand 10 after
11837 throw new ArgumentError("Invalid descriptor: $descriptor"); 11847 throw new ArgumentError("Invalid descriptor: $descriptor");
11838 } 11848 }
11839 _validateStateChange(descriptor, CacheState.VALID); 11849 _validateStateChange(descriptor, CacheState.VALID);
11840 CachedResult result = 11850 CachedResult result =
11841 resultMap.putIfAbsent(descriptor, () => new CachedResult(descriptor)); 11851 resultMap.putIfAbsent(descriptor, () => new CachedResult(descriptor));
11842 countTransition(descriptor, result); 11852 countTransition(descriptor, result);
11843 result.state = CacheState.VALID; 11853 result.state = CacheState.VALID;
11844 result.value = value == null ? descriptor.defaultValue : value; 11854 result.value = value == null ? descriptor.defaultValue : value;
11845 } 11855 }
11846 11856
11847 /**
11848 * Increment the count of the number of times that data represented by the
11849 * given [descriptor] was transitioned from the current state (as found in the
11850 * given [result] to a valid state.
11851 */
11852 static void countTransition(DataDescriptor descriptor, CachedResult result) {
11853 Map<CacheState, int> countMap =
11854 transitionMap.putIfAbsent(descriptor, () => new HashMap<CacheState, int> ());
11855 int count = countMap[result.state];
11856 countMap[result.state] = count == null ? 1 : count + 1;
11857 }
11858
11859 @override 11857 @override
11860 String toString() { 11858 String toString() {
11861 StringBuffer buffer = new StringBuffer(); 11859 StringBuffer buffer = new StringBuffer();
11862 _writeOn(buffer); 11860 _writeOn(buffer);
11863 return buffer.toString(); 11861 return buffer.toString();
11864 } 11862 }
11865 11863
11866 /** 11864 /**
11867 * Flush the value of the data described by the [descriptor]. 11865 * Flush the value of the data described by the [descriptor].
11868 */ 11866 */
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
11999 * the given [buffer]. 11997 * the given [buffer].
12000 */ 11998 */
12001 void _writeStateOn(StringBuffer buffer, String label, 11999 void _writeStateOn(StringBuffer buffer, String label,
12002 DataDescriptor descriptor) { 12000 DataDescriptor descriptor) {
12003 CachedResult result = resultMap[descriptor]; 12001 CachedResult result = resultMap[descriptor];
12004 buffer.write("; "); 12002 buffer.write("; ");
12005 buffer.write(label); 12003 buffer.write(label);
12006 buffer.write(" = "); 12004 buffer.write(" = ");
12007 buffer.write(result == null ? CacheState.INVALID : result.state); 12005 buffer.write(result == null ? CacheState.INVALID : result.state);
12008 } 12006 }
12007
12008 /**
12009 * Increment the count of the number of times that data represented by the
12010 * given [descriptor] was transitioned from the current state (as found in the
12011 * given [result] to a valid state.
12012 */
12013 static void countTransition(DataDescriptor descriptor, CachedResult result) {
12014 Map<CacheState, int> countMap =
12015 transitionMap.putIfAbsent(descriptor, () => new HashMap<CacheState, int> ());
12016 int count = countMap[result.state];
12017 countMap[result.state] = count == null ? 1 : count + 1;
12018 }
12009 } 12019 }
12010 12020
12011 /** 12021 /**
12012 * The enumerated type `Priority` defines the priority levels used to return sou rces in an 12022 * The enumerated type `Priority` defines the priority levels used to return sou rces in an
12013 * optimal order. A smaller ordinal value equates to a higher priority. 12023 * optimal order. A smaller ordinal value equates to a higher priority.
12014 */ 12024 */
12015 class SourcePriority extends Enum<SourcePriority> { 12025 class SourcePriority extends Enum<SourcePriority> {
12016 /** 12026 /**
12017 * Used for a Dart source that is known to be a part contained in a library th at was recently 12027 * Used for a Dart source that is known to be a part contained in a library th at was recently
12018 * resolved. These parts are given a higher priority because there is a high p robability that 12028 * resolved. These parts are given a higher priority because there is a high p robability that
(...skipping 416 matching lines...) Expand 10 before | Expand all | Expand 10 after
12435 if (element.id == _id) { 12445 if (element.id == _id) {
12436 result = element; 12446 result = element;
12437 throw new _ElementByIdFinderException(); 12447 throw new _ElementByIdFinderException();
12438 } 12448 }
12439 super.visitElement(element); 12449 super.visitElement(element);
12440 } 12450 }
12441 } 12451 }
12442 12452
12443 class _ElementByIdFinderException { 12453 class _ElementByIdFinderException {
12444 } 12454 }
OLDNEW
« no previous file with comments | « no previous file | pkg/analyzer/test/generated/engine_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698