OLD | NEW |
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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 // Patch file for dart:developer library. | 5 // Patch file for dart:developer library. |
6 | 6 |
7 import 'dart:_js_helper' show patch, ForceInline; | 7 import 'dart:_js_helper' show patch, ForceInline; |
8 import 'dart:_foreign_helper' show JS; | 8 import 'dart:_foreign_helper' show JS; |
9 | 9 |
10 @patch | 10 @patch |
11 // @ForceInline() | 11 @ForceInline() |
12 bool debugger({bool when: true, String message}) { | 12 bool debugger({bool when: true, String message}) { |
13 if (when) { | 13 if (when) { |
14 JS('', 'debugger'); | 14 JS('', 'debugger'); |
15 } | 15 } |
16 return when; | 16 return when; |
17 } | 17 } |
18 | 18 |
19 @patch | 19 @patch |
20 Object inspect(Object object) { | 20 Object inspect(Object object) { |
21 return object; | 21 return object; |
(...skipping 17 matching lines...) Expand all Loading... |
39 ServiceExtensionHandler _lookupExtension(String method) { | 39 ServiceExtensionHandler _lookupExtension(String method) { |
40 return _extensions[method]; | 40 return _extensions[method]; |
41 } | 41 } |
42 | 42 |
43 @patch | 43 @patch |
44 _registerExtension(String method, ServiceExtensionHandler handler) { | 44 _registerExtension(String method, ServiceExtensionHandler handler) { |
45 _extensions[method] = handler; | 45 _extensions[method] = handler; |
46 } | 46 } |
47 | 47 |
48 @patch | 48 @patch |
49 _postEvent(String eventKind, String eventData) { | 49 void _postEvent(String eventKind, String eventData) { |
50 // TODO. | 50 // TODO. |
51 } | 51 } |
52 | 52 |
53 | 53 |
54 @patch | 54 @patch |
55 bool _isDartStreamEnabled() { | 55 bool _isDartStreamEnabled() { |
56 return false; | 56 return false; |
57 } | 57 } |
58 | 58 |
59 @patch | 59 @patch |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 int _getServiceMajorVersion() { | 110 int _getServiceMajorVersion() { |
111 return 0; | 111 return 0; |
112 } | 112 } |
113 | 113 |
114 @patch | 114 @patch |
115 int _getServiceMinorVersion() { | 115 int _getServiceMinorVersion() { |
116 return 0; | 116 return 0; |
117 } | 117 } |
118 | 118 |
119 @patch | 119 @patch |
120 void _getServerInfo(SendPort sp) { | 120 void _getServerInfo(SendPort sendPort) { |
121 sp.send(null); | 121 sendPort.send(null); |
122 } | 122 } |
123 | 123 |
124 @patch | 124 @patch |
125 void _webServerControl(SendPort sp, bool enable) { | 125 void _webServerControl(SendPort sendPort, bool enable) { |
126 sp.send(null); | 126 sendPort.send(null); |
127 } | 127 } |
| 128 |
| 129 @patch |
| 130 String _getIsolateIDFromSendPort(SendPort sendPort) { |
| 131 return null; |
| 132 } |
| 133 |
| 134 @patch |
| 135 class UserTag { |
| 136 @patch |
| 137 factory UserTag(String label) = _FakeUserTag; |
| 138 |
| 139 @patch |
| 140 static UserTag get defaultTag => _FakeUserTag._defaultTag; |
| 141 } |
| 142 |
| 143 class _FakeUserTag implements UserTag { |
| 144 static Map _instances = {}; |
| 145 |
| 146 _FakeUserTag.real(this.label); |
| 147 |
| 148 factory _FakeUserTag(String label) { |
| 149 // Canonicalize by name. |
| 150 var existingTag = _instances[label]; |
| 151 if (existingTag != null) { |
| 152 return existingTag; |
| 153 } |
| 154 // Throw an exception if we've reached the maximum number of user tags. |
| 155 if (_instances.length == UserTag.MAX_USER_TAGS) { |
| 156 throw new UnsupportedError( |
| 157 'UserTag instance limit (${UserTag.MAX_USER_TAGS}) reached.'); |
| 158 } |
| 159 // Create a new instance and add it to the instance map. |
| 160 var instance = new _FakeUserTag.real(label); |
| 161 _instances[label] = instance; |
| 162 return instance; |
| 163 } |
| 164 |
| 165 final String label; |
| 166 |
| 167 UserTag makeCurrent() { |
| 168 var old = _currentTag; |
| 169 _currentTag = this; |
| 170 return old; |
| 171 } |
| 172 |
| 173 static final UserTag _defaultTag = new _FakeUserTag('Default'); |
| 174 } |
| 175 |
| 176 var _currentTag = _FakeUserTag._defaultTag; |
| 177 |
| 178 @patch |
| 179 UserTag getCurrentTag() => _currentTag; |
OLD | NEW |