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

Unified Diff: tracing/tracing/ui/tracks/sched_group_track.html

Issue 2450073002: Include scheduling-only threads in tracks (Closed)
Patch Set: Include scheduling-only threads in tracks Created 4 years, 2 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: tracing/tracing/ui/tracks/sched_group_track.html
diff --git a/tracing/tracing/ui/tracks/sched_group_track.html b/tracing/tracing/ui/tracks/sched_group_track.html
new file mode 100644
index 0000000000000000000000000000000000000000..9643c83da4710b5e380368d048ccb37770257436
--- /dev/null
+++ b/tracing/tracing/ui/tracks/sched_group_track.html
@@ -0,0 +1,100 @@
+<!DOCTYPE html>
+<!--
+Copyright 2016 The Chromium Authors. All rights reserved.
+Use of this source code is governed by a BSD-style license that can be
+found in the LICENSE file.
+-->
+
+<link rel="import" href="/tracing/base/sorted_array_utils.html">
charliea (OOO until 10-5) 2016/10/26 21:23:37 I don't think we use sorted_array_utils in here, r
John Reck 2016/10/26 21:55:47 Done.
+<link rel="import" href="/tracing/ui/base/ui.html">
+<link rel="import" href="/tracing/ui/tracks/container_track.html">
+<link rel="import" href="/tracing/ui/tracks/spacing_track.html">
+<link rel="import" href="/tracing/ui/tracks/thread_track.html">
+
+<script>
+'use strict';
+
+tr.exportTo('tr.ui.tracks', function() {
+ /**
+ * A track that displays threads with only scheduling information but no
+ * slices. By default it's collapsed to minimize initial visual difference
+ * while allowing the user to drill-down into whatever process is
+ * interesting to them.
+ * @constructor
+ * @extends {ContainerTrack}
+ */
+ var SchedGroupTrack = tr.ui.b.define(
+ 'sched-group-track', tr.ui.tracks.SchedGroupTrack);
+
+ var SpacingTrack = tr.ui.tracks.SpacingTrack;
+
+ SchedGroupTrack.prototype = {
+
+ __proto__: tr.ui.tracks.ContainerTrack.prototype,
charliea (OOO until 10-5) 2016/10/26 21:23:37 I think that this should actually use MultiRowTrac
John Reck 2016/10/26 21:55:47 I originally tried MultiRowTrack but couldn't figu
+
+ decorate: function(viewport) {
+ tr.ui.tracks.ContainerTrack.prototype.decorate.call(this, viewport);
+
+ this.header_ = document.createElement('tr-ui-heading');
+ this.header_.addEventListener('click', this.onHeaderClick_.bind(this));
+ this.header_.heading = 'Other Threads';
+ this.header_.tooltip = 'Threads with only scheduling information';
+ this.header_.arrowVisible = true;
+ Polymer.dom(this).appendChild(this.header_);
+
+ this.threads_ = [];
+ this.expanded = false;
+ },
+
+ set threads(threads) {
+ this.threads_ = threads;
+ this.updateContents_();
+ },
+
+ onHeaderClick_: function(e) {
+ e.stopPropagation();
+ e.preventDefault();
+ this.expanded = !this.expanded;
+ },
+
+ get expanded() {
+ return this.header_.expanded;
+ },
+
+ set expanded(expanded) {
+ expanded = !!expanded;
+
+ if (this.expanded === expanded)
+ return;
+
+ this.header_.expanded = expanded;
+
+ // Expanding and collapsing tracks is, essentially, growing and shrinking
+ // the viewport. We dispatch a change event to trigger any processing
+ // to happen.
+ this.viewport_.dispatchChangeEvent();
+
+ this.updateContents_();
+ },
+
+ updateContents_: function() {
+ this.clearTracks_();
+ if (this.expanded) {
+ this.threads_.forEach(function(thread) {
charliea (OOO until 10-5) 2016/10/26 21:23:37 We're moving towards using for...of loops, so we s
John Reck 2016/10/26 21:55:47 Done.
+ var track = new tr.ui.tracks.ThreadTrack(this.viewport);
+ track.thread = thread;
+ if (!track.hasVisibleContent)
+ return;
+ Polymer.dom(this).appendChild(track);
+ Polymer.dom(this).appendChild(new SpacingTrack(this.viewport));
+ }.bind(this));
+ }
+ },
+
+ };
+
+ return {
+ SchedGroupTrack: SchedGroupTrack
+ };
+});
+</script>

Powered by Google App Engine
This is Rietveld 408576698