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

Side by Side Diff: pkg/analysis_server/lib/src/status/memory_use.dart

Issue 2421473007: Guard against a hypothetical null pointer dereference (Closed)
Patch Set: Created 4 years, 2 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 | no next file » | 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) 2016, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2016, 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 analysis_server.src.status.memory_use; 5 library analysis_server.src.status.memory_use;
6 6
7 import 'dart:collection'; 7 import 'dart:collection';
8 8
9 import 'package:analysis_server/src/analysis_server.dart'; 9 import 'package:analysis_server/src/analysis_server.dart';
10 import 'package:analyzer/dart/ast/ast.dart'; 10 import 'package:analyzer/dart/ast/ast.dart';
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after
218 */ 218 */
219 void processAnalysisServer(AnalysisServer server) { 219 void processAnalysisServer(AnalysisServer server) {
220 _recordInstance(server, null); 220 _recordInstance(server, null);
221 Iterable<AnalysisContext> contexts = server.analysisContexts; 221 Iterable<AnalysisContext> contexts = server.analysisContexts;
222 for (AnalysisContextImpl context in contexts) { 222 for (AnalysisContextImpl context in contexts) {
223 _processAnalysisContext(context, server); 223 _processAnalysisContext(context, server);
224 } 224 }
225 DartSdkManager manager = server.sdkManager; 225 DartSdkManager manager = server.sdkManager;
226 List<SdkDescription> descriptors = manager.sdkDescriptors; 226 List<SdkDescription> descriptors = manager.sdkDescriptors;
227 for (SdkDescription descriptor in descriptors) { 227 for (SdkDescription descriptor in descriptors) {
228 _processAnalysisContext( 228 DartSdk sdk = manager.getSdk(descriptor, () => null);
229 manager.getSdk(descriptor, () => null).context, manager); 229 if (sdk != null) {
230 _processAnalysisContext(sdk.context, manager);
231 }
230 } 232 }
231 } 233 }
232 234
233 void _processAnalysisContext(AnalysisContextImpl context, Object owner) { 235 void _processAnalysisContext(AnalysisContextImpl context, Object owner) {
234 _recordInstance(context, owner); 236 _recordInstance(context, owner);
235 _recordInstance(context.analysisCache, context); 237 _recordInstance(context.analysisCache, context);
236 CachePartition partition = context.privateAnalysisCachePartition; 238 CachePartition partition = context.privateAnalysisCachePartition;
237 Map<AnalysisTarget, CacheEntry> map = partition.entryMap; 239 Map<AnalysisTarget, CacheEntry> map = partition.entryMap;
238 map.forEach((AnalysisTarget target, CacheEntry entry) { 240 map.forEach((AnalysisTarget target, CacheEntry entry) {
239 _processAnalysisTarget(target, partition); 241 _processAnalysisTarget(target, partition);
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
305 } 307 }
306 } 308 }
307 ownerMap 309 ownerMap
308 .putIfAbsent(instance.runtimeType, () => new HashSet<Type>()) 310 .putIfAbsent(instance.runtimeType, () => new HashSet<Type>())
309 .add(owner.runtimeType); 311 .add(owner.runtimeType);
310 if (instance is LibrarySpecificUnit) { 312 if (instance is LibrarySpecificUnit) {
311 uniqueLSUs.add(instance); 313 uniqueLSUs.add(instance);
312 } 314 }
313 } 315 }
314 } 316 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698