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

Side by Side Diff: tools/dom/templates/html/impl/impl_Window.darttemplate

Issue 16125005: Make new StreamController be async by default. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address review comments Created 7 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « tools/dom/templates/html/impl/impl_ScriptProcessorNode.darttemplate ('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) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 part of $LIBRARYNAME; 5 part of $LIBRARYNAME;
6 6
7 $if DART2JS 7 $if DART2JS
8 $(ANNOTATIONS)class $CLASSNAME$EXTENDS$IMPLEMENTS native "Window,DOMWindow" { 8 $(ANNOTATIONS)class $CLASSNAME$EXTENDS$IMPLEMENTS native "Window,DOMWindow" {
9 $else 9 $else
10 $(ANNOTATIONS)class $CLASSNAME$EXTENDS$IMPLEMENTS$NATIVESPEC { 10 $(ANNOTATIONS)class $CLASSNAME$EXTENDS$IMPLEMENTS$NATIVESPEC {
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after
308 } 308 }
309 } 309 }
310 310
311 class _BeforeUnloadEventStreamProvider implements 311 class _BeforeUnloadEventStreamProvider implements
312 EventStreamProvider<BeforeUnloadEvent> { 312 EventStreamProvider<BeforeUnloadEvent> {
313 final String _eventType; 313 final String _eventType;
314 314
315 const _BeforeUnloadEventStreamProvider(this._eventType); 315 const _BeforeUnloadEventStreamProvider(this._eventType);
316 316
317 Stream<BeforeUnloadEvent> forTarget(EventTarget e, {bool useCapture: false}) { 317 Stream<BeforeUnloadEvent> forTarget(EventTarget e, {bool useCapture: false}) {
318 var controller = new StreamController(); 318 var controller = new StreamController(sync: true);
319 var stream = new _EventStream(e, _eventType, useCapture); 319 var stream = new _EventStream(e, _eventType, useCapture);
320 stream.listen((event) { 320 stream.listen((event) {
321 var wrapped = new _BeforeUnloadEvent(event); 321 var wrapped = new _BeforeUnloadEvent(event);
322 controller.add(wrapped); 322 controller.add(wrapped);
323 return wrapped.returnValue; 323 return wrapped.returnValue;
324 }); 324 });
325 325
326 return controller.stream; 326 return controller.stream;
327 } 327 }
328 328
329 String getEventType(EventTarget target) { 329 String getEventType(EventTarget target) {
330 return _eventType; 330 return _eventType;
331 } 331 }
332 } 332 }
OLDNEW
« no previous file with comments | « tools/dom/templates/html/impl/impl_ScriptProcessorNode.darttemplate ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698