| OLD | NEW |
| 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 part of html; | 5 part of html; |
| 6 | 6 |
| 7 class _ConsoleVariables { | 7 class _ConsoleVariables { |
| 8 Map<String, Object> _data = new Map<String, Object>(); | 8 Map<String, Object> _data = new Map<String, Object>(); |
| 9 | 9 |
| 10 /** | 10 /** |
| (...skipping 513 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 524 final _forwardingPrintClosure = _Utils.forwardingPrint; | 524 final _forwardingPrintClosure = _Utils.forwardingPrint; |
| 525 | 525 |
| 526 final _uriBaseClosure = () => Uri.parse(window.location.href); | 526 final _uriBaseClosure = () => Uri.parse(window.location.href); |
| 527 | 527 |
| 528 final _pureIsolateUriBaseClosure = () { | 528 final _pureIsolateUriBaseClosure = () { |
| 529 throw new UnimplementedError("Uri.base on a background isolate " | 529 throw new UnimplementedError("Uri.base on a background isolate " |
| 530 "is not supported in the browser"); | 530 "is not supported in the browser"); |
| 531 }; | 531 }; |
| 532 | 532 |
| 533 class _Timer implements Timer { | 533 class _Timer implements Timer { |
| 534 const int _STATE_TIMEOUT = 0; | 534 static const int _STATE_TIMEOUT = 0; |
| 535 const int _STATE_INTERVAL = 1; | 535 static const int _STATE_INTERVAL = 1; |
| 536 var _state; | 536 int _state; |
| 537 | 537 |
| 538 _Timer(int milliSeconds, void callback(Timer timer), bool repeating) { | 538 _Timer(int milliSeconds, void callback(Timer timer), bool repeating) { |
| 539 if (repeating) { | 539 if (repeating) { |
| 540 _state = window._setInterval(() { | 540 _state = (window._setInterval(() { |
| 541 callback(this); | 541 callback(this); |
| 542 }, milliSeconds) * 2 + _STATE_INTERVAL; | 542 }, milliSeconds) << 1) | _STATE_INTERVAL; |
| 543 } else { | 543 } else { |
| 544 _state = window._setTimeout(() { | 544 _state = (window._setTimeout(() { |
| 545 _state = null; | 545 _state = null; |
| 546 callback(this); | 546 callback(this); |
| 547 }, milliSeconds) * 2 + _STATE_TIMEOUT; | 547 }, milliSeconds) << 1) | _STATE_TIMEOUT; |
| 548 } | 548 } |
| 549 } | 549 } |
| 550 | 550 |
| 551 void cancel() { | 551 void cancel() { |
| 552 if (_state == null) return; | 552 if (_state == null) return; |
| 553 int id = _state ~/ 2; | 553 int id = _state >> 1; |
| 554 if ((_state & 1) == _STATE_TIMEOUT) { | 554 if ((_state & 1) == _STATE_TIMEOUT) { |
| 555 window._clearTimeout(id); | 555 window._clearTimeout(id); |
| 556 } else { | 556 } else { |
| 557 window._clearInterval(id); | 557 window._clearInterval(id); |
| 558 } | 558 } |
| 559 _state = null; | 559 _state = null; |
| 560 } | 560 } |
| 561 | 561 |
| 562 bool get isActive => _state != null; | 562 bool get isActive => _state != null; |
| 563 } | 563 } |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 612 _scheduleImmediateHelper._schedule(callback); | 612 _scheduleImmediateHelper._schedule(callback); |
| 613 }; | 613 }; |
| 614 | 614 |
| 615 get _pureIsolateScheduleImmediateClosure => ((void callback()) => | 615 get _pureIsolateScheduleImmediateClosure => ((void callback()) => |
| 616 throw new UnimplementedError("scheduleMicrotask in background isolates " | 616 throw new UnimplementedError("scheduleMicrotask in background isolates " |
| 617 "are not supported in the browser")); | 617 "are not supported in the browser")); |
| 618 | 618 |
| 619 void _initializeCustomElement(Element e) { | 619 void _initializeCustomElement(Element e) { |
| 620 _Utils.initializeCustomElement(e); | 620 _Utils.initializeCustomElement(e); |
| 621 } | 621 } |
| OLD | NEW |