Commit 9d86ac5e authored by Florian Loitsch's avatar Florian Loitsch

Merge pull request #664 from floitschG/scheduler.renames

Rename some of the functions from the scheduler.
parents c13fe8eb 72821152
......@@ -40,7 +40,7 @@ class Ticker {
_startTime = null;
if (_animationId != null) {
scheduler.cancelAnimationFrame(_animationId);
scheduler.cancelFrameCallbackWithId(_animationId);
_animationId = null;
}
......@@ -74,6 +74,6 @@ class Ticker {
void _scheduleTick() {
assert(isTicking);
assert(_animationId == null);
_animationId = scheduler.requestAnimationFrame(_tick);
_animationId = scheduler.scheduleFrameCallback(_tick);
}
}
......@@ -55,7 +55,7 @@ class HeroController extends NavigatorObserver {
void _checkForHeroQuest() {
if (_from != null && _to != null && _from != _to) {
_to.offstage = _to.performance.status != PerformanceStatus.completed;
scheduler.requestPostFrameCallback(_updateQuest);
scheduler.addPostFrameCallback(_updateQuest);
}
}
......
......@@ -361,7 +361,7 @@ class SpriteBox extends RenderBox {
// Updates
void _scheduleTick() {
scheduler.requestAnimationFrame(_tick);
scheduler.scheduleFrameCallback(_tick);
}
void _tick(Duration timeStamp) {
......
......@@ -34,7 +34,8 @@ class WidgetTester {
void pump([ Duration duration ]) {
if (duration != null)
async.elapse(duration);
scheduler.beginFrame(new Duration(milliseconds: clock.now().millisecondsSinceEpoch));
scheduler.handleBeginFrame(new Duration(
milliseconds: clock.now().millisecondsSinceEpoch));
async.flushMicrotasks();
}
......
......@@ -17,7 +17,7 @@ void main() {
expect(secondCallbackRan, isFalse);
expect(timeStamp.inMilliseconds, equals(16));
firstCallbackRan = true;
scheduler.cancelAnimationFrame(secondId);
scheduler.cancelFrameCallbackWithId(secondId);
}
void secondCallback(Duration timeStamp) {
......@@ -27,10 +27,10 @@ void main() {
secondCallbackRan = true;
}
scheduler.requestAnimationFrame(firstCallback);
secondId = scheduler.requestAnimationFrame(secondCallback);
scheduler.scheduleFrameCallback(firstCallback);
secondId = scheduler.scheduleFrameCallback(secondCallback);
scheduler.beginFrame(const Duration(milliseconds: 16));
scheduler.handleBeginFrame(const Duration(milliseconds: 16));
expect(firstCallbackRan, isTrue);
expect(secondCallbackRan, isFalse);
......@@ -38,7 +38,7 @@ void main() {
firstCallbackRan = false;
secondCallbackRan = false;
scheduler.beginFrame(const Duration(milliseconds: 32));
scheduler.handleBeginFrame(const Duration(milliseconds: 32));
expect(firstCallbackRan, isFalse);
expect(secondCallbackRan, isFalse);
......
......@@ -28,17 +28,17 @@ void main() {
scheduleAddingTask(x);
}
strategy.allowedPriority = 100;
for (int i = 0; i < 3; i++) scheduler.tick();
for (int i = 0; i < 3; i++) scheduler.handleEventLoopCallback();
expect(executedTasks.isEmpty, isTrue);
strategy.allowedPriority = 50;
for (int i = 0; i < 3; i++) scheduler.tick();
for (int i = 0; i < 3; i++) scheduler.handleEventLoopCallback();
expect(executedTasks.length, equals(1));
expect(executedTasks.single, equals(80));
executedTasks.clear();
strategy.allowedPriority = 20;
for (int i = 0; i < 3; i++) scheduler.tick();
for (int i = 0; i < 3; i++) scheduler.handleEventLoopCallback();
expect(executedTasks.length, equals(2));
expect(executedTasks[0], equals(23));
expect(executedTasks[1], equals(23));
......@@ -48,21 +48,21 @@ void main() {
scheduleAddingTask(19);
scheduleAddingTask(5);
scheduleAddingTask(97);
for (int i = 0; i < 3; i++) scheduler.tick();
for (int i = 0; i < 3; i++) scheduler.handleEventLoopCallback();
expect(executedTasks.length, equals(2));
expect(executedTasks[0], equals(99));
expect(executedTasks[1], equals(97));
executedTasks.clear();
strategy.allowedPriority = 10;
for (int i = 0; i < 3; i++) scheduler.tick();
for (int i = 0; i < 3; i++) scheduler.handleEventLoopCallback();
expect(executedTasks.length, equals(2));
expect(executedTasks[0], equals(19));
expect(executedTasks[1], equals(11));
executedTasks.clear();
strategy.allowedPriority = 1;
for (int i = 0; i < 4; i++) scheduler.tick();
for (int i = 0; i < 4; i++) scheduler.handleEventLoopCallback();
expect(executedTasks.length, equals(3));
expect(executedTasks[0], equals(5));
expect(executedTasks[1], equals(3));
......@@ -70,7 +70,7 @@ void main() {
executedTasks.clear();
strategy.allowedPriority = 0;
scheduler.tick();
scheduler.handleEventLoopCallback();
expect(executedTasks.length, equals(1));
expect(executedTasks[0], equals(0));
});
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment