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

Unified Diff: sdk/lib/async/stream_impl.dart

Issue 11787039: Fix stream-pausing in dart2js. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Updated comment. Created 7 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | tests/lib/lib.status » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/async/stream_impl.dart
diff --git a/sdk/lib/async/stream_impl.dart b/sdk/lib/async/stream_impl.dart
index 3ed70b1d2587ce636f033b2d413fea6c81e47095..13285a66d03d104bdb99b20fd59fb98747c89811 100644
--- a/sdk/lib/async/stream_impl.dart
+++ b/sdk/lib/async/stream_impl.dart
@@ -179,8 +179,17 @@ abstract class _StreamImpl<T> extends Stream<T> {
/** Update the stream's own pause count only. */
void _updatePauseCount(int by) {
- _state += by << _STREAM_PAUSE_COUNT_SHIFT;
+ int oldState = _state;
+ // We can't just _state += by << _STREAM_PAUSE_COUNT_SHIFT, since dart2js
+ // converts the result of the left-shift to a positive number.
+ if (by >= 0) {
+ _state = oldState + (by << _STREAM_PAUSE_COUNT_SHIFT);
+ } else {
+ _state = oldState - ((-by) << _STREAM_PAUSE_COUNT_SHIFT);
+ }
assert(_state >= 0);
+ assert((_state >> _STREAM_PAUSE_COUNT_SHIFT) ==
+ (oldState >> _STREAM_PAUSE_COUNT_SHIFT) + by);
}
void _setClosed() {
« no previous file with comments | « no previous file | tests/lib/lib.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698