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

Side by Side Diff: runtime/lib/timer_patch.dart

Issue 2759973004: Fix observatory tests broken by running dartfmt. Temporarily reverted formatting for evaluate_activ… (Closed)
Patch Set: Created 3 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
« no previous file with comments | « runtime/lib/timer_impl.dart ('k') | runtime/lib/type_patch.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 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 import 'dart:_internal' hide Symbol; 5 import 'dart:_internal' hide Symbol;
6 6
7 @patch class Timer { 7 @patch
8 @patch static Timer _createTimer(Duration duration, void callback()) { 8 class Timer {
9 @patch
10 static Timer _createTimer(Duration duration, void callback()) {
9 // TODO(iposva): Remove _TimerFactory and use VMLibraryHooks exclusively. 11 // TODO(iposva): Remove _TimerFactory and use VMLibraryHooks exclusively.
10 if (_TimerFactory._factory == null) { 12 if (_TimerFactory._factory == null) {
11 _TimerFactory._factory = VMLibraryHooks.timerFactory; 13 _TimerFactory._factory = VMLibraryHooks.timerFactory;
12 } 14 }
13 if (_TimerFactory._factory == null) { 15 if (_TimerFactory._factory == null) {
14 throw new UnsupportedError("Timer interface not supported."); 16 throw new UnsupportedError("Timer interface not supported.");
15 } 17 }
16 int milliseconds = duration.inMilliseconds; 18 int milliseconds = duration.inMilliseconds;
17 if (milliseconds < 0) milliseconds = 0; 19 if (milliseconds < 0) milliseconds = 0;
18 return _TimerFactory._factory(milliseconds, (_) { callback(); }, false); 20 return _TimerFactory._factory(milliseconds, (_) {
21 callback();
22 }, false);
19 } 23 }
20 24
21 @patch static Timer _createPeriodicTimer(Duration duration, 25 @patch
22 void callback(Timer timer)) { 26 static Timer _createPeriodicTimer(
27 Duration duration, void callback(Timer timer)) {
23 // TODO(iposva): Remove _TimerFactory and use VMLibraryHooks exclusively. 28 // TODO(iposva): Remove _TimerFactory and use VMLibraryHooks exclusively.
24 if (_TimerFactory._factory == null) { 29 if (_TimerFactory._factory == null) {
25 _TimerFactory._factory = VMLibraryHooks.timerFactory; 30 _TimerFactory._factory = VMLibraryHooks.timerFactory;
26 } 31 }
27 if (_TimerFactory._factory == null) { 32 if (_TimerFactory._factory == null) {
28 throw new UnsupportedError("Timer interface not supported."); 33 throw new UnsupportedError("Timer interface not supported.");
29 } 34 }
30 int milliseconds = duration.inMilliseconds; 35 int milliseconds = duration.inMilliseconds;
31 if (milliseconds < 0) milliseconds = 0; 36 if (milliseconds < 0) milliseconds = 0;
32 return _TimerFactory._factory(milliseconds, callback, true); 37 return _TimerFactory._factory(milliseconds, callback, true);
33 } 38 }
34 } 39 }
35 40
36 typedef Timer _TimerFactoryClosure(int milliseconds, 41 typedef Timer _TimerFactoryClosure(
37 void callback(Timer timer), 42 int milliseconds, void callback(Timer timer), bool repeating);
38 bool repeating);
39 43
40 // Warning: Dartium sets _TimerFactory._factory instead of setting things up 44 // Warning: Dartium sets _TimerFactory._factory instead of setting things up
41 // through VMLibraryHooks.timerFactory. 45 // through VMLibraryHooks.timerFactory.
42 class _TimerFactory { 46 class _TimerFactory {
43 static _TimerFactoryClosure _factory; 47 static _TimerFactoryClosure _factory;
44 } 48 }
OLDNEW
« no previous file with comments | « runtime/lib/timer_impl.dart ('k') | runtime/lib/type_patch.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698