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

Side by Side Diff: sdk/lib/web_audio/dart2js/web_audio_dart2js.dart

Issue 14103010: Change hasSubscribers to hasListener. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Addressed comments. Created 7 years, 8 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 | « sdk/lib/io/secure_socket.dart ('k') | sdk/lib/web_audio/dartium/web_audio_dartium.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 library dart.dom.web_audio; 1 library dart.dom.web_audio;
2 2
3 import 'dart:async'; 3 import 'dart:async';
4 import 'dart:collection'; 4 import 'dart:collection';
5 import 'dart:html'; 5 import 'dart:html';
6 import 'dart:html_common'; 6 import 'dart:html_common';
7 import 'dart:_js_helper' show Creates, Returns, convertDartClosureToJS; 7 import 'dart:_js_helper' show Creates, Returns, convertDartClosureToJS;
8 import 'dart:_foreign_helper' show JS; 8 import 'dart:_foreign_helper' show JS;
9 // DO NOT EDIT - unless you are editing documentation as per: 9 // DO NOT EDIT - unless you are editing documentation as per:
10 // https://code.google.com/p/dart/wiki/ContributingHTMLDocumentation 10 // https://code.google.com/p/dart/wiki/ContributingHTMLDocumentation
(...skipping 809 matching lines...) Expand 10 before | Expand all | Expand 10 after
820 * Get a Stream that fires events when AudioProcessingEvents occur. 820 * Get a Stream that fires events when AudioProcessingEvents occur.
821 * This particular stream is special in that it only allows one listener to a 821 * This particular stream is special in that it only allows one listener to a
822 * given stream. Converting the returned Stream [asBroadcast] will likely ruin 822 * given stream. Converting the returned Stream [asBroadcast] will likely ruin
823 * the soft-real-time properties which which these events are fired and can 823 * the soft-real-time properties which which these events are fired and can
824 * be processed. 824 * be processed.
825 */ 825 */
826 Stream<AudioProcessingEvent> get onAudioProcess { 826 Stream<AudioProcessingEvent> get onAudioProcess {
827 if (_eventStream == null) { 827 if (_eventStream == null) {
828 var controller = new StreamController(); 828 var controller = new StreamController();
829 var callback = (audioData) { 829 var callback = (audioData) {
830 if (controller.hasSubscribers) { 830 if (controller.hasListener) {
831 // This stream is a strange combination of broadcast and single 831 // This stream is a strange combination of broadcast and single
832 // subscriber streams. We only allow one listener, but if there is 832 // subscriber streams. We only allow one listener, but if there is
833 // no listener, we don't queue up events, we just drop them on the 833 // no listener, we don't queue up events, we just drop them on the
834 // floor. 834 // floor.
835 controller.add(audioData); 835 controller.add(audioData);
836 } 836 }
837 }; 837 };
838 _setEventListener(callback); 838 _setEventListener(callback);
839 _eventStream = controller.stream; 839 _eventStream = controller.stream;
840 } 840 }
(...skipping 28 matching lines...) Expand all
869 } 869 }
870 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 870 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
871 // for details. All rights reserved. Use of this source code is governed by a 871 // for details. All rights reserved. Use of this source code is governed by a
872 // BSD-style license that can be found in the LICENSE file. 872 // BSD-style license that can be found in the LICENSE file.
873 873
874 874
875 @DocsEditable 875 @DocsEditable
876 @DomName('WaveTable') 876 @DomName('WaveTable')
877 class WaveTable native "*WaveTable" { 877 class WaveTable native "*WaveTable" {
878 } 878 }
OLDNEW
« no previous file with comments | « sdk/lib/io/secure_socket.dart ('k') | sdk/lib/web_audio/dartium/web_audio_dartium.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698