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

Unified Diff: tracing/tracing/ui/timeline_view.html

Issue 2671813006: [tracing] Defer setting model until timeline-view is attached (Closed)
Patch Set: remove trackViewModel_ Created 3 years, 10 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tracing/tracing/ui/timeline_view.html
diff --git a/tracing/tracing/ui/timeline_view.html b/tracing/tracing/ui/timeline_view.html
index 88a9419e73161ab00f4ae7e7dc76b5bbfcb50388..6b28c10e89ba48f33ec5497994025610ed7ca423 100644
--- a/tracing/tracing/ui/timeline_view.html
+++ b/tracing/tracing/ui/timeline_view.html
@@ -144,8 +144,12 @@ Polymer({
this.async(function() {
this.trackViewContainer_ = Polymer.dom(this).querySelector(
'#track_view_container');
- if (!this.trackViewContainer_)
+ if (!this.trackViewContainer_) {
console.error('missing trackviewContainer');
+ }
+ if (this.model_) {
+ this.updateContents_();
+ }
});
},
@@ -364,14 +368,18 @@ Polymer({
},
get model() {
- if (this.trackView_)
- return this.trackView_.model;
- return undefined;
+ return this.model_;
},
set model(model) {
- var modelInstanceChanged = model !== this.model;
- var modelValid = model && !model.bounds.isEmpty;
+ this.model_ = model;
+ if (this.isAttached) this.updateContents_();
+ },
+
+ updateContents_: function() {
+ var modelInstanceChanged = (this.trackViewModel_ === undefined) ||
+ (this.model !== this.trackViewModel_.model);
+ var modelValid = this.model && !this.model.bounds.isEmpty;
var importWarningsEl = Polymer.dom(this.root).querySelector(
'#import-warnings');
@@ -406,17 +414,18 @@ Polymer({
// Set the model.
if (modelValid) {
- this.trackView_.model = model;
+ this.trackView_.model = this.model;
this.trackView_.viewport.showFlowEvents = this.showFlowEvents;
this.trackView_.viewport.highlightVSync = this.highlightVSync;
- if (this.railScoreSpan_)
- this.railScoreSpan_.model = model;
-
- this.$.display_unit.preferredTimeDisplayMode = model.intrinsicTimeUnit;
+ if (this.railScoreSpan_) {
+ this.railScoreSpan_.model = this.model;
+ }
+ this.$.display_unit.preferredTimeDisplayMode =
+ this.model.intrinsicTimeUnit;
}
- if (model) {
- model.importWarningsThatShouldBeShownToUser.forEach(
+ if (this.model) {
+ this.model.importWarningsThatShouldBeShownToUser.forEach(
function(importWarning) {
importWarningsEl.addMessage(
'Import Warning: ' + importWarning.type + ': ' +
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698