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

Side by Side Diff: sky/sdk/lib/base/scheduler.dart

Issue 1235153005: Add a timeDilation factor for debugging (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 5 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
« no previous file with comments | « sky/sdk/lib/base/debug.dart ('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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 import 'dart:sky' as sky; 5 import 'dart:sky' as sky;
6 6
7 import 'package:sky/base/debug.dart';
8
7 typedef void Callback(double timeStamp); 9 typedef void Callback(double timeStamp);
8 10
9 bool _haveScheduledVisualUpdate = false; 11 bool _haveScheduledVisualUpdate = false;
10 int _nextCallbackId = 1; 12 int _nextCallbackId = 1;
11 13
12 final List<Callback> _persistentCallbacks = new List<Callback>(); 14 final List<Callback> _persistentCallbacks = new List<Callback>();
13 Map<int, Callback> _transientCallbacks = new Map<int, Callback>(); 15 Map<int, Callback> _transientCallbacks = new Map<int, Callback>();
14 16
15 void _beginFrame(double timeStamp) { 17 void _beginFrame(double timeStamp) {
18 timeStamp /= timeDilation;
19
16 _haveScheduledVisualUpdate = false; 20 _haveScheduledVisualUpdate = false;
17 21
18 Map<int, Callback> callbacks = _transientCallbacks; 22 Map<int, Callback> callbacks = _transientCallbacks;
19 _transientCallbacks = new Map<int, Callback>(); 23 _transientCallbacks = new Map<int, Callback>();
20 24
21 callbacks.forEach((id, callback) { 25 callbacks.forEach((id, callback) {
22 callback(timeStamp); 26 callback(timeStamp);
23 }); 27 });
24 28
25 for (Callback callback in _persistentCallbacks) 29 for (Callback callback in _persistentCallbacks)
(...skipping 18 matching lines...) Expand all
44 void cancelAnimationFrame(int id) { 48 void cancelAnimationFrame(int id) {
45 _transientCallbacks.remove(id); 49 _transientCallbacks.remove(id);
46 } 50 }
47 51
48 void ensureVisualUpdate() { 52 void ensureVisualUpdate() {
49 if (_haveScheduledVisualUpdate) 53 if (_haveScheduledVisualUpdate)
50 return; 54 return;
51 sky.view.scheduleFrame(); 55 sky.view.scheduleFrame();
52 _haveScheduledVisualUpdate = true; 56 _haveScheduledVisualUpdate = true;
53 } 57 }
OLDNEW
« no previous file with comments | « sky/sdk/lib/base/debug.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698