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 + ': ' + |