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

Side by Side Diff: pkg/analyzer/lib/src/context/context.dart

Issue 1573283003: Add a new 'summary' performance tag. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 11 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
« no previous file with comments | « no previous file | pkg/analyzer/lib/src/generated/engine.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) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, 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.src.context.context; 5 library analyzer.src.context.context;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 import 'dart:collection'; 8 import 'dart:collection';
9 9
10 import 'package:analyzer/dart/element/element.dart'; 10 import 'package:analyzer/dart/element/element.dart';
(...skipping 470 matching lines...) Expand 10 before | Expand all | Expand 10 after
481 @override 481 @override
482 TypeSystem get typeSystem { 482 TypeSystem get typeSystem {
483 if (_typeSystem == null) { 483 if (_typeSystem == null) {
484 _typeSystem = TypeSystem.create(this); 484 _typeSystem = TypeSystem.create(this);
485 } 485 }
486 return _typeSystem; 486 return _typeSystem;
487 } 487 }
488 488
489 @override 489 @override
490 bool aboutToComputeResult(CacheEntry entry, ResultDescriptor result) { 490 bool aboutToComputeResult(CacheEntry entry, ResultDescriptor result) {
491 AnalysisTarget target = entry.target; 491 return PerformanceStatistics.summary.makeCurrentWhile(() {
492 // TYPE_PROVIDER 492 AnalysisTarget target = entry.target;
493 if (target is AnalysisContextTarget && result == TYPE_PROVIDER) { 493 // TYPE_PROVIDER
494 DartSdk dartSdk = sourceFactory.dartSdk; 494 if (target is AnalysisContextTarget && result == TYPE_PROVIDER) {
495 if (dartSdk != null) { 495 DartSdk dartSdk = sourceFactory.dartSdk;
496 AnalysisContext sdkContext = dartSdk.context; 496 if (dartSdk != null) {
497 if (!identical(sdkContext, this) && 497 AnalysisContext sdkContext = dartSdk.context;
498 sdkContext is InternalAnalysisContext) { 498 if (!identical(sdkContext, this) &&
499 return sdkContext.aboutToComputeResult(entry, result); 499 sdkContext is InternalAnalysisContext) {
500 return sdkContext.aboutToComputeResult(entry, result);
501 }
500 } 502 }
501 } 503 }
502 } 504 // A result for a Source.
503 // A result for a Source. 505 Source source = target.source;
504 Source source = target.source; 506 if (source != null) {
505 if (source != null) { 507 InternalAnalysisContext context = _cache.getContextFor(source);
506 InternalAnalysisContext context = _cache.getContextFor(source); 508 if (!identical(context, this)) {
507 if (!identical(context, this)) { 509 return context.aboutToComputeResult(entry, result);
508 return context.aboutToComputeResult(entry, result); 510 }
509 } 511 }
510 } 512 return false;
511 return false; 513 });
512 } 514 }
513 515
514 @override 516 @override
515 void addListener(AnalysisListener listener) { 517 void addListener(AnalysisListener listener) {
516 if (!_listeners.contains(listener)) { 518 if (!_listeners.contains(listener)) {
517 _listeners.add(listener); 519 _listeners.add(listener);
518 } 520 }
519 } 521 }
520 522
521 @override 523 @override
(...skipping 532 matching lines...) Expand 10 before | Expand all | Expand 10 after
1054 @override 1056 @override
1055 Document parseHtmlDocument(Source source) { 1057 Document parseHtmlDocument(Source source) {
1056 if (!AnalysisEngine.isHtmlFileName(source.shortName)) { 1058 if (!AnalysisEngine.isHtmlFileName(source.shortName)) {
1057 return null; 1059 return null;
1058 } 1060 }
1059 return computeResult(source, HTML_DOCUMENT); 1061 return computeResult(source, HTML_DOCUMENT);
1060 } 1062 }
1061 1063
1062 @override 1064 @override
1063 AnalysisResult performAnalysisTask() { 1065 AnalysisResult performAnalysisTask() {
1064 return PerformanceStatistics.performAnaysis.makeCurrentWhile(() { 1066 return PerformanceStatistics.performAnalysis.makeCurrentWhile(() {
1065 _evaluatePendingFutures(); 1067 _evaluatePendingFutures();
1066 bool done = !driver.performAnalysisTask(); 1068 bool done = !driver.performAnalysisTask();
1067 List<ChangeNotice> notices = _getChangeNotices(done); 1069 List<ChangeNotice> notices = _getChangeNotices(done);
1068 if (notices != null) { 1070 if (notices != null) {
1069 int noticeCount = notices.length; 1071 int noticeCount = notices.length;
1070 for (int i = 0; i < noticeCount; i++) { 1072 for (int i = 0; i < noticeCount; i++) {
1071 ChangeNotice notice = notices[i]; 1073 ChangeNotice notice = notices[i];
1072 _notifyErrors(notice.source, notice.errors, notice.lineInfo); 1074 _notifyErrors(notice.source, notice.errors, notice.lineInfo);
1073 } 1075 }
1074 } 1076 }
(...skipping 956 matching lines...) Expand 10 before | Expand all | Expand 10 after
2031 } 2033 }
2032 DartSdk sdk = factory.dartSdk; 2034 DartSdk sdk = factory.dartSdk;
2033 if (sdk == null) { 2035 if (sdk == null) {
2034 throw new IllegalArgumentException( 2036 throw new IllegalArgumentException(
2035 "The source factory for an SDK analysis context must have a DartUriRes olver"); 2037 "The source factory for an SDK analysis context must have a DartUriRes olver");
2036 } 2038 }
2037 return new AnalysisCache( 2039 return new AnalysisCache(
2038 <CachePartition>[AnalysisEngine.instance.partitionManager.forSdk(sdk)]); 2040 <CachePartition>[AnalysisEngine.instance.partitionManager.forSdk(sdk)]);
2039 } 2041 }
2040 } 2042 }
OLDNEW
« no previous file with comments | « no previous file | pkg/analyzer/lib/src/generated/engine.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698