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

Side by Side Diff: samples/swarm/swarm_ui_lib/base/AnimationScheduler.dart

Issue 12793003: Rename Timer.repeating to Timer.periodic. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 9 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
OLDNEW
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, 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 base; 5 part of base;
6 6
7 typedef void AnimationCallback(num currentTime); 7 typedef void AnimationCallback(num currentTime);
8 8
9 class CallbackData { 9 class CallbackData {
10 final AnimationCallback callback; 10 final AnimationCallback callback;
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 _callbacks.add(callbackData); 86 _callbacks.add(callbackData);
87 if (_timer == null) { 87 if (_timer == null) {
88 _setupInterval(); 88 _setupInterval();
89 } 89 }
90 } 90 }
91 91
92 void _setupInterval() { 92 void _setupInterval() {
93 // Assert that we never schedule multiple frames at once. 93 // Assert that we never schedule multiple frames at once.
94 assert(__timer == null); 94 assert(__timer == null);
95 if (USE_INTERVALS) { 95 if (USE_INTERVALS) {
96 _timer = new Timer.repeating(const Duration(milliseconds: MS_PER_FRAME), 96 _timer = new Timer.periodic(const Duration(milliseconds: MS_PER_FRAME),
97 (_) { _step(); }); 97 (_) { _step(); });
98 } else { 98 } else {
99 if (_webkitAnimationFrameMaybeAvailable) { 99 if (_webkitAnimationFrameMaybeAvailable) {
100 try { 100 try {
101 // TODO(jacobr): passing in document should not be required. 101 // TODO(jacobr): passing in document should not be required.
102 window.webkitRequestAnimationFrame( 102 window.webkitRequestAnimationFrame(
103 (int ignored) { _step(); }); 103 (int ignored) { _step(); });
104 // TODO(jacobr) fix this odd type error. 104 // TODO(jacobr) fix this odd type error.
105 } catch (e) { 105 } catch (e) {
106 _webkitAnimationFrameMaybeAvailable = false; 106 _webkitAnimationFrameMaybeAvailable = false;
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 _frameCount++; 161 _frameCount++;
162 if (_isMobileSafari) { 162 if (_isMobileSafari) {
163 // Hack to work around an iOS bug where sometimes animations do not 163 // Hack to work around an iOS bug where sometimes animations do not
164 // render if only webkit transforms were modified. 164 // render if only webkit transforms were modified.
165 // TODO(jacobr): find a cleaner workaround. 165 // TODO(jacobr): find a cleaner workaround.
166 int offset = _frameCount % 2; 166 int offset = _frameCount % 2;
167 _safariHackStyle.left = '${offset}px'; 167 _safariHackStyle.left = '${offset}px';
168 } 168 }
169 } 169 }
170 } 170 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698