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

Side by Side Diff: pkg/analyzer/lib/src/task/html_work_manager.dart

Issue 1343283004: Support for NAVIGATION/OCCURRENCES notifications for any source (such as HTML). (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 3 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/analysis_server/lib/src/analysis_server.dart ('k') | 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) 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.task.html_work_manager; 5 library analyzer.src.task.html_work_manager;
6 6
7 import 'dart:collection'; 7 import 'dart:collection';
8 8
9 import 'package:analyzer/src/context/cache.dart'; 9 import 'package:analyzer/src/context/cache.dart';
10 import 'package:analyzer/src/generated/engine.dart' 10 import 'package:analyzer/src/generated/engine.dart'
11 show 11 show
12 AnalysisEngine, 12 AnalysisEngine,
13 AnalysisErrorInfo, 13 AnalysisErrorInfo,
14 AnalysisErrorInfoImpl, 14 AnalysisErrorInfoImpl,
15 AnalysisOptions, 15 AnalysisOptions,
16 CacheState, 16 CacheState,
17 InternalAnalysisContext; 17 InternalAnalysisContext;
18 import 'package:analyzer/src/generated/error.dart'; 18 import 'package:analyzer/src/generated/error.dart';
19 import 'package:analyzer/src/generated/source.dart'; 19 import 'package:analyzer/src/generated/source.dart';
20 import 'package:analyzer/src/generated/utilities_collection.dart'; 20 import 'package:analyzer/src/generated/utilities_collection.dart';
21 import 'package:analyzer/src/task/driver.dart';
22 import 'package:analyzer/src/task/html.dart'; 21 import 'package:analyzer/src/task/html.dart';
23 import 'package:analyzer/task/html.dart'; 22 import 'package:analyzer/task/html.dart';
24 import 'package:analyzer/task/model.dart'; 23 import 'package:analyzer/task/model.dart';
25 24
26 /** 25 /**
27 * The manager for HTML specific analysis. 26 * The manager for HTML specific analysis.
28 */ 27 */
29 class HtmlWorkManager implements WorkManager { 28 class HtmlWorkManager implements WorkManager {
30 /** 29 /**
31 * The context for which work is being managed. 30 * The context for which work is being managed.
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 TargetedResult result = priorityResultQueue.first; 125 TargetedResult result = priorityResultQueue.first;
127 if (!_needsComputing(result.target, result.result)) { 126 if (!_needsComputing(result.target, result.result)) {
128 priorityResultQueue.remove(result); 127 priorityResultQueue.remove(result);
129 continue; 128 continue;
130 } 129 }
131 return result; 130 return result;
132 } 131 }
133 // Try to find a new HTML file to analyze. 132 // Try to find a new HTML file to analyze.
134 while (sourceQueue.isNotEmpty) { 133 while (sourceQueue.isNotEmpty) {
135 Source htmlSource = sourceQueue.first; 134 Source htmlSource = sourceQueue.first;
136 // Maybe done with this library.
137 if (!_needsComputing(htmlSource, HTML_ERRORS)) { 135 if (!_needsComputing(htmlSource, HTML_ERRORS)) {
138 sourceQueue.remove(htmlSource); 136 sourceQueue.remove(htmlSource);
139 continue; 137 continue;
140 } 138 }
141 // Analyze this library.
142 return new TargetedResult(htmlSource, HTML_ERRORS); 139 return new TargetedResult(htmlSource, HTML_ERRORS);
143 } 140 }
144 // No results to compute. 141 // No results to compute.
145 return null; 142 return null;
146 } 143 }
147 144
148 @override 145 @override
149 WorkOrderPriority getNextResultPriority() { 146 WorkOrderPriority getNextResultPriority() {
150 if (priorityResultQueue.isNotEmpty) { 147 if (priorityResultQueue.isNotEmpty) {
151 return WorkOrderPriority.PRIORITY; 148 return WorkOrderPriority.PRIORITY;
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
252 return state != CacheState.VALID && state != CacheState.ERROR; 249 return state != CacheState.VALID && state != CacheState.ERROR;
253 } 250 }
254 251
255 /** 252 /**
256 * Return `true` if the given target is an HTML source. 253 * Return `true` if the given target is an HTML source.
257 */ 254 */
258 static bool _isHtmlSource(AnalysisTarget target) { 255 static bool _isHtmlSource(AnalysisTarget target) {
259 return target is Source && AnalysisEngine.isHtmlFileName(target.fullName); 256 return target is Source && AnalysisEngine.isHtmlFileName(target.fullName);
260 } 257 }
261 } 258 }
OLDNEW
« no previous file with comments | « pkg/analysis_server/lib/src/analysis_server.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698