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 23 matching lines...) Expand all Loading... |
34 static window() native "Utils_window"; | 34 static window() native "Utils_window"; |
35 static print(String message) native "Utils_print"; | 35 static print(String message) native "Utils_print"; |
36 static SendPort spawnDomFunctionImpl(Function topLevelFunction) native "Utils_
spawnDomFunction"; | 36 static SendPort spawnDomFunctionImpl(Function topLevelFunction) native "Utils_
spawnDomFunction"; |
37 static int _getNewIsolateId() native "Utils_getNewIsolateId"; | 37 static int _getNewIsolateId() native "Utils_getNewIsolateId"; |
38 } | 38 } |
39 | 39 |
40 class _NPObject extends NativeFieldWrapperClass1 { | 40 class _NPObject extends NativeFieldWrapperClass1 { |
41 _NPObject(); | 41 _NPObject(); |
42 static _NPObject retrieve(String key) native "NPObject_retrieve"; | 42 static _NPObject retrieve(String key) native "NPObject_retrieve"; |
43 property(String propertyName) native "NPObject_property"; | 43 property(String propertyName) native "NPObject_property"; |
44 invoke(String methodName, [ObjectArray args = null]) native "NPObject_invoke"; | 44 invoke(String methodName, [List args = null]) native "NPObject_invoke"; |
45 } | 45 } |
46 | 46 |
47 class _DOMWindowCrossFrameImpl extends NativeFieldWrapperClass1 implements Windo
w { | 47 class _DOMWindowCrossFrameImpl extends NativeFieldWrapperClass1 implements Windo
w { |
48 _DOMWindowCrossFrameImpl(); | 48 _DOMWindowCrossFrameImpl(); |
49 | 49 |
50 // Fields. | 50 // Fields. |
51 History get history() native "DOMWindow_history_cross_frame_Getter"; | 51 History get history() native "DOMWindow_history_cross_frame_Getter"; |
52 Location get location() native "DOMWindow_location_cross_frame_Getter"; | 52 Location get location() native "DOMWindow_location_cross_frame_Getter"; |
53 bool get closed() native "DOMWindow_closed_Getter"; | 53 bool get closed() native "DOMWindow_closed_Getter"; |
54 int get length() native "DOMWindow_length_Getter"; | 54 int get length() native "DOMWindow_length_Getter"; |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 bool isEmpty() => Maps.isEmpty(this); | 105 bool isEmpty() => Maps.isEmpty(this); |
106 } | 106 } |
107 | 107 |
108 get _printClosure => (s) { | 108 get _printClosure => (s) { |
109 try { | 109 try { |
110 window.console.log(s); | 110 window.console.log(s); |
111 } on Dynamic catch(_) { | 111 } on Dynamic catch(_) { |
112 _Utils.print(s); | 112 _Utils.print(s); |
113 } | 113 } |
114 }; | 114 }; |
OLD | NEW |