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

Side by Side Diff: pkg/analysis_server/lib/src/services/completion/completion_manager.dart

Issue 801863002: call dispose so completion manager can cancel pending operations (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
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 services.completion.computer; 5 library services.completion.computer;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 8
9 import 'package:analysis_server/src/protocol.dart'; 9 import 'package:analysis_server/src/protocol.dart';
10 import 'package:analysis_server/src/services/completion/dart_completion_manager. dart'; 10 import 'package:analysis_server/src/services/completion/dart_completion_manager. dart';
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 /** 85 /**
86 * Compute completion results for the given reqeust and append them to the str eam. 86 * Compute completion results for the given reqeust and append them to the str eam.
87 * Clients should not call this method directly as it is automatically called 87 * Clients should not call this method directly as it is automatically called
88 * when a client listens to the stream returned by [results]. 88 * when a client listens to the stream returned by [results].
89 * Subclasses should override this method, append at least one result 89 * Subclasses should override this method, append at least one result
90 * to the [controller], and close the controller stream once complete. 90 * to the [controller], and close the controller stream once complete.
91 */ 91 */
92 void computeSuggestions(CompletionRequest request); 92 void computeSuggestions(CompletionRequest request);
93 93
94 /** 94 /**
95 * Discard any pending operations.
96 * Subclasses may override but should call super.dispose
97 */
98 void dispose() {
99 }
100
101 /**
95 * Generate a stream of code completion results. 102 * Generate a stream of code completion results.
96 */ 103 */
97 Stream<CompletionResult> results(CompletionRequest request) { 104 Stream<CompletionResult> results(CompletionRequest request) {
98 controller = new StreamController<CompletionResult>(onListen: () { 105 controller = new StreamController<CompletionResult>(onListen: () {
99 scheduleMicrotask(() { 106 scheduleMicrotask(() {
100 computeSuggestions(request); 107 computeSuggestions(request);
101 }); 108 });
102 }); 109 });
103 return controller.stream; 110 return controller.stream;
104 } 111 }
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
255 */ 262 */
256 final String name; 263 final String name;
257 264
258 /** 265 /**
259 * The elapse time or `null` if undefined. 266 * The elapse time or `null` if undefined.
260 */ 267 */
261 final Duration elapsed; 268 final Duration elapsed;
262 269
263 OperationPerformance(this.name, this.elapsed); 270 OperationPerformance(this.name, this.elapsed);
264 } 271 }
OLDNEW
« no previous file with comments | « pkg/analysis_server/lib/src/domain_completion.dart ('k') | pkg/analysis_server/test/domain_completion_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698