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

Side by Side Diff: pkg/analysis_server/lib/src/domain_completion.dart

Issue 787653002: remove unused cache arguments (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: merge Created 6 years 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | pkg/analysis_server/lib/src/services/completion/completion_manager.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) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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 domain.completion; 5 library domain.completion;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 8
9 import 'package:analysis_server/src/analysis_server.dart'; 9 import 'package:analysis_server/src/analysis_server.dart';
10 import 'package:analysis_server/src/constants.dart'; 10 import 'package:analysis_server/src/constants.dart';
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 * creating a new manager or returning an existing manager as necessary. 67 * creating a new manager or returning an existing manager as necessary.
68 */ 68 */
69 CompletionManager completionManagerFor(AnalysisContext context, 69 CompletionManager completionManagerFor(AnalysisContext context,
70 Source source) { 70 Source source) {
71 if (_manager != null) { 71 if (_manager != null) {
72 if (_manager.context == context && _manager.source == source) { 72 if (_manager.context == context && _manager.source == source) {
73 return _manager; 73 return _manager;
74 } 74 }
75 _discardManager(); 75 _discardManager();
76 } 76 }
77 _manager = 77 _manager = createCompletionManager(context, source, server.searchEngine);
78 createCompletionManager(context, source, server.searchEngine, null);
79 if (context != null) { 78 if (context != null) {
80 _sourcesChangedSubscription = 79 _sourcesChangedSubscription =
81 context.onSourcesChanged.listen(sourcesChanged); 80 context.onSourcesChanged.listen(sourcesChanged);
82 } 81 }
83 return _manager; 82 return _manager;
84 } 83 }
85 84
86 /** 85 /**
87 * If the context associated with the cache has changed or been removed 86 * If the context associated with the cache has changed or been removed
88 * then discard the cache. 87 * then discard the cache.
89 */ 88 */
90 void contextsChanged(ContextsChangedEvent event) { 89 void contextsChanged(ContextsChangedEvent event) {
91 if (_manager != null) { 90 if (_manager != null) {
92 AnalysisContext context = _manager.context; 91 AnalysisContext context = _manager.context;
93 if (event.changed.contains(context) || event.removed.contains(context)) { 92 if (event.changed.contains(context) || event.removed.contains(context)) {
94 _discardManager(); 93 _discardManager();
95 } 94 }
96 } 95 }
97 } 96 }
98 97
99 CompletionManager createCompletionManager(AnalysisContext context, 98 CompletionManager createCompletionManager(AnalysisContext context,
100 Source source, SearchEngine searchEngine, CompletionCache cache) { 99 Source source, SearchEngine searchEngine) {
101 return new CompletionManager.create(context, source, searchEngine, cache); 100 return new CompletionManager.create(context, source, searchEngine);
102 } 101 }
103 102
104 @override 103 @override
105 Response handleRequest(Request request) { 104 Response handleRequest(Request request) {
106 try { 105 try {
107 String requestName = request.method; 106 String requestName = request.method;
108 if (requestName == COMPLETION_GET_SUGGESTIONS) { 107 if (requestName == COMPLETION_GET_SUGGESTIONS) {
109 return processRequest(request); 108 return processRequest(request);
110 } 109 }
111 } on RequestFailure catch (exception) { 110 } on RequestFailure catch (exception) {
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
202 * Discard the sourcesChanged subscription if any 201 * Discard the sourcesChanged subscription if any
203 */ 202 */
204 void _discardManager() { 203 void _discardManager() {
205 if (_sourcesChangedSubscription != null) { 204 if (_sourcesChangedSubscription != null) {
206 _sourcesChangedSubscription.cancel(); 205 _sourcesChangedSubscription.cancel();
207 _sourcesChangedSubscription = null; 206 _sourcesChangedSubscription = null;
208 } 207 }
209 _manager = null; 208 _manager = null;
210 } 209 }
211 } 210 }
OLDNEW
« no previous file with comments | « no previous file | pkg/analysis_server/lib/src/services/completion/completion_manager.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698