1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 'use strict'; 6 7 base.requireStylesheet('cc.raster_task_slice_view'); 8 base.require('cc.tile'); 9 base.require('cc.tile_view'); 10 base.require('cc.layer_tree_host_impl_view'); 11 base.require('tracing.analysis.slice_view'); 12 base.require('ui.info_bar'); 13 14 base.exportTo('cc', function() { 15 16 /** 17 * @constructor 18 */ 19 var RasterTaskSliceView = ui.define( 20 'raster-task-slice-view', tracing.analysis.SliceView); 21 22 RasterTaskSliceView.prototype = { 23 __proto__: tracing.analysis.SliceView.prototype, 24 25 decorate: function() { 26 this.classList.add('raster-task-slice-view'); 27 this.layerTreeView_ = new cc.LayerTreeHostImplSnapshotView(); 28 this.infoBar_ = new ui.InfoBar(); 29 this.appendChild(this.infoBar_); 30 this.appendChild(this.layerTreeView_); 31 }, 32 33 updateContents: function() { 34 this.infoBar_.visible = false; 35 36 if (!this.slice.args.data) { 37 this.infoBar_.visible = true; 38 this.infoBar_.message = 'No data on this raster task.'; 39 this.layerTreeView_.style.display = 'none'; 40 return; 41 } 42 var tile = this.slice.args.data.tile_id; 43 if (!tile) { 44 this.infoBar_.visible = true; 45 this.infoBar_.message = 'No tile on this raster task.'; 46 this.layerTreeView_.style.display = 'none'; 47 return; 48 } 49 if (!(tile instanceof cc.TileSnapshot)) { 50 this.infoBar_.visible = true; 51 this.infoBar_.message = 'This raster task didn\'t get fully traced.'; 52 this.layerTreeView_.style.display = 'none'; 53 return; 54 } 55 this.layerTreeView_.style.display = ''; 56 57 var containingSnapshot = tile.containingSnapshot; 58 this.layerTreeView_.objectSnapshot = containingSnapshot; 59 this.layerTreeView_.selection = new cc.RasterTaskSelection(this.slice); 60 } 61 }; 62 63 tracing.analysis.SliceView.register( 64 'TileManager::RunRasterTask', RasterTaskSliceView); 65 tracing.analysis.SliceView.register( 66 'RasterWorkerPoolTaskImpl::RunRasterOnThread', RasterTaskSliceView); 67 68 tracing.analysis.SliceView.register( 69 'TileManager::RunAnalyzeTask', RasterTaskSliceView); 70 tracing.analysis.SliceView.register( 71 'RasterWorkerPoolTaskImpl::RunAnalysisOnThread', RasterTaskSliceView); 72 73 return { 74 RasterTaskSliceView: RasterTaskSliceView 75 }; 76 77 }); 78