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

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

Issue 1151563004: Optimize AnalysisContext.getSourcesWithFullName(). (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: rebase Created 5 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
« no previous file with comments | « pkg/analyzer/lib/src/context/cache.dart ('k') | pkg/analyzer/test/src/context/cache_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) 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/src/cancelable_future.dart'; 10 import 'package:analyzer/src/cancelable_future.dart';
(...skipping 917 matching lines...) Expand 10 before | Expand all | Expand 10 after
928 // SourceEntry sourceEntry = getReadableSourceEntryOrNull(htmlSource); 928 // SourceEntry sourceEntry = getReadableSourceEntryOrNull(htmlSource);
929 // if (sourceEntry is HtmlEntry) { 929 // if (sourceEntry is HtmlEntry) {
930 // HtmlEntry htmlEntry = sourceEntry; 930 // HtmlEntry htmlEntry = sourceEntry;
931 // return htmlEntry.getValue(HtmlEntry.RESOLVED_UNIT); 931 // return htmlEntry.getValue(HtmlEntry.RESOLVED_UNIT);
932 // } 932 // }
933 return null; 933 return null;
934 } 934 }
935 935
936 @override 936 @override
937 List<Source> getSourcesWithFullName(String path) { 937 List<Source> getSourcesWithFullName(String path) {
938 List<Source> sources = <Source>[]; 938 return analysisCache.getSourcesWithFullName(path);
939 for (Source source in _cache.sources) {
940 if (source.fullName == path) {
941 sources.add(source);
942 }
943 }
944 return sources;
945 } 939 }
946 940
947 @override 941 @override
948 bool handleContentsChanged( 942 bool handleContentsChanged(
949 Source source, String originalContents, String newContents, bool notify) { 943 Source source, String originalContents, String newContents, bool notify) {
950 CacheEntry entry = _cache.get(source); 944 CacheEntry entry = _cache.get(source);
951 if (entry == null) { 945 if (entry == null) {
952 return false; 946 return false;
953 } 947 }
954 bool changed = newContents != originalContents; 948 bool changed = newContents != originalContents;
(...skipping 1057 matching lines...) Expand 10 before | Expand all | Expand 10 after
2012 PendingFuture pendingFuture = 2006 PendingFuture pendingFuture =
2013 new PendingFuture<T>(_context, target, computeValue); 2007 new PendingFuture<T>(_context, target, computeValue);
2014 if (!pendingFuture.evaluate(entry)) { 2008 if (!pendingFuture.evaluate(entry)) {
2015 _context._pendingFutureTargets 2009 _context._pendingFutureTargets
2016 .putIfAbsent(target, () => <PendingFuture>[]) 2010 .putIfAbsent(target, () => <PendingFuture>[])
2017 .add(pendingFuture); 2011 .add(pendingFuture);
2018 } 2012 }
2019 return pendingFuture.future; 2013 return pendingFuture.future;
2020 } 2014 }
2021 } 2015 }
OLDNEW
« no previous file with comments | « pkg/analyzer/lib/src/context/cache.dart ('k') | pkg/analyzer/test/src/context/cache_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698