Index: sdk/lib/developer/profiler.dart |
diff --git a/sdk/lib/developer/profiler.dart b/sdk/lib/developer/profiler.dart |
index 566d0158318b3110393e148adea893da1785b170..127a48ef1d1c32eeb2f135ec6e9656d1e677b2b4 100644 |
--- a/sdk/lib/developer/profiler.dart |
+++ b/sdk/lib/developer/profiler.dart |
@@ -9,7 +9,7 @@ abstract class UserTag { |
/// The maximum number of UserTag instances that can be created by a program. |
static const MAX_USER_TAGS = 64; |
- factory UserTag(String label) => new _FakeUserTag(label); |
+ external factory UserTag(String label); |
/// Label of [this]. |
String get label; |
@@ -19,50 +19,11 @@ abstract class UserTag { |
UserTag makeCurrent(); |
/// The default [UserTag] with label 'Default'. |
- static UserTag get defaultTag => _FakeUserTag._defaultTag; |
+ external static UserTag get defaultTag; |
} |
-// This is a fake implementation of UserTag so that code can compile and run |
-// in dart2js. |
-class _FakeUserTag implements UserTag { |
- static Map _instances = {}; |
- |
- _FakeUserTag.real(this.label); |
- |
- factory _FakeUserTag(String label) { |
- // Canonicalize by name. |
- var existingTag = _instances[label]; |
- if (existingTag != null) { |
- return existingTag; |
- } |
- // Throw an exception if we've reached the maximum number of user tags. |
- if (_instances.length == UserTag.MAX_USER_TAGS) { |
- throw new UnsupportedError( |
- 'UserTag instance limit (${UserTag.MAX_USER_TAGS}) reached.'); |
- } |
- // Create a new instance and add it to the instance map. |
- var instance = new _FakeUserTag.real(label); |
- _instances[label] = instance; |
- return instance; |
- } |
- |
- final String label; |
- |
- UserTag makeCurrent() { |
- var old = _currentTag; |
- _currentTag = this; |
- return old; |
- } |
- |
- static final UserTag _defaultTag = new _FakeUserTag('Default'); |
-} |
- |
-var _currentTag = _FakeUserTag._defaultTag; |
- |
/// Returns the current [UserTag] for the isolate. |
-UserTag getCurrentTag() { |
- return _currentTag; |
-} |
+external UserTag getCurrentTag(); |
/// Abstract [Metric] class. Metric names must be unique, are hierarchical, |
/// and use periods as separators. For example, 'a.b.c'. Uniqueness is only |