Index: sdk/lib/profiler/profiler.dart |
diff --git a/sdk/lib/profiler/profiler.dart b/sdk/lib/profiler/profiler.dart |
index 56614ddec0c5cc7fb4db5bee186b9b692463b43d..ff07673335f8d06431aebd896a35af585f6d5cd9 100644 |
--- a/sdk/lib/profiler/profiler.dart |
+++ b/sdk/lib/profiler/profiler.dart |
@@ -14,8 +14,12 @@ abstract class UserTag { |
/// Label of [this]. |
String get label; |
- /// Make [this] the current tag for the isolate. |
- makeCurrent(); |
+ /// Make [this] the current tag for the isolate. Returns the current tag |
+ /// before setting. |
+ UserTag makeCurrent(); |
+ |
+ /// The default [UserTag] with label 'Default'. |
+ static UserTag get defaultTag => _FakeUserTag._defaultTag; |
} |
// This is a fake implementation of UserTag so that code can compile and run |
@@ -45,22 +49,18 @@ class _FakeUserTag implements UserTag { |
final String label; |
- makeCurrent() { |
+ UserTag makeCurrent() { |
+ var old = _currentTag; |
_currentTag = this; |
+ return _currentTag; |
Ivan Posva
2014/05/06 16:43:06
Shouldn't you be returning old here?
Cutch
2014/05/06 17:00:25
Done.
|
} |
+ |
+ static final UserTag _defaultTag = new _FakeUserTag('Default'); |
} |
-var _currentTag = null; |
+var _currentTag = _FakeUserTag._defaultTag; |
/// Returns the current [UserTag] for the isolate. |
UserTag getCurrentTag() { |
return _currentTag; |
} |
- |
-/// Sets the current [UserTag] for the isolate to null. Returns current tag |
-/// before clearing. |
-UserTag clearCurrentTag() { |
- var old = _currentTag; |
- _currentTag = null; |
- return old; |
-} |