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

Side by Side Diff: Source/WebCore/inspector/front-end/DetailedHeapshotGridNodes.js

Issue 7218041: Merge 89666 - 2011-06-23 Mikhail Naganov <mnaganov@chromium.org> (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/782/
Patch Set: Created 9 years, 5 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
« no previous file with comments | « no previous file | Source/WebCore/inspector/front-end/DetailedHeapshotView.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2011 Google Inc. All rights reserved. 2 * Copyright (C) 2011 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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 47
48 dispose: function() 48 dispose: function()
49 { 49 {
50 if (this._provider) 50 if (this._provider)
51 this._provider.dispose(); 51 this._provider.dispose();
52 for (var node = this.children[0]; node; node = node.traverseNextNode(tru e, this, true)) 52 for (var node = this.children[0]; node; node = node.traverseNextNode(tru e, this, true))
53 if (node.dispose) 53 if (node.dispose)
54 node.dispose(); 54 node.dispose();
55 }, 55 },
56 56
57 hasHoverMessage: false,
58
59 hoverMessage: function(callback)
60 {
61 callback("");
62 },
63
57 _populate: function(event) 64 _populate: function(event)
58 { 65 {
59 this.removeEventListener("populate", this._populate, this); 66 this.removeEventListener("populate", this._populate, this);
60 function sorted(ignored) 67 function sorted(ignored)
61 { 68 {
62 this.populateChildren(); 69 this.populateChildren();
63 } 70 }
64 WebInspector.PleaseWaitMessage.prototype.show(this.dataGrid.element); 71 WebInspector.PleaseWaitMessage.prototype.show(this.dataGrid.element);
65 this._provider.sortAndRewind(this.comparator(), sorted.bind(this)); 72 this._provider.sortAndRewind(this.comparator(), sorted.bind(this));
66 }, 73 },
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 172
166 WebInspector.HeapSnapshotGenericObjectNode = function(tree, node) 173 WebInspector.HeapSnapshotGenericObjectNode = function(tree, node)
167 { 174 {
168 WebInspector.HeapSnapshotGridNode.call(this, tree, false); 175 WebInspector.HeapSnapshotGridNode.call(this, tree, false);
169 this._name = node.name; 176 this._name = node.name;
170 this._type = node.type; 177 this._type = node.type;
171 this._shallowSize = node.selfSize; 178 this._shallowSize = node.selfSize;
172 this._retainedSize = node.retainedSize; 179 this._retainedSize = node.retainedSize;
173 this.snapshotNodeId = node.id; 180 this.snapshotNodeId = node.id;
174 this.snapshotNodeIndex = node.nodeIndex; 181 this.snapshotNodeIndex = node.nodeIndex;
182 if (this._type === "string")
183 this.hasHoverMessage = true;
184 else if (this._type === "object" && this.isDOMWindow(this._name)) {
185 var url = [];
186 this._name = this.shortenWindowURL(this._name, false, url);
187 this._url = url[0];
188 this.hasHoverMessage = true;
189 }
175 }; 190 };
176 191
177 WebInspector.HeapSnapshotGenericObjectNode.prototype = { 192 WebInspector.HeapSnapshotGenericObjectNode.prototype = {
178 createCell: function(columnIdentifier) 193 createCell: function(columnIdentifier)
179 { 194 {
180 var cell = columnIdentifier !== "object" ? WebInspector.DataGridNode.pro totype.createCell.call(this, columnIdentifier) : this._createObjectCell(); 195 var cell = columnIdentifier !== "object" ? WebInspector.DataGridNode.pro totype.createCell.call(this, columnIdentifier) : this._createObjectCell();
181 if (this._searchMatched) 196 if (this._searchMatched)
182 cell.addStyleClass("highlight"); 197 cell.addStyleClass("highlight");
183 return cell; 198 return cell;
184 }, 199 },
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
240 }; 255 };
241 data["object"] = { valueStyle: valueStyle, value: value + " @" + this.sn apshotNodeId }; 256 data["object"] = { valueStyle: valueStyle, value: value + " @" + this.sn apshotNodeId };
242 257
243 var view = this.dataGrid.snapshotView; 258 var view = this.dataGrid.snapshotView;
244 data["shallowSize"] = view.showShallowSizeAsPercent ? WebInspector.UIStr ing("%.2f%%", this._shallowSizePercent) : Number.bytesToString(this._shallowSize ); 259 data["shallowSize"] = view.showShallowSizeAsPercent ? WebInspector.UIStr ing("%.2f%%", this._shallowSizePercent) : Number.bytesToString(this._shallowSize );
245 data["retainedSize"] = view.showRetainedSizeAsPercent ? WebInspector.UIS tring("%.2f%%", this._retainedSizePercent) : Number.bytesToString(this._retained Size); 260 data["retainedSize"] = view.showRetainedSizeAsPercent ? WebInspector.UIS tring("%.2f%%", this._retainedSizePercent) : Number.bytesToString(this._retained Size);
246 261
247 return this._enhanceData ? this._enhanceData(data) : data; 262 return this._enhanceData ? this._enhanceData(data) : data;
248 }, 263 },
249 264
265 hoverMessage: function(callback)
266 {
267 if (this._type === "string")
268 callback("\"" + this._name + "\"", "console-formatted-string");
269 else if (this._url)
270 callback(this._url, "console-formatted-object");
271 },
272
250 get _retainedSizePercent() 273 get _retainedSizePercent()
251 { 274 {
252 return this._retainedSize / this.dataGrid.snapshot.totalSize * 100.0; 275 return this._retainedSize / this.dataGrid.snapshot.totalSize * 100.0;
253 }, 276 },
254 277
255 get _shallowSizePercent() 278 get _shallowSizePercent()
256 { 279 {
257 return this._shallowSize / this.dataGrid.snapshot.totalSize * 100.0; 280 return this._shallowSize / this.dataGrid.snapshot.totalSize * 100.0;
258 }, 281 },
259 282
260 _updateHasChildren: function() 283 _updateHasChildren: function()
261 { 284 {
262 function isEmptyCallback(isEmpty) 285 function isEmptyCallback(isEmpty)
263 { 286 {
264 this.hasChildren = !isEmpty; 287 this.hasChildren = !isEmpty;
265 } 288 }
266 this._provider.isEmpty(isEmptyCallback.bind(this)); 289 this._provider.isEmpty(isEmptyCallback.bind(this));
290 },
291
292 isDOMWindow: function(fullName)
293 {
294 return fullName.substr(0, 9) === "DOMWindow";
295 },
296
297 shortenWindowURL: function(fullName, hasObjectId, fullURLPtr)
298 {
299 var startPos = fullName.indexOf("/");
300 var endPos = hasObjectId ? fullName.indexOf("@") : fullName.length;
301 if (startPos !== -1 && endPos !== -1) {
302 var fullURL = fullName.substring(startPos + 1, endPos).trimLeft();
303 if (fullURLPtr)
304 fullURLPtr[0] = fullURL;
305 var url = fullURL.trimURL();
306 if (url.length > 40)
307 url = url.trimMiddle(40);
308 return fullName.substr(0, startPos + 2) + url + fullName.substr(endP os);
309 } else
310 return fullName;
267 } 311 }
268 } 312 }
269 313
270 WebInspector.HeapSnapshotGenericObjectNode.prototype.__proto__ = WebInspector.He apSnapshotGridNode.prototype; 314 WebInspector.HeapSnapshotGenericObjectNode.prototype.__proto__ = WebInspector.He apSnapshotGridNode.prototype;
271 315
272 WebInspector.HeapSnapshotObjectNode = function(tree, isFromBaseSnapshot, edge) 316 WebInspector.HeapSnapshotObjectNode = function(tree, isFromBaseSnapshot, edge)
273 { 317 {
274 WebInspector.HeapSnapshotGenericObjectNode.call(this, tree, edge.node); 318 WebInspector.HeapSnapshotGenericObjectNode.call(this, tree, edge.node);
275 this._referenceName = edge.name; 319 this._referenceName = edge.name;
276 this._referenceType = edge.type; 320 this._referenceType = edge.type;
(...skipping 460 matching lines...) Expand 10 before | Expand all | Expand 10 after
737 targetPrototype._childHashForEntity = sourcePrototype._childHashForEntity; 781 targetPrototype._childHashForEntity = sourcePrototype._childHashForEntity;
738 targetPrototype._childHashForNode = sourcePrototype._childHashForNode; 782 targetPrototype._childHashForNode = sourcePrototype._childHashForNode;
739 targetPrototype.comparator = sourcePrototype.comparator; 783 targetPrototype.comparator = sourcePrototype.comparator;
740 targetPrototype._createChildNode = sourcePrototype._createChildNode; 784 targetPrototype._createChildNode = sourcePrototype._createChildNode;
741 targetPrototype._createProvider = sourcePrototype._createProvider; 785 targetPrototype._createProvider = sourcePrototype._createProvider;
742 targetPrototype.dispose = sourcePrototype.dispose; 786 targetPrototype.dispose = sourcePrototype.dispose;
743 targetPrototype.populateChildren = sourcePrototype.populateChildren; 787 targetPrototype.populateChildren = sourcePrototype.populateChildren;
744 targetPrototype._saveChildren = sourcePrototype._saveChildren; 788 targetPrototype._saveChildren = sourcePrototype._saveChildren;
745 targetPrototype.sort = sourcePrototype.sort; 789 targetPrototype.sort = sourcePrototype.sort;
746 } 790 }
OLDNEW
« no previous file with comments | « no previous file | Source/WebCore/inspector/front-end/DetailedHeapshotView.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698