| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2014 The Chromium Authors. All rights reserved. | 2 * Copyright 2014 The Chromium Authors. All rights reserved. |
| 3 * Use of this source code is governed by a BSD-style license that can be | 3 * Use of this source code is governed by a BSD-style license that can be |
| 4 * found in the LICENSE file. | 4 * found in the LICENSE file. |
| 5 */ | 5 */ |
| 6 | 6 |
| 7 /** | 7 /** |
| 8 * @constructor | 8 * @constructor |
| 9 * @implements {WebInspector.TimelineModeView} | 9 * @implements {WebInspector.TimelineModeView} |
| 10 * @implements {WebInspector.FlameChartDelegate} | 10 * @implements {WebInspector.FlameChartDelegate} |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 contentHelper.appendTextRow(WebInspector.UIString("Duration"), Number.mi
llisToString(record.duration, true)); | 117 contentHelper.appendTextRow(WebInspector.UIString("Duration"), Number.mi
llisToString(record.duration, true)); |
| 118 if (!Object.isEmpty(record.args)) | 118 if (!Object.isEmpty(record.args)) |
| 119 contentHelper.appendElementRow(WebInspector.UIString("Arguments"), t
his._formatArguments(record.args)); | 119 contentHelper.appendElementRow(WebInspector.UIString("Arguments"), t
his._formatArguments(record.args)); |
| 120 /** | 120 /** |
| 121 * @this {WebInspector.TimelineTracingView} | 121 * @this {WebInspector.TimelineTracingView} |
| 122 */ | 122 */ |
| 123 function reveal() | 123 function reveal() |
| 124 { | 124 { |
| 125 WebInspector.Revealer.reveal(new WebInspector.DeferredTracingLayerTr
ee(this._tracingModel.target(), record.args["snapshot"]["active_tree"]["root_lay
er"])); | 125 WebInspector.Revealer.reveal(new WebInspector.DeferredTracingLayerTr
ee(this._tracingModel.target(), record.args["snapshot"]["active_tree"]["root_lay
er"])); |
| 126 } | 126 } |
| 127 if (record.name === "cc::LayerTreeHostImpl") { | 127 /** |
| 128 * @param {!Node=} node |
| 129 * @this {WebInspector.TimelineTracingView} |
| 130 */ |
| 131 function appendPreviewAndshowDetails(node) |
| 132 { |
| 133 if (node) |
| 134 contentHelper.appendElementRow("Preview", node); |
| 135 this._delegate.showInDetails(WebInspector.UIString("Selected Event")
, contentHelper.element); |
| 136 } |
| 137 var recordTypes = WebInspector.TracingTimelineModel.RecordType; |
| 138 switch (record.name) { |
| 139 case recordTypes.PictureSnapshot: |
| 140 WebInspector.TracingTimelineUIUtils._buildPicturePreviewContent(reco
rd.args["snapshot"]["skp64"], appendPreviewAndshowDetails.bind(this)); |
| 141 break; |
| 142 case recordTypes.LayerTreeHostImplSnapshot: |
| 128 var link = document.createElement("span"); | 143 var link = document.createElement("span"); |
| 129 link.classList.add("revealable-link"); | 144 link.classList.add("revealable-link"); |
| 130 link.textContent = "show"; | 145 link.textContent = "show"; |
| 131 link.addEventListener("click", reveal.bind(this), false); | 146 link.addEventListener("click", reveal.bind(this), false); |
| 132 contentHelper.appendElementRow(WebInspector.UIString("Layer tree"),
link); | 147 contentHelper.appendElementRow(WebInspector.UIString("Layer tree"),
link); |
| 133 } else if (record.name === "cc::Picture") { | 148 // Fall-through intended. |
| 134 var div = document.createElement("div"); | 149 default: |
| 135 div.className = "image-preview-container"; | 150 this._delegate.showInDetails(WebInspector.UIString("Selected Event")
, contentHelper.element); |
| 136 var img = div.createChild("img"); | |
| 137 contentHelper.appendElementRow("Preview", div); | |
| 138 this._requestThumbnail(img, record.args["snapshot"]["skp64"]); | |
| 139 } | 151 } |
| 140 this._delegate.showInDetails(WebInspector.UIString("Selected Event"), co
ntentHelper.element); | |
| 141 }, | 152 }, |
| 142 | 153 |
| 143 /** | 154 /** |
| 144 * @param {!Object} args | 155 * @param {!Object} args |
| 145 * @return {!Element} | 156 * @return {!Element} |
| 146 */ | 157 */ |
| 147 _formatArguments: function(args) | 158 _formatArguments: function(args) |
| 148 { | 159 { |
| 149 var table = document.createElement("table"); | 160 var table = document.createElement("table"); |
| 150 for (var name in args) { | 161 for (var name in args) { |
| 151 var row = table.createChild("tr"); | 162 var row = table.createChild("tr"); |
| 152 row.createChild("td", "timeline-details-row-title").textContent = na
me + ":"; | 163 row.createChild("td", "timeline-details-row-title").textContent = na
me + ":"; |
| 153 var valueContainer = row.createChild("td", "timeline-details-row-dat
a"); | 164 var valueContainer = row.createChild("td", "timeline-details-row-dat
a"); |
| 154 var value = args[name]; | 165 var value = args[name]; |
| 155 if (typeof value === "object" && value) { | 166 if (typeof value === "object" && value) { |
| 156 var localObject = new WebInspector.LocalJSONObject(value); | 167 var localObject = new WebInspector.LocalJSONObject(value); |
| 157 var propertiesSection = new WebInspector.ObjectPropertiesSection
(localObject, localObject.description); | 168 var propertiesSection = new WebInspector.ObjectPropertiesSection
(localObject, localObject.description); |
| 158 valueContainer.appendChild(propertiesSection.element); | 169 valueContainer.appendChild(propertiesSection.element); |
| 159 } else { | 170 } else { |
| 160 valueContainer.textContent = String(value); | 171 valueContainer.textContent = String(value); |
| 161 } | 172 } |
| 162 } | 173 } |
| 163 return table; | 174 return table; |
| 164 }, | 175 }, |
| 165 | 176 |
| 166 /** | |
| 167 * @param {!Element} img | |
| 168 * @param {string} encodedPicture | |
| 169 */ | |
| 170 _requestThumbnail: function(img, encodedPicture) | |
| 171 { | |
| 172 var snapshotId; | |
| 173 LayerTreeAgent.loadSnapshot(encodedPicture, onSnapshotLoaded); | |
| 174 /** | |
| 175 * @param {string} error | |
| 176 * @param {string} id | |
| 177 */ | |
| 178 function onSnapshotLoaded(error, id) | |
| 179 { | |
| 180 if (error) { | |
| 181 console.error("LayerTreeAgent.loadSnapshot(): " + error); | |
| 182 return; | |
| 183 } | |
| 184 snapshotId = id; | |
| 185 LayerTreeAgent.replaySnapshot(snapshotId, onSnapshotReplayed); | |
| 186 } | |
| 187 | |
| 188 /** | |
| 189 * @param {string} error | |
| 190 * @param {string} encodedBitmap | |
| 191 */ | |
| 192 function onSnapshotReplayed(error, encodedBitmap) | |
| 193 { | |
| 194 LayerTreeAgent.releaseSnapshot(snapshotId); | |
| 195 if (error) { | |
| 196 console.error("LayerTreeAgent.replaySnapshot(): " + error); | |
| 197 return; | |
| 198 } | |
| 199 img.src = encodedBitmap; | |
| 200 } | |
| 201 }, | |
| 202 | |
| 203 __proto__: WebInspector.VBox.prototype | 177 __proto__: WebInspector.VBox.prototype |
| 204 }; | 178 }; |
| 205 | 179 |
| 206 /** | 180 /** |
| 207 * @constructor | 181 * @constructor |
| 208 * @implements {WebInspector.FlameChartDataProvider} | 182 * @implements {WebInspector.FlameChartDataProvider} |
| 209 * @param {!WebInspector.TracingModel} model | 183 * @param {!WebInspector.TracingModel} model |
| 210 * @param {!WebInspector.TimelineModel} timelineModelForMinimumBoundary | 184 * @param {!WebInspector.TimelineModel} timelineModelForMinimumBoundary |
| 211 */ | 185 */ |
| 212 WebInspector.TraceViewFlameChartDataProvider = function(model, timelineModelForM
inimumBoundary) | 186 WebInspector.TraceViewFlameChartDataProvider = function(model, timelineModelForM
inimumBoundary) |
| (...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 573 /** | 547 /** |
| 574 * @param {string} string | 548 * @param {string} string |
| 575 * @return {string} | 549 * @return {string} |
| 576 */ | 550 */ |
| 577 colorForString: function(string) | 551 colorForString: function(string) |
| 578 { | 552 { |
| 579 var hash = WebInspector.TraceViewPalette._stringHash(string); | 553 var hash = WebInspector.TraceViewPalette._stringHash(string); |
| 580 return this._palette[hash % this._palette.length]; | 554 return this._palette[hash % this._palette.length]; |
| 581 } | 555 } |
| 582 }; | 556 }; |
| OLD | NEW |