| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 library fn; | 5 library fn; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 import 'dart:collection'; | 8 import 'dart:collection'; |
| 9 import 'dart:sky' as sky; | 9 import 'dart:sky' as sky; |
| 10 import 'reflect.dart' as reflect; | 10 import 'reflect.dart' as reflect; |
| 11 | 11 |
| 12 bool _initIsInCheckedMode() { | 12 bool _initIsInCheckedMode() { |
| 13 String testFn(i) { double d = i; return d.toString(); } | 13 String testFn(i) { double d = i; return d.toString(); } |
| 14 try { | 14 try { |
| 15 testFn('not a double'); | 15 testFn('not a double'); |
| 16 } catch (ex) { | 16 } catch (ex) { |
| 17 return true; | 17 return true; |
| 18 } | 18 } |
| 19 return false; | 19 return false; |
| 20 } | 20 } |
| 21 | 21 |
| 22 final bool _isInCheckedMode = _initIsInCheckedMode(); | 22 final bool _isInCheckedMode = _initIsInCheckedMode(); |
| 23 final bool _shouldLogRenderDuration = true; | 23 final bool _shouldLogRenderDuration = false; |
| 24 | 24 |
| 25 class Style { | 25 class Style { |
| 26 final String _className; | 26 final String _className; |
| 27 static final Map<String, Style> _cache = new HashMap<String, Style>(); | 27 static final Map<String, Style> _cache = new HashMap<String, Style>(); |
| 28 | 28 |
| 29 static int _nextStyleId = 1; | 29 static int _nextStyleId = 1; |
| 30 | 30 |
| 31 static String _getNextClassName() { return "style${_nextStyleId++}"; } | 31 static String _getNextClassName() { return "style${_nextStyleId++}"; } |
| 32 | 32 |
| 33 Style extend(Style other) { | 33 Style extend(Style other) { |
| (...skipping 728 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 762 | 762 |
| 763 _sync(null, _host, null); | 763 _sync(null, _host, null); |
| 764 assert(_root is sky.Node); | 764 assert(_root is sky.Node); |
| 765 | 765 |
| 766 sw.stop(); | 766 sw.stop(); |
| 767 if (_shouldLogRenderDuration) | 767 if (_shouldLogRenderDuration) |
| 768 print("Initial build: ${sw.elapsedMicroseconds} microseconds"); | 768 print("Initial build: ${sw.elapsedMicroseconds} microseconds"); |
| 769 }); | 769 }); |
| 770 } | 770 } |
| 771 } | 771 } |
| OLD | NEW |