Index: runtime/observatory/lib/src/elements/sample_buffer_control.dart |
diff --git a/runtime/observatory/lib/src/elements/sample_buffer_control.dart b/runtime/observatory/lib/src/elements/sample_buffer_control.dart |
index 3661c7cfd82c28929a51f9f747e43c28f4239cf7..a82734e24f7d647e506ba513c2688d5b585ee244 100644 |
--- a/runtime/observatory/lib/src/elements/sample_buffer_control.dart |
+++ b/runtime/observatory/lib/src/elements/sample_buffer_control.dart |
@@ -29,6 +29,7 @@ class SampleBufferControlElement extends HtmlElement implements Renderable { |
Stream<SampleBufferControlChangedElement> get onTagChange => |
_onTagChange.stream; |
+ M.VM _vm; |
Stream<M.SampleProfileLoadingProgressEvent> _progressStream; |
M.SampleProfileLoadingProgress _progress; |
M.SampleProfileTag _tag; |
@@ -46,17 +47,21 @@ class SampleBufferControlElement extends HtmlElement implements Renderable { |
set showTag(bool value) => _showTag = _r.checkAndReact(_showTag, value); |
set profileVM(bool value) => _profileVM = _r.checkAndReact(_profileVM, value); |
- factory SampleBufferControlElement(M.SampleProfileLoadingProgress progress, |
+ factory SampleBufferControlElement( |
+ M.VM vm, |
+ M.SampleProfileLoadingProgress progress, |
Stream<M.SampleProfileLoadingProgressEvent> progressStream, |
{M.SampleProfileTag selectedTag: M.SampleProfileTag.none, |
bool showTag: true, |
RenderingQueue queue}) { |
+ assert(vm != null); |
assert(progress != null); |
assert(progressStream != null); |
assert(selectedTag != null); |
assert(showTag != null); |
SampleBufferControlElement e = document.createElement(tag.name); |
e._r = new RenderingScheduler(e, queue: queue); |
+ e._vm = vm; |
e._progress = progress; |
e._progressStream = progressStream; |
e._tag = selectedTag; |
@@ -129,7 +134,7 @@ class SampleBufferControlElement extends HtmlElement implements Renderable { |
]; |
} |
- static List<Element> _createDisabledMessage() { |
+ List<Element> _createDisabledMessage() { |
return [ |
new DivElement() |
..classes = ['statusBox' 'shadow' 'center'] |
@@ -142,8 +147,11 @@ class SampleBufferControlElement extends HtmlElement implements Renderable { |
..innerHtml = 'Perhaps the <b>profile</b> ' |
'flag has been disabled for this VM.', |
new BRElement(), |
- new SpanElement()..text = 'See all ', |
- new AnchorElement(href: Uris.flags())..text = 'vm flags' |
+ new ButtonElement() |
+ ..text = 'Enable profiler' |
+ ..onClick.listen((_) { |
+ _enableProfiler(); |
+ }) |
] |
] |
]; |
@@ -253,5 +261,11 @@ class SampleBufferControlElement extends HtmlElement implements Renderable { |
return new SampleBufferControlChangedElement(this); |
} |
+ void _enableProfiler() { |
+ _vm.enableProfiler().then((_) { |
+ _triggerModeChange(_toEvent(null)); |
+ }); |
+ } |
+ |
void _triggerModeChange(e) => _onTagChange.add(e); |
} |