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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 if (map['alpha'] == true) result |= 0x01; | 63 if (map['alpha'] == true) result |= 0x01; |
64 if (map['depth'] == true) result |= 0x02; | 64 if (map['depth'] == true) result |= 0x02; |
65 if (map['stencil'] == true) result |= 0x4; | 65 if (map['stencil'] == true) result |= 0x4; |
66 if (map['antialias'] == true) result |= 0x08; | 66 if (map['antialias'] == true) result |= 0x08; |
67 if (map['premultipliedAlpha'] == true) result |= 0x10; | 67 if (map['premultipliedAlpha'] == true) result |= 0x10; |
68 if (map['preserveDrawingBuffer'] == true) result |= 0x20; | 68 if (map['preserveDrawingBuffer'] == true) result |= 0x20; |
69 | 69 |
70 return result; | 70 return result; |
71 } | 71 } |
72 | 72 |
73 static List parseStackTrace(StackTrace stackTrace) { | |
74 final regExp = new RegExp(r'#\d\s+(.*) \((.*):(\d+):(\d+)\)'); | |
75 List result = []; | |
76 for (var match in regExp.allMatches(stackTrace.toString())) { | |
77 result.add([match.group(1), match.group(2), int.parse(match.group(3)), int
.parse(match.group(4))]); | |
78 } | |
79 return result; | |
80 } | |
81 | |
82 static List captureParsedStackTrace() { | |
83 try { | |
84 // Throwing an exception is the only way to generate a stack trace. | |
85 throw new Exception(); | |
86 } catch (e, stackTrace) { | |
87 return parseStackTrace(stackTrace); | |
88 } | |
89 } | |
90 | |
91 static void populateMap(Map result, List list) { | 73 static void populateMap(Map result, List list) { |
92 for (int i = 0; i < list.length; i += 2) { | 74 for (int i = 0; i < list.length; i += 2) { |
93 result[list[i]] = list[i + 1]; | 75 result[list[i]] = list[i + 1]; |
94 } | 76 } |
95 } | 77 } |
96 | 78 |
97 static bool isMap(obj) => obj is Map; | 79 static bool isMap(obj) => obj is Map; |
98 | 80 |
99 static List toListIfIterable(obj) => obj is Iterable ? obj.toList() : null; | 81 static List toListIfIterable(obj) => obj is Iterable ? obj.toList() : null; |
100 | 82 |
(...skipping 519 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
620 _scheduleImmediateHelper._schedule(callback); | 602 _scheduleImmediateHelper._schedule(callback); |
621 }; | 603 }; |
622 | 604 |
623 get _pureIsolateScheduleImmediateClosure => ((void callback()) => | 605 get _pureIsolateScheduleImmediateClosure => ((void callback()) => |
624 throw new UnimplementedError("scheduleMicrotask in background isolates " | 606 throw new UnimplementedError("scheduleMicrotask in background isolates " |
625 "are not supported in the browser")); | 607 "are not supported in the browser")); |
626 | 608 |
627 void _initializeCustomElement(Element e) { | 609 void _initializeCustomElement(Element e) { |
628 _Utils.initializeCustomElement(e); | 610 _Utils.initializeCustomElement(e); |
629 } | 611 } |
OLD | NEW |