OLD | NEW |
---|---|
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <!-- | 2 <!-- |
3 Copyright (c) 2013 The Chromium Authors. All rights reserved. | 3 Copyright (c) 2013 The Chromium Authors. All rights reserved. |
4 Use of this source code is governed by a BSD-style license that can be | 4 Use of this source code is governed by a BSD-style license that can be |
5 found in the LICENSE file. | 5 found in the LICENSE file. |
6 --> | 6 --> |
7 | 7 |
8 <link rel="import" href="/tracing/base/settings.html"> | 8 <link rel="import" href="/tracing/base/settings.html"> |
9 <link rel="import" href="/tracing/base/utils.html"> | 9 <link rel="import" href="/tracing/base/utils.html"> |
10 <link rel="import" href="/tracing/core/scripting_controller.html"> | 10 <link rel="import" href="/tracing/core/scripting_controller.html"> |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
137 <script> | 137 <script> |
138 'use strict'; | 138 'use strict'; |
139 | 139 |
140 Polymer({ | 140 Polymer({ |
141 is: 'tr-ui-timeline-view', | 141 is: 'tr-ui-timeline-view', |
142 | 142 |
143 attached: function() { | 143 attached: function() { |
144 this.async(function() { | 144 this.async(function() { |
145 this.trackViewContainer_ = Polymer.dom(this).querySelector( | 145 this.trackViewContainer_ = Polymer.dom(this).querySelector( |
146 '#track_view_container'); | 146 '#track_view_container'); |
147 if (!this.trackViewContainer_) | 147 if (!this.trackViewContainer_) { |
148 console.error('missing trackviewContainer'); | 148 console.error('missing trackviewContainer'); |
149 } | |
150 if (this.model_) { | |
151 this.updateContents_(); | |
152 } | |
149 }); | 153 }); |
150 }, | 154 }, |
151 | 155 |
152 ready: function() { | 156 ready: function() { |
153 this.tabIndex = 0; // Let the timeline able to receive key events. | 157 this.tabIndex = 0; // Let the timeline able to receive key events. |
154 | 158 |
155 this.titleEl_ = this.$.title; | 159 this.titleEl_ = this.$.title; |
156 this.leftControlsEl_ = this.$.left_controls; | 160 this.leftControlsEl_ = this.$.left_controls; |
157 this.rightControlsEl_ = this.$.right_controls; | 161 this.rightControlsEl_ = this.$.right_controls; |
158 this.collapsingControlsEl_ = this.$.collapsing_controls; | 162 this.collapsingControlsEl_ = this.$.collapsing_controls; |
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
357 if (text === undefined) { | 361 if (text === undefined) { |
358 Polymer.dom(this.titleEl_).textContent = ''; | 362 Polymer.dom(this.titleEl_).textContent = ''; |
359 this.titleEl_.hidden = true; | 363 this.titleEl_.hidden = true; |
360 return; | 364 return; |
361 } | 365 } |
362 this.titleEl_.hidden = false; | 366 this.titleEl_.hidden = false; |
363 Polymer.dom(this.titleEl_).textContent = text; | 367 Polymer.dom(this.titleEl_).textContent = text; |
364 }, | 368 }, |
365 | 369 |
366 get model() { | 370 get model() { |
367 if (this.trackView_) | 371 return this.model_; |
368 return this.trackView_.model; | 372 }, |
373 | |
374 set model(model) { | |
375 this.model_ = model; | |
376 if (this.isAttached) this.updateContents_(); | |
377 }, | |
378 | |
379 trackViewModel_: function() { | |
380 if (this.trackView_) return this.trackView_.model; | |
369 return undefined; | 381 return undefined; |
370 }, | 382 }, |
371 | 383 |
372 set model(model) { | 384 updateContents_: function() { |
373 var modelInstanceChanged = model !== this.model; | 385 var modelInstanceChanged = this.model !== this.trackViewModel_(); |
benjhayden
2017/02/22 19:59:31
I think it might be confusing to have both |get mo
| |
374 var modelValid = model && !model.bounds.isEmpty; | 386 var modelValid = this.model && !this.model.bounds.isEmpty; |
375 | 387 |
376 var importWarningsEl = Polymer.dom(this.root).querySelector( | 388 var importWarningsEl = Polymer.dom(this.root).querySelector( |
377 '#import-warnings'); | 389 '#import-warnings'); |
378 Polymer.dom(importWarningsEl).textContent = ''; | 390 Polymer.dom(importWarningsEl).textContent = ''; |
379 | 391 |
380 // Remove old trackView if the model has completely changed. | 392 // Remove old trackView if the model has completely changed. |
381 if (modelInstanceChanged) { | 393 if (modelInstanceChanged) { |
382 if (this.railScoreSpan_) | 394 if (this.railScoreSpan_) |
383 this.railScoreSpan_.model = undefined; | 395 this.railScoreSpan_.model = undefined; |
384 Polymer.dom(this.trackViewContainer_).textContent = ''; | 396 Polymer.dom(this.trackViewContainer_).textContent = ''; |
(...skipping 14 matching lines...) Expand all Loading... | |
399 | 411 |
400 this.trackView.brushingStateController = this.brushingStateController_; | 412 this.trackView.brushingStateController = this.brushingStateController_; |
401 | 413 |
402 Polymer.dom(this.trackViewContainer_).appendChild(this.trackView_); | 414 Polymer.dom(this.trackViewContainer_).appendChild(this.trackView_); |
403 this.trackView_.viewport.addEventListener( | 415 this.trackView_.viewport.addEventListener( |
404 'change', this.onViewportChanged_); | 416 'change', this.onViewportChanged_); |
405 } | 417 } |
406 | 418 |
407 // Set the model. | 419 // Set the model. |
408 if (modelValid) { | 420 if (modelValid) { |
409 this.trackView_.model = model; | 421 this.trackView_.model = this.model; |
410 this.trackView_.viewport.showFlowEvents = this.showFlowEvents; | 422 this.trackView_.viewport.showFlowEvents = this.showFlowEvents; |
411 this.trackView_.viewport.highlightVSync = this.highlightVSync; | 423 this.trackView_.viewport.highlightVSync = this.highlightVSync; |
412 if (this.railScoreSpan_) | 424 if (this.railScoreSpan_) { |
413 this.railScoreSpan_.model = model; | 425 this.railScoreSpan_.model = this.model; |
414 | 426 } |
415 this.$.display_unit.preferredTimeDisplayMode = model.intrinsicTimeUnit; | 427 this.$.display_unit.preferredTimeDisplayMode = |
428 this.model.intrinsicTimeUnit; | |
416 } | 429 } |
417 | 430 |
418 if (model) { | 431 if (this.model) { |
419 model.importWarningsThatShouldBeShownToUser.forEach( | 432 this.model.importWarningsThatShouldBeShownToUser.forEach( |
420 function(importWarning) { | 433 function(importWarning) { |
421 importWarningsEl.addMessage( | 434 importWarningsEl.addMessage( |
422 'Import Warning: ' + importWarning.type + ': ' + | 435 'Import Warning: ' + importWarning.type + ': ' + |
423 importWarning.message); | 436 importWarning.message); |
424 }, this); | 437 }, this); |
425 } | 438 } |
426 | 439 |
427 // Do things that are selection specific | 440 // Do things that are selection specific |
428 if (modelInstanceChanged) { | 441 if (modelInstanceChanged) { |
429 this.updateMetadataButtonVisibility_(); | 442 this.updateMetadataButtonVisibility_(); |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
532 toggleHighlightVSync_: function() { | 545 toggleHighlightVSync_: function() { |
533 this.highlightVSyncCheckbox_.checked = | 546 this.highlightVSyncCheckbox_.checked = |
534 !this.highlightVSyncCheckbox_.checked; | 547 !this.highlightVSyncCheckbox_.checked; |
535 }, | 548 }, |
536 | 549 |
537 setFindCtlText: function(string) { | 550 setFindCtlText: function(string) { |
538 this.findCtl_.setText(string); | 551 this.findCtl_.setText(string); |
539 } | 552 } |
540 }); | 553 }); |
541 </script> | 554 </script> |
OLD | NEW |