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

Side by Side Diff: pkg/analyzer_plugin/lib/utilities/subscription_manager.dart

Issue 2667823003: Add top-level driver and abstract plugin superclass (Closed)
Patch Set: Created 3 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
OLDNEW
(Empty)
1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file
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.
4
5 import 'package:analyzer_plugin/protocol/generated_protocol.dart';
6
7 /**
8 * An object that manages the subscriptions for analysis results.
9 */
10 class SubscriptionManager {
11 /**
12 * The current set of subscriptions.
13 */
14 Map<AnalysisService, List<String>> _subscriptions;
15
16 /**
17 * Initialize a newly created subscription manager to have no subscriptions.
18 */
19 SubscriptionManager();
20
21 /**
22 * Return a list of the services for which the file with the given [filePath]
23 * has been subscribed.
24 */
25 List<AnalysisService> servicesForFile(String filePath) {
26 List<AnalysisService> services = <AnalysisService>[];
27 if (_subscriptions != null) {
28 _subscriptions.forEach((AnalysisService service, List<String> files) {
29 if (files.contains(filePath)) {
30 services.add(service);
31 }
32 });
33 }
34 return services;
35 }
36
37 /**
38 * Set the current set of subscriptions to those described by the given map of
39 * [subscriptions].
40 */
41 void setSubscriptions(Map<AnalysisService, List<String>> subscriptions) {
42 _subscriptions = subscriptions;
43 }
44 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698