| 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 class _Utils { | 5 class _Utils { |
| 6 static List convertToList(List list) { | 6 static List convertToList(List list) { |
| 7 // FIXME: [possible optimization]: do not copy the array if Dart_IsArray is
fine w/ it. | 7 // FIXME: [possible optimization]: do not copy the array if Dart_IsArray is
fine w/ it. |
| 8 final length = list.length; | 8 final length = list.length; |
| 9 List result = new List(length); | 9 List result = new List(length); |
| 10 result.setRange(0, length, list); | 10 result.setRange(0, length, list); |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 | 25 |
| 26 static bool isMap(obj) => obj is Map; | 26 static bool isMap(obj) => obj is Map; |
| 27 | 27 |
| 28 static Map createMap() => {}; | 28 static Map createMap() => {}; |
| 29 | 29 |
| 30 static makeNotImplementedException(String fileName, int lineNo) { | 30 static makeNotImplementedException(String fileName, int lineNo) { |
| 31 return new UnsupportedOperationException('[info: $fileName:$lineNo]'); | 31 return new UnsupportedOperationException('[info: $fileName:$lineNo]'); |
| 32 } | 32 } |
| 33 | 33 |
| 34 static window() native "Utils_window"; | 34 static window() native "Utils_window"; |
| 35 static print(String message) native "Utils_print"; |
| 35 static SendPort spawnDomFunctionImpl(Function topLevelFunction) native "Utils_
spawnDomFunction"; | 36 static SendPort spawnDomFunctionImpl(Function topLevelFunction) native "Utils_
spawnDomFunction"; |
| 36 static int _getNewIsolateId() native "Utils_getNewIsolateId"; | 37 static int _getNewIsolateId() native "Utils_getNewIsolateId"; |
| 37 } | 38 } |
| 38 | 39 |
| 39 Utils_print(String message) native "Utils_print"; | |
| 40 | |
| 41 class _NPObject extends NativeFieldWrapperClass1 { | 40 class _NPObject extends NativeFieldWrapperClass1 { |
| 42 _NPObject(); | 41 _NPObject(); |
| 43 static _NPObject retrieve(String key) native "NPObject_retrieve"; | 42 static _NPObject retrieve(String key) native "NPObject_retrieve"; |
| 44 property(String propertyName) native "NPObject_property"; | 43 property(String propertyName) native "NPObject_property"; |
| 45 invoke(String methodName, [ObjectArray args = null]) native "NPObject_invoke"; | 44 invoke(String methodName, [ObjectArray args = null]) native "NPObject_invoke"; |
| 46 } | 45 } |
| 47 | 46 |
| 48 class _DOMWindowCrossFrameImpl extends NativeFieldWrapperClass1 implements Windo
w { | 47 class _DOMWindowCrossFrameImpl extends NativeFieldWrapperClass1 implements Windo
w { |
| 49 _DOMWindowCrossFrameImpl(); | 48 _DOMWindowCrossFrameImpl(); |
| 50 | 49 |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 void operator []=(String key, String value) native "DOMStringMap_setItem_Callb
ack"; | 97 void operator []=(String key, String value) native "DOMStringMap_setItem_Callb
ack"; |
| 99 String putIfAbsent(String key, String ifAbsent()) => Maps.putIfAbsent(this, ke
y, ifAbsent); | 98 String putIfAbsent(String key, String ifAbsent()) => Maps.putIfAbsent(this, ke
y, ifAbsent); |
| 100 String remove(String key) native "DOMStringMap_remove_Callback"; | 99 String remove(String key) native "DOMStringMap_remove_Callback"; |
| 101 void clear() => Maps.clear(this); | 100 void clear() => Maps.clear(this); |
| 102 void forEach(void f(String key, String value)) => Maps.forEach(this, f); | 101 void forEach(void f(String key, String value)) => Maps.forEach(this, f); |
| 103 Collection<String> getKeys() native "DOMStringMap_getKeys_Callback"; | 102 Collection<String> getKeys() native "DOMStringMap_getKeys_Callback"; |
| 104 Collection<String> getValues() => Maps.getValues(this); | 103 Collection<String> getValues() => Maps.getValues(this); |
| 105 int get length() => Maps.length(this); | 104 int get length() => Maps.length(this); |
| 106 bool isEmpty() => Maps.isEmpty(this); | 105 bool isEmpty() => Maps.isEmpty(this); |
| 107 } | 106 } |
| 107 |
| 108 get _printClosure => (s) { |
| 109 try { |
| 110 window.console.log(s); |
| 111 } on Dynamic catch(_) { |
| 112 _Utils.print(s); |
| 113 } |
| 114 }; |
| OLD | NEW |