Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(413)

Unified Diff: runtime/observatory/lib/src/elements/sample_buffer_control.dart

Issue 2992893002: Reapply "[vm] Don't enable the profiler by default. Enable the profiler at startup with --observe, … (Closed)
Patch Set: native symbol resolver Created 3 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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);
}
« no previous file with comments | « runtime/observatory/lib/src/elements/native_memory_profiler.dart ('k') | runtime/observatory/lib/src/models/objects/vm.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698