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 _Utils { | 7 class _Utils { |
8 static double dateTimeToDouble(DateTime dateTime) => | 8 static double dateTimeToDouble(DateTime dateTime) => |
9 dateTime.millisecondsSinceEpoch.toDouble(); | 9 dateTime.millisecondsSinceEpoch.toDouble(); |
10 static DateTime doubleToDateTime(double dateTime) { | 10 static DateTime doubleToDateTime(double dateTime) { |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 String operator [](String key) native "DOMStringMap_item_Callback"; | 132 String operator [](String key) native "DOMStringMap_item_Callback"; |
133 void operator []=(String key, String value) native "DOMStringMap_setItem_Callb
ack"; | 133 void operator []=(String key, String value) native "DOMStringMap_setItem_Callb
ack"; |
134 String putIfAbsent(String key, String ifAbsent()) => Maps.putIfAbsent(this, ke
y, ifAbsent); | 134 String putIfAbsent(String key, String ifAbsent()) => Maps.putIfAbsent(this, ke
y, ifAbsent); |
135 String remove(String key) native "DOMStringMap_remove_Callback"; | 135 String remove(String key) native "DOMStringMap_remove_Callback"; |
136 void clear() => Maps.clear(this); | 136 void clear() => Maps.clear(this); |
137 void forEach(void f(String key, String value)) => Maps.forEach(this, f); | 137 void forEach(void f(String key, String value)) => Maps.forEach(this, f); |
138 Iterable<String> get keys native "DOMStringMap_getKeys_Callback"; | 138 Iterable<String> get keys native "DOMStringMap_getKeys_Callback"; |
139 Iterable<String> get values => Maps.getValues(this); | 139 Iterable<String> get values => Maps.getValues(this); |
140 int get length => Maps.length(this); | 140 int get length => Maps.length(this); |
141 bool get isEmpty => Maps.isEmpty(this); | 141 bool get isEmpty => Maps.isEmpty(this); |
| 142 bool get isNotEmpty => Maps.isNotEmpty(this); |
142 } | 143 } |
143 | 144 |
144 final Future<SendPort> __HELPER_ISOLATE_PORT = | 145 final Future<SendPort> __HELPER_ISOLATE_PORT = |
145 spawnDomFunction(_helperIsolateMain); | 146 spawnDomFunction(_helperIsolateMain); |
146 | 147 |
147 // Tricky part. | 148 // Tricky part. |
148 // Once __HELPER_ISOLATE_PORT gets resolved, it will still delay in .then | 149 // Once __HELPER_ISOLATE_PORT gets resolved, it will still delay in .then |
149 // and to delay Timer.run is used. However, Timer.run will try to register | 150 // and to delay Timer.run is used. However, Timer.run will try to register |
150 // another Timer and here we got stuck: event cannot be posted as then | 151 // another Timer and here we got stuck: event cannot be posted as then |
151 // callback is not executed because it's delayed with timer. | 152 // callback is not executed because it's delayed with timer. |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
249 } | 250 } |
250 | 251 |
251 _send(msg) { | 252 _send(msg) { |
252 _sendToHelperIsolate(msg, _sendPort); | 253 _sendToHelperIsolate(msg, _sendPort); |
253 } | 254 } |
254 } | 255 } |
255 | 256 |
256 get _pureIsolateTimerFactoryClosure => | 257 get _pureIsolateTimerFactoryClosure => |
257 ((int milliSeconds, void callback(Timer time), bool repeating) => | 258 ((int milliSeconds, void callback(Timer time), bool repeating) => |
258 new _PureIsolateTimer(milliSeconds, callback, repeating)); | 259 new _PureIsolateTimer(milliSeconds, callback, repeating)); |
OLD | NEW |