| <!DOCTYPE html> |
| <!-- |
| Copyright (c) 2013 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="/core/analysis/analysis_sub_view.html"> |
| <link rel="import" href="/core/analysis/multi_event_sub_view.html"> |
| <link rel="import" href="/core/analysis/flow_classifier.html"> |
| <link rel="import" href="/core/analysis/related_flows.html"> |
| |
| <polymer-element name="tv-c-a-multi-thread-slice-sub-view" |
| extends="tracing-analysis-sub-view"> |
| <template> |
| <style> |
| :host { |
| display: flex; |
| } |
| #content { |
| display: flex; |
| flex: 1 1 auto; |
| } |
| #content > tv-c-a-related-flows { |
| margin-left: 8px; |
| } |
| </style> |
| <div id="content"></div> |
| </template> |
| |
| <script> |
| 'use strict'; |
| |
| Polymer({ |
| created: function() { |
| this.selection_ = undefined; |
| }, |
| |
| get selection() { |
| return this.selection_; |
| }, |
| |
| set selection(selection) { |
| this.selection_ = selection; |
| |
| // TODO(nduca): This is a gross hack for cc Frame Viewer, but its only |
| // the frame viewer that needs this feature, so ~shrug~. |
| if (window.RasterTaskView !== undefined) { // May not have been imported. |
| if (tv.e.cc.RasterTaskSelection.supports(selection)) { |
| var ltvSelection = new tv.e.cc.RasterTaskSelection(selection); |
| |
| var ltv = new tv.e.cc.LayerTreeHostImplSnapshotView(); |
| ltv.objectSnapshot = ltvSelection.containingSnapshot; |
| ltv.selection = ltvSelection; |
| ltv.extraHighlightsByLayerId = ltvSelection.extraHighlightsByLayerId; |
| |
| this.$.content.textContent = ''; |
| this.$.content.appendChild(ltv); |
| |
| this.requiresTallView_ = true; |
| return; |
| } |
| } |
| |
| this.$.content.textContent = ''; |
| |
| var mesv = document.createElement('tv-c-a-multi-event-sub-view'); |
| mesv.selection = selection; |
| this.$.content.appendChild(mesv); |
| |
| var fc = new tv.c.analysis.FlowClassifier(); |
| selection.forEach(function(slice) { |
| slice.inFlowEvents.forEach(function(flow) { |
| fc.addInFlow(flow); |
| }); |
| slice.outFlowEvents.forEach(function(flow) { |
| fc.addOutFlow(flow); |
| }); |
| }); |
| if (fc.hasEvents) { |
| var rflows = document.createElement('tv-c-a-related-flows'); |
| rflows.setFlows( |
| fc.inFlowEvents, fc.outFlowEvents, fc.internalFlowEvents); |
| this.$.content.appendChild(rflows); |
| } |
| }, |
| |
| get requiresTallView() { |
| if (this.$.content.children.length === 0) |
| return false; |
| var childTagName = this.$.content.children[0].tagName; |
| if (childTagName === 'TV-C-A-MULTI-EVENT-SUB-VIEW') |
| return false; |
| |
| // Using raster task view. |
| return true; |
| } |
| }); |
| </script> |
| </polymer-element> |