Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(35)

Side by Side Diff: Source/devtools/front_end/profiler/CanvasProfileView.js

Issue 662793002: [DevTools] Replace usages of document with custom functions. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 466 matching lines...) Expand 10 before | Expand all | Expand 10 after
477 } 477 }
478 }, 478 },
479 479
480 /** 480 /**
481 * @param {number} index 481 * @param {number} index
482 * @param {!CanvasAgent.Call} call 482 * @param {!CanvasAgent.Call} call
483 * @return {!WebInspector.DataGridNode} 483 * @return {!WebInspector.DataGridNode}
484 */ 484 */
485 _createCallNode: function(index, call) 485 _createCallNode: function(index, call)
486 { 486 {
487 var callViewElement = document.createElement("div"); 487 var callViewElement = createElement("div");
488 488
489 var data = {}; 489 var data = {};
490 data[0] = index + 1; 490 data[0] = index + 1;
491 data[1] = callViewElement; 491 data[1] = callViewElement;
492 data[2] = ""; 492 data[2] = "";
493 if (call.sourceURL) { 493 if (call.sourceURL) {
494 // FIXME(62725): stack trace line/column numbers are one-based. 494 // FIXME(62725): stack trace line/column numbers are one-based.
495 var lineNumber = Math.max(0, call.lineNumber - 1) || 0; 495 var lineNumber = Math.max(0, call.lineNumber - 1) || 0;
496 var columnNumber = Math.max(0, call.columnNumber - 1) || 0; 496 var columnNumber = Math.max(0, call.columnNumber - 1) || 0;
497 data[2] = this._linkifier.linkifyScriptLocation(this.profile.target( ), null, call.sourceURL, lineNumber, columnNumber); 497 data[2] = this._linkifier.linkifyScriptLocation(this.profile.target( ), null, call.sourceURL, lineNumber, columnNumber);
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
646 646
647 this._frameSelector = new WebInspector.StatusBarComboBox(this._dispatchViewU pdatedEvent.bind(this)); 647 this._frameSelector = new WebInspector.StatusBarComboBox(this._dispatchViewU pdatedEvent.bind(this));
648 this._frameSelector.element.title = WebInspector.UIString("Frame containing the canvases to capture."); 648 this._frameSelector.element.title = WebInspector.UIString("Frame containing the canvases to capture.");
649 this._frameSelector.element.classList.add("hidden"); 649 this._frameSelector.element.classList.add("hidden");
650 650
651 this._target = null; 651 this._target = null;
652 WebInspector.targetManager.observeTargets(this); 652 WebInspector.targetManager.observeTargets(this);
653 653
654 this._canvasAgentEnabled = false; 654 this._canvasAgentEnabled = false;
655 655
656 this._decorationElement = document.createElement("div"); 656 this._decorationElement = createElement("div");
657 this._decorationElement.className = "profile-canvas-decoration"; 657 this._decorationElement.className = "profile-canvas-decoration";
658 this._updateDecorationElement(); 658 this._updateDecorationElement();
659 } 659 }
660 660
661 WebInspector.CanvasProfileType.TypeId = "CANVAS_PROFILE"; 661 WebInspector.CanvasProfileType.TypeId = "CANVAS_PROFILE";
662 662
663 WebInspector.CanvasProfileType.prototype = { 663 WebInspector.CanvasProfileType.prototype = {
664 /** 664 /**
665 * @override 665 * @override
666 * @param {!WebInspector.Target} target 666 * @param {!WebInspector.Target} target
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after
883 var frame = /** @type {!WebInspector.ResourceTreeFrame} */ (event.data); 883 var frame = /** @type {!WebInspector.ResourceTreeFrame} */ (event.data);
884 this._addFrame(frame); 884 this._addFrame(frame);
885 }, 885 },
886 886
887 /** 887 /**
888 * @param {!WebInspector.ResourceTreeFrame} frame 888 * @param {!WebInspector.ResourceTreeFrame} frame
889 */ 889 */
890 _addFrame: function(frame) 890 _addFrame: function(frame)
891 { 891 {
892 var frameId = frame.id; 892 var frameId = frame.id;
893 var option = document.createElement("option"); 893 var option = createElement("option");
894 option.text = frame.displayName(); 894 option.text = frame.displayName();
895 option.title = frame.url; 895 option.title = frame.url;
896 option.value = frameId; 896 option.value = frameId;
897 897
898 this._frameOptions[frameId] = option; 898 this._frameOptions[frameId] = option;
899 899
900 if (this._framesWithCanvases[frameId]) { 900 if (this._framesWithCanvases[frameId]) {
901 this._frameSelector.addOption(option); 901 this._frameSelector.addOption(option);
902 this._dispatchViewUpdatedEvent(); 902 this._dispatchViewUpdatedEvent();
903 } 903 }
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after
1141 1141
1142 WebInspector.CanvasProfileDataGridHelper = { 1142 WebInspector.CanvasProfileDataGridHelper = {
1143 /** 1143 /**
1144 * @param {!CanvasAgent.CallArgument} callArgument 1144 * @param {!CanvasAgent.CallArgument} callArgument
1145 * @return {!Element} 1145 * @return {!Element}
1146 */ 1146 */
1147 createCallArgumentElement: function(callArgument) 1147 createCallArgumentElement: function(callArgument)
1148 { 1148 {
1149 if (callArgument.enumName) 1149 if (callArgument.enumName)
1150 return WebInspector.CanvasProfileDataGridHelper.createEnumValueEleme nt(callArgument.enumName, +callArgument.description); 1150 return WebInspector.CanvasProfileDataGridHelper.createEnumValueEleme nt(callArgument.enumName, +callArgument.description);
1151 var element = document.createElement("span"); 1151 var element = createElement("span");
1152 element.className = "canvas-call-argument"; 1152 element.className = "canvas-call-argument";
1153 var description = callArgument.description; 1153 var description = callArgument.description;
1154 if (callArgument.type === "string") { 1154 if (callArgument.type === "string") {
1155 const maxStringLength = 150; 1155 const maxStringLength = 150;
1156 element.createTextChild("\""); 1156 element.createTextChild("\"");
1157 element.createChild("span", "canvas-formatted-string").textContent = description.trimMiddle(maxStringLength); 1157 element.createChild("span", "canvas-formatted-string").textContent = description.trimMiddle(maxStringLength);
1158 element.createTextChild("\""); 1158 element.createTextChild("\"");
1159 element.__suppressPopover = (description.length <= maxStringLength & & !/[\r\n]/.test(description)); 1159 element.__suppressPopover = (description.length <= maxStringLength & & !/[\r\n]/.test(description));
1160 if (!element.__suppressPopover) 1160 if (!element.__suppressPopover)
1161 element.__evalResult = WebInspector.runtimeModel.createRemoteObj ectFromPrimitiveValue(description); 1161 element.__evalResult = WebInspector.runtimeModel.createRemoteObj ectFromPrimitiveValue(description);
(...skipping 15 matching lines...) Expand all
1177 return element; 1177 return element;
1178 }, 1178 },
1179 1179
1180 /** 1180 /**
1181 * @param {string} enumName 1181 * @param {string} enumName
1182 * @param {number} enumValue 1182 * @param {number} enumValue
1183 * @return {!Element} 1183 * @return {!Element}
1184 */ 1184 */
1185 createEnumValueElement: function(enumName, enumValue) 1185 createEnumValueElement: function(enumName, enumValue)
1186 { 1186 {
1187 var element = document.createElement("span"); 1187 var element = createElement("span");
1188 element.className = "canvas-call-argument canvas-formatted-number"; 1188 element.className = "canvas-call-argument canvas-formatted-number";
1189 element.textContent = enumName; 1189 element.textContent = enumName;
1190 element.__evalResult = WebInspector.runtimeModel.createRemoteObjectFromP rimitiveValue(enumValue); 1190 element.__evalResult = WebInspector.runtimeModel.createRemoteObjectFromP rimitiveValue(enumValue);
1191 return element; 1191 return element;
1192 } 1192 }
1193 } 1193 }
1194 1194
1195 /** 1195 /**
1196 * @extends {WebInspector.Object} 1196 * @extends {WebInspector.Object}
1197 * @constructor 1197 * @constructor
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
1310 }, 1310 },
1311 1311
1312 clearResourceStates: function() 1312 clearResourceStates: function()
1313 { 1313 {
1314 this._currentResourceStates = {}; 1314 this._currentResourceStates = {};
1315 this.dispatchEventToListeners(WebInspector.CanvasTraceLogPlayerProxy.Eve nts.CanvasReplayStateChanged); 1315 this.dispatchEventToListeners(WebInspector.CanvasTraceLogPlayerProxy.Eve nts.CanvasReplayStateChanged);
1316 }, 1316 },
1317 1317
1318 __proto__: WebInspector.Object.prototype 1318 __proto__: WebInspector.Object.prototype
1319 } 1319 }
OLDNEW
« no previous file with comments | « Source/devtools/front_end/profiler/CPUProfileView.js ('k') | Source/devtools/front_end/profiler/CanvasReplayStateView.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698