| OLD | NEW |
| 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 13 matching lines...) Expand all Loading... |
| 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 29 */ | 29 */ |
| 30 | 30 |
| 31 /** | 31 /** |
| 32 * @constructor | 32 * @constructor |
| 33 * @implements {WebInspector.ProfileType.DataDisplayDelegate} | 33 * @implements {WebInspector.ProfileType.DataDisplayDelegate} |
| 34 * @implements {WebInspector.Searchable} |
| 34 * @extends {WebInspector.VBox} | 35 * @extends {WebInspector.VBox} |
| 35 * @param {!WebInspector.ProfileType.DataDisplayDelegate} dataDisplayDelegate | 36 * @param {!WebInspector.ProfileType.DataDisplayDelegate} dataDisplayDelegate |
| 36 * @param {!WebInspector.HeapProfileHeader} profile | 37 * @param {!WebInspector.HeapProfileHeader} profile |
| 37 */ | 38 */ |
| 38 WebInspector.HeapSnapshotView = function(dataDisplayDelegate, profile) | 39 WebInspector.HeapSnapshotView = function(dataDisplayDelegate, profile) |
| 39 { | 40 { |
| 40 WebInspector.VBox.call(this); | 41 WebInspector.VBox.call(this); |
| 41 | 42 |
| 42 this.element.classList.add("heap-snapshot-view"); | 43 this.element.classList.add("heap-snapshot-view"); |
| 43 | 44 |
| 44 profile.profileType().addEventListener(WebInspector.HeapSnapshotProfileType.
SnapshotReceived, this._onReceiveSnapshot, this); | 45 profile.profileType().addEventListener(WebInspector.HeapSnapshotProfileType.
SnapshotReceived, this._onReceiveSnapshot, this); |
| 45 profile.profileType().addEventListener(WebInspector.ProfileType.Events.Remov
eProfileHeader, this._onProfileHeaderRemoved, this); | 46 profile.profileType().addEventListener(WebInspector.ProfileType.Events.Remov
eProfileHeader, this._onProfileHeaderRemoved, this); |
| 46 | 47 |
| 47 if (profile.profileType().id === WebInspector.TrackingHeapSnapshotProfileTyp
e.TypeId) { | 48 if (profile.profileType().id === WebInspector.TrackingHeapSnapshotProfileTyp
e.TypeId) { |
| 48 this._trackingOverviewGrid = new WebInspector.HeapTrackingOverviewGrid(p
rofile); | 49 this._trackingOverviewGrid = new WebInspector.HeapTrackingOverviewGrid(p
rofile); |
| 49 this._trackingOverviewGrid.addEventListener(WebInspector.HeapTrackingOve
rviewGrid.IdsRangeChanged, this._onIdsRangeChanged.bind(this)); | 50 this._trackingOverviewGrid.addEventListener(WebInspector.HeapTrackingOve
rviewGrid.IdsRangeChanged, this._onIdsRangeChanged.bind(this)); |
| 50 } | 51 } |
| 51 | 52 |
| 52 this._parentDataDisplayDelegate = dataDisplayDelegate; | 53 this._parentDataDisplayDelegate = dataDisplayDelegate; |
| 53 | 54 |
| 55 this._searchableView = new WebInspector.SearchableView(this); |
| 56 this._searchableView.show(this.element); |
| 57 |
| 54 this._splitView = new WebInspector.SplitView(false, true, "heapSnapshotSplit
ViewState", 200, 200); | 58 this._splitView = new WebInspector.SplitView(false, true, "heapSnapshotSplit
ViewState", 200, 200); |
| 55 this._splitView.show(this.element); | 59 this._splitView.show(this._searchableView.element); |
| 56 | 60 |
| 57 this._containmentView = new WebInspector.VBox(); | 61 this._containmentView = new WebInspector.VBox(); |
| 58 this._containmentView.setMinimumSize(50, 25); | 62 this._containmentView.setMinimumSize(50, 25); |
| 59 this._containmentDataGrid = new WebInspector.HeapSnapshotContainmentDataGrid
(this); | 63 this._containmentDataGrid = new WebInspector.HeapSnapshotContainmentDataGrid
(this); |
| 60 this._containmentDataGrid.show(this._containmentView.element); | 64 this._containmentDataGrid.show(this._containmentView.element); |
| 61 this._containmentDataGrid.addEventListener(WebInspector.DataGrid.Events.Sele
ctedNode, this._selectionChanged, this); | 65 this._containmentDataGrid.addEventListener(WebInspector.DataGrid.Events.Sele
ctedNode, this._selectionChanged, this); |
| 62 | 66 |
| 63 this._statisticsView = new WebInspector.HeapSnapshotStatisticsView(); | 67 this._statisticsView = new WebInspector.HeapSnapshotStatisticsView(); |
| 64 | 68 |
| 65 this._constructorsView = new WebInspector.VBox(); | 69 this._constructorsView = new WebInspector.VBox(); |
| (...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 235 | 239 |
| 236 WebInspector.HeapSnapshotView.SummaryPerspective.prototype = { | 240 WebInspector.HeapSnapshotView.SummaryPerspective.prototype = { |
| 237 /** | 241 /** |
| 238 * @override | 242 * @override |
| 239 * @param {!WebInspector.HeapSnapshotView} heapSnapshotView | 243 * @param {!WebInspector.HeapSnapshotView} heapSnapshotView |
| 240 */ | 244 */ |
| 241 activate: function(heapSnapshotView) | 245 activate: function(heapSnapshotView) |
| 242 { | 246 { |
| 243 heapSnapshotView._constructorsView.show(heapSnapshotView._splitView.main
Element()); | 247 heapSnapshotView._constructorsView.show(heapSnapshotView._splitView.main
Element()); |
| 244 heapSnapshotView._objectDetailsView.show(heapSnapshotView._splitView.sid
ebarElement()); | 248 heapSnapshotView._objectDetailsView.show(heapSnapshotView._splitView.sid
ebarElement()); |
| 245 heapSnapshotView._splitView.show(heapSnapshotView.element); | 249 heapSnapshotView._splitView.show(heapSnapshotView._searchableView.elemen
t); |
| 246 heapSnapshotView._filterSelect.visible = true; | 250 heapSnapshotView._filterSelect.visible = true; |
| 247 heapSnapshotView._classNameFilter.visible = true; | 251 heapSnapshotView._classNameFilter.visible = true; |
| 248 if (heapSnapshotView._trackingOverviewGrid) { | 252 if (heapSnapshotView._trackingOverviewGrid) { |
| 249 heapSnapshotView._trackingOverviewGrid.show(heapSnapshotView.element
, heapSnapshotView._splitView.element); | 253 heapSnapshotView._trackingOverviewGrid.show(heapSnapshotView._search
ableView.element, heapSnapshotView._splitView.element); |
| 250 heapSnapshotView._trackingOverviewGrid.update(); | 254 heapSnapshotView._trackingOverviewGrid.update(); |
| 251 heapSnapshotView._trackingOverviewGrid._updateGrid(); | 255 heapSnapshotView._trackingOverviewGrid._updateGrid(); |
| 252 } | 256 } |
| 253 }, | 257 }, |
| 254 | 258 |
| 255 /** | 259 /** |
| 256 * @override | 260 * @override |
| 257 * @param {!WebInspector.HeapSnapshotView} heapSnapshotView | 261 * @param {!WebInspector.HeapSnapshotView} heapSnapshotView |
| 258 * @return {?WebInspector.DataGrid} | 262 * @return {?WebInspector.DataGrid} |
| 259 */ | 263 */ |
| (...skipping 25 matching lines...) Expand all Loading... |
| 285 | 289 |
| 286 WebInspector.HeapSnapshotView.ComparisonPerspective.prototype = { | 290 WebInspector.HeapSnapshotView.ComparisonPerspective.prototype = { |
| 287 /** | 291 /** |
| 288 * @override | 292 * @override |
| 289 * @param {!WebInspector.HeapSnapshotView} heapSnapshotView | 293 * @param {!WebInspector.HeapSnapshotView} heapSnapshotView |
| 290 */ | 294 */ |
| 291 activate: function(heapSnapshotView) | 295 activate: function(heapSnapshotView) |
| 292 { | 296 { |
| 293 heapSnapshotView._diffView.show(heapSnapshotView._splitView.mainElement(
)); | 297 heapSnapshotView._diffView.show(heapSnapshotView._splitView.mainElement(
)); |
| 294 heapSnapshotView._objectDetailsView.show(heapSnapshotView._splitView.sid
ebarElement()); | 298 heapSnapshotView._objectDetailsView.show(heapSnapshotView._splitView.sid
ebarElement()); |
| 295 heapSnapshotView._splitView.show(heapSnapshotView.element); | 299 heapSnapshotView._splitView.show(heapSnapshotView._searchableView.elemen
t); |
| 296 heapSnapshotView._baseSelect.visible = true; | 300 heapSnapshotView._baseSelect.visible = true; |
| 297 heapSnapshotView._classNameFilter.visible = true; | 301 heapSnapshotView._classNameFilter.visible = true; |
| 298 }, | 302 }, |
| 299 | 303 |
| 300 /** | 304 /** |
| 301 * @override | 305 * @override |
| 302 * @param {!WebInspector.HeapSnapshotView} heapSnapshotView | 306 * @param {!WebInspector.HeapSnapshotView} heapSnapshotView |
| 303 * @return {?WebInspector.DataGrid} | 307 * @return {?WebInspector.DataGrid} |
| 304 */ | 308 */ |
| 305 masterGrid: function(heapSnapshotView) | 309 masterGrid: function(heapSnapshotView) |
| (...skipping 24 matching lines...) Expand all Loading... |
| 330 | 334 |
| 331 WebInspector.HeapSnapshotView.ContainmentPerspective.prototype = { | 335 WebInspector.HeapSnapshotView.ContainmentPerspective.prototype = { |
| 332 /** | 336 /** |
| 333 * @override | 337 * @override |
| 334 * @param {!WebInspector.HeapSnapshotView} heapSnapshotView | 338 * @param {!WebInspector.HeapSnapshotView} heapSnapshotView |
| 335 */ | 339 */ |
| 336 activate: function(heapSnapshotView) | 340 activate: function(heapSnapshotView) |
| 337 { | 341 { |
| 338 heapSnapshotView._containmentView.show(heapSnapshotView._splitView.mainE
lement()); | 342 heapSnapshotView._containmentView.show(heapSnapshotView._splitView.mainE
lement()); |
| 339 heapSnapshotView._objectDetailsView.show(heapSnapshotView._splitView.sid
ebarElement()); | 343 heapSnapshotView._objectDetailsView.show(heapSnapshotView._splitView.sid
ebarElement()); |
| 340 heapSnapshotView._splitView.show(heapSnapshotView.element); | 344 heapSnapshotView._splitView.show(heapSnapshotView._searchableView.elemen
t); |
| 341 }, | 345 }, |
| 342 | 346 |
| 343 /** | 347 /** |
| 344 * @override | 348 * @override |
| 345 * @param {!WebInspector.HeapSnapshotView} heapSnapshotView | 349 * @param {!WebInspector.HeapSnapshotView} heapSnapshotView |
| 346 * @return {?WebInspector.DataGrid} | 350 * @return {?WebInspector.DataGrid} |
| 347 */ | 351 */ |
| 348 masterGrid: function(heapSnapshotView) | 352 masterGrid: function(heapSnapshotView) |
| 349 { | 353 { |
| 350 return heapSnapshotView._containmentDataGrid; | 354 return heapSnapshotView._containmentDataGrid; |
| (...skipping 23 matching lines...) Expand all Loading... |
| 374 /** | 378 /** |
| 375 * @override | 379 * @override |
| 376 * @param {!WebInspector.HeapSnapshotView} heapSnapshotView | 380 * @param {!WebInspector.HeapSnapshotView} heapSnapshotView |
| 377 */ | 381 */ |
| 378 activate: function(heapSnapshotView) | 382 activate: function(heapSnapshotView) |
| 379 { | 383 { |
| 380 heapSnapshotView._allocationView.show(this._allocationSplitView.mainElem
ent()); | 384 heapSnapshotView._allocationView.show(this._allocationSplitView.mainElem
ent()); |
| 381 heapSnapshotView._constructorsView.show(heapSnapshotView._splitView.main
Element()); | 385 heapSnapshotView._constructorsView.show(heapSnapshotView._splitView.main
Element()); |
| 382 heapSnapshotView._objectDetailsView.show(heapSnapshotView._splitView.sid
ebarElement()); | 386 heapSnapshotView._objectDetailsView.show(heapSnapshotView._splitView.sid
ebarElement()); |
| 383 heapSnapshotView._splitView.show(this._allocationSplitView.sidebarElemen
t()); | 387 heapSnapshotView._splitView.show(this._allocationSplitView.sidebarElemen
t()); |
| 384 this._allocationSplitView.show(heapSnapshotView.element); | 388 this._allocationSplitView.show(heapSnapshotView._searchableView.element)
; |
| 385 | 389 |
| 386 heapSnapshotView._constructorsDataGrid.clear(); | 390 heapSnapshotView._constructorsDataGrid.clear(); |
| 387 var selectedNode = heapSnapshotView._allocationDataGrid.selectedNode; | 391 var selectedNode = heapSnapshotView._allocationDataGrid.selectedNode; |
| 388 if (selectedNode) | 392 if (selectedNode) |
| 389 heapSnapshotView._constructorsDataGrid.setAllocationNodeId(selectedN
ode.allocationNodeId()); | 393 heapSnapshotView._constructorsDataGrid.setAllocationNodeId(selectedN
ode.allocationNodeId()); |
| 390 }, | 394 }, |
| 391 | 395 |
| 392 /** | 396 /** |
| 393 * @override | 397 * @override |
| 394 * @param {!WebInspector.HeapSnapshotView} heapSnapshotView | 398 * @param {!WebInspector.HeapSnapshotView} heapSnapshotView |
| (...skipping 26 matching lines...) Expand all Loading... |
| 421 WebInspector.HeapSnapshotView.Perspective.call(this, WebInspector.UIString(
"Statistics")); | 425 WebInspector.HeapSnapshotView.Perspective.call(this, WebInspector.UIString(
"Statistics")); |
| 422 } | 426 } |
| 423 | 427 |
| 424 WebInspector.HeapSnapshotView.StatisticsPerspective.prototype = { | 428 WebInspector.HeapSnapshotView.StatisticsPerspective.prototype = { |
| 425 /** | 429 /** |
| 426 * @override | 430 * @override |
| 427 * @param {!WebInspector.HeapSnapshotView} heapSnapshotView | 431 * @param {!WebInspector.HeapSnapshotView} heapSnapshotView |
| 428 */ | 432 */ |
| 429 activate: function(heapSnapshotView) | 433 activate: function(heapSnapshotView) |
| 430 { | 434 { |
| 431 heapSnapshotView._statisticsView.show(heapSnapshotView.element); | 435 heapSnapshotView._statisticsView.show(heapSnapshotView._searchableView.e
lement); |
| 432 }, | 436 }, |
| 433 | 437 |
| 434 /** | 438 /** |
| 435 * @override | 439 * @override |
| 436 * @param {!WebInspector.HeapSnapshotView} heapSnapshotView | 440 * @param {!WebInspector.HeapSnapshotView} heapSnapshotView |
| 437 * @return {?WebInspector.DataGrid} | 441 * @return {?WebInspector.DataGrid} |
| 438 */ | 442 */ |
| 439 masterGrid: function(heapSnapshotView) | 443 masterGrid: function(heapSnapshotView) |
| 440 { | 444 { |
| 441 return null; | 445 return null; |
| 442 }, | 446 }, |
| 443 | 447 |
| 444 __proto__: WebInspector.HeapSnapshotView.Perspective.prototype | 448 __proto__: WebInspector.HeapSnapshotView.Perspective.prototype |
| 445 } | 449 } |
| 446 | 450 |
| 447 | 451 |
| 448 WebInspector.HeapSnapshotView.prototype = { | 452 WebInspector.HeapSnapshotView.prototype = { |
| 449 /** | 453 /** |
| 454 * @return {!WebInspector.SearchableView} |
| 455 */ |
| 456 searchableView: function() |
| 457 { |
| 458 return this._searchableView; |
| 459 }, |
| 460 |
| 461 /** |
| 450 * @override | 462 * @override |
| 451 * @param {?WebInspector.ProfileHeader} profile | 463 * @param {?WebInspector.ProfileHeader} profile |
| 452 * @return {?WebInspector.View} | 464 * @return {?WebInspector.View} |
| 453 */ | 465 */ |
| 454 showProfile: function(profile) | 466 showProfile: function(profile) |
| 455 { | 467 { |
| 456 return this._parentDataDisplayDelegate.showProfile(profile); | 468 return this._parentDataDisplayDelegate.showProfile(profile); |
| 457 }, | 469 }, |
| 458 | 470 |
| 459 /** | 471 /** |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 536 }, | 548 }, |
| 537 | 549 |
| 538 willHide: function() | 550 willHide: function() |
| 539 { | 551 { |
| 540 this._currentSearchResultIndex = -1; | 552 this._currentSearchResultIndex = -1; |
| 541 this._popoverHelper.hidePopover(); | 553 this._popoverHelper.hidePopover(); |
| 542 if (this.helpPopover && this.helpPopover.isShowing()) | 554 if (this.helpPopover && this.helpPopover.isShowing()) |
| 543 this.helpPopover.hide(); | 555 this.helpPopover.hide(); |
| 544 }, | 556 }, |
| 545 | 557 |
| 558 /** |
| 559 * @return {boolean} |
| 560 */ |
| 561 supportsCaseSensitiveSearch: function() |
| 562 { |
| 563 return true; |
| 564 }, |
| 565 |
| 566 /** |
| 567 * @return {boolean} |
| 568 */ |
| 569 supportsRegexSearch: function() |
| 570 { |
| 571 return false; |
| 572 }, |
| 573 |
| 546 searchCanceled: function() | 574 searchCanceled: function() |
| 547 { | 575 { |
| 548 if (this._searchResults) { | 576 if (this._searchResults) { |
| 549 for (var i = 0; i < this._searchResults.length; ++i) { | 577 for (var i = 0; i < this._searchResults.length; ++i) { |
| 550 var node = this._searchResults[i].node; | 578 var node = this._searchResults[i].node; |
| 551 delete node._searchMatched; | 579 delete node._searchMatched; |
| 552 node.refresh(); | 580 node.refresh(); |
| 553 } | 581 } |
| 554 } | 582 } |
| 555 | 583 |
| 556 delete this._searchFinishedCallback; | |
| 557 this._currentSearchResultIndex = -1; | 584 this._currentSearchResultIndex = -1; |
| 558 this._searchResults = []; | 585 this._searchResults = []; |
| 559 }, | 586 }, |
| 560 | 587 |
| 561 /** | 588 /** |
| 562 * @param {string} query | 589 * @param {boolean} found |
| 563 * @param {function(!WebInspector.View, number)} finishedCallback | |
| 564 */ | 590 */ |
| 565 performSearch: function(query, finishedCallback) | 591 _didHighlightById: function(found) |
| 592 { |
| 593 // Do not remove. It needs for heap snapshot search tests. |
| 594 }, |
| 595 |
| 596 /** |
| 597 * @param {!WebInspector.SearchableView.SearchConfig} searchConfig |
| 598 * @param {boolean} shouldJump |
| 599 * @param {boolean=} jumpBackwards |
| 600 */ |
| 601 performSearch: function(searchConfig, shouldJump, jumpBackwards) |
| 566 { | 602 { |
| 567 // Call searchCanceled since it will reset everything we need before doi
ng a new search. | 603 // Call searchCanceled since it will reset everything we need before doi
ng a new search. |
| 568 this.searchCanceled(); | 604 this.searchCanceled(); |
| 569 | 605 |
| 606 this.currentQuery = searchConfig; |
| 607 var query = searchConfig.query; |
| 570 query = query.trim(); | 608 query = query.trim(); |
| 571 | 609 |
| 572 if (!query) | 610 if (!query) |
| 573 return; | 611 return; |
| 574 if (!this._currentPerspective.supportsSearch()) | 612 if (!this._currentPerspective.supportsSearch()) |
| 575 return; | 613 return; |
| 576 | 614 |
| 577 /** | |
| 578 * @param {boolean} found | |
| 579 * @this {WebInspector.HeapSnapshotView} | |
| 580 */ | |
| 581 function didHighlight(found) | |
| 582 { | |
| 583 finishedCallback(this, found ? 1 : 0); | |
| 584 } | |
| 585 | |
| 586 if (query.charAt(0) === "@") { | 615 if (query.charAt(0) === "@") { |
| 587 var snapshotNodeId = parseInt(query.substring(1), 10); | 616 var snapshotNodeId = parseInt(query.substring(1), 10); |
| 588 if (!isNaN(snapshotNodeId)) | 617 if (!isNaN(snapshotNodeId)) |
| 589 this._dataGrid.highlightObjectByHeapSnapshotId(String(snapshotNo
deId), didHighlight.bind(this)); | 618 this._dataGrid.highlightObjectByHeapSnapshotId(String(snapshotNo
deId), this._didHighlightById.bind(this)); |
| 590 else | |
| 591 finishedCallback(this, 0); | |
| 592 return; | 619 return; |
| 593 } | 620 } |
| 594 | 621 |
| 595 this._searchFinishedCallback = finishedCallback; | 622 var nameRegExp = createPlainTextSearchRegex(query, searchConfig.caseSens
itive ? "": "i"); |
| 596 var nameRegExp = createPlainTextSearchRegex(query, "i"); | |
| 597 | 623 |
| 598 function matchesByName(gridNode) { | 624 function matchesByName(gridNode) { |
| 599 return ("_name" in gridNode) && nameRegExp.test(gridNode._name); | 625 return ("_name" in gridNode) && nameRegExp.test(gridNode._name); |
| 600 } | 626 } |
| 601 | 627 |
| 602 function matchesQuery(gridNode) | 628 function matchesQuery(gridNode) |
| 603 { | 629 { |
| 604 delete gridNode._searchMatched; | 630 delete gridNode._searchMatched; |
| 605 if (matchesByName(gridNode)) { | 631 if (matchesByName(gridNode)) { |
| 606 gridNode._searchMatched = true; | 632 gridNode._searchMatched = true; |
| (...skipping 10 matching lines...) Expand all Loading... |
| 617 // Restrict to type nodes and instances. | 643 // Restrict to type nodes and instances. |
| 618 const maxDepth = 1; | 644 const maxDepth = 1; |
| 619 | 645 |
| 620 while (current) { | 646 while (current) { |
| 621 if (matchesQuery(current)) | 647 if (matchesQuery(current)) |
| 622 this._searchResults.push({ node: current }); | 648 this._searchResults.push({ node: current }); |
| 623 current = current.traverseNextNode(false, null, (depth >= maxDepth),
info); | 649 current = current.traverseNextNode(false, null, (depth >= maxDepth),
info); |
| 624 depth += info.depthChange; | 650 depth += info.depthChange; |
| 625 } | 651 } |
| 626 | 652 |
| 627 finishedCallback(this, this._searchResults.length); | 653 this._searchableView.updateSearchMatchesCount(this._searchResults.length
); |
| 628 }, | 654 if (this._searchResults.length) { |
| 629 | 655 if (jumpBackwards) |
| 630 jumpToFirstSearchResult: function() | 656 this._currentSearchResultIndex = this._searchResults.length - 1; |
| 631 { | 657 else |
| 632 if (!this._searchResults || !this._searchResults.length) | 658 this._currentSearchResultIndex = this._searchResults.length ? 0
: -1; |
| 633 return; | 659 } |
| 634 this._currentSearchResultIndex = 0; | 660 this._searchableView.updateCurrentMatchIndex(this._currentSearchResultIn
dex); |
| 635 this._jumpToSearchResult(this._currentSearchResultIndex); | 661 this._jumpToSearchResult(); |
| 636 }, | |
| 637 | |
| 638 jumpToLastSearchResult: function() | |
| 639 { | |
| 640 if (!this._searchResults || !this._searchResults.length) | |
| 641 return; | |
| 642 this._currentSearchResultIndex = (this._searchResults.length - 1); | |
| 643 this._jumpToSearchResult(this._currentSearchResultIndex); | |
| 644 }, | 662 }, |
| 645 | 663 |
| 646 jumpToNextSearchResult: function() | 664 jumpToNextSearchResult: function() |
| 647 { | 665 { |
| 648 if (!this._searchResults || !this._searchResults.length) | 666 if (!this._searchResults.length) |
| 649 return; | 667 return; |
| 650 if (++this._currentSearchResultIndex >= this._searchResults.length) | 668 this._currentSearchResultIndex = (this._currentSearchResultIndex + 1) %
this._searchResults.length; |
| 651 this._currentSearchResultIndex = 0; | 669 this._jumpToSearchResult(); |
| 652 this._jumpToSearchResult(this._currentSearchResultIndex); | |
| 653 }, | 670 }, |
| 654 | 671 |
| 655 jumpToPreviousSearchResult: function() | 672 jumpToPreviousSearchResult: function() |
| 656 { | 673 { |
| 657 if (!this._searchResults || !this._searchResults.length) | 674 if (!this._searchResults.length) |
| 658 return; | 675 return; |
| 659 if (--this._currentSearchResultIndex < 0) | 676 this._currentSearchResultIndex = (this._currentSearchResultIndex + this.
_searchResults.length - 1) % this._searchResults.length; |
| 660 this._currentSearchResultIndex = (this._searchResults.length - 1); | 677 this._jumpToSearchResult(); |
| 661 this._jumpToSearchResult(this._currentSearchResultIndex); | |
| 662 }, | 678 }, |
| 663 | 679 |
| 664 /** | 680 _jumpToSearchResult: function() |
| 665 * @return {number} | |
| 666 */ | |
| 667 currentSearchResultIndex: function() { | |
| 668 return this._currentSearchResultIndex; | |
| 669 }, | |
| 670 | |
| 671 _jumpToSearchResult: function(index) | |
| 672 { | 681 { |
| 673 var searchResult = this._searchResults[index]; | 682 var searchResult = this._searchResults[this._currentSearchResultIndex]; |
| 674 if (!searchResult) | 683 if (!searchResult) |
| 675 return; | 684 return; |
| 676 | 685 |
| 677 var node = searchResult.node; | 686 var node = searchResult.node; |
| 678 node.revealAndSelect(); | 687 node.revealAndSelect(); |
| 679 }, | 688 }, |
| 680 | 689 |
| 681 refreshVisibleData: function() | 690 refreshVisibleData: function() |
| 682 { | 691 { |
| 683 if (!this._dataGrid) | 692 if (!this._dataGrid) |
| 684 return; | 693 return; |
| 685 var child = this._dataGrid.rootNode().children[0]; | 694 var child = this._dataGrid.rootNode().children[0]; |
| 686 while (child) { | 695 while (child) { |
| 687 child.refresh(); | 696 child.refresh(); |
| 688 child = child.traverseNextNode(false, null, true); | 697 child = child.traverseNextNode(false, null, true); |
| 689 } | 698 } |
| 690 }, | 699 }, |
| 691 | 700 |
| 692 _changeBase: function() | 701 _changeBase: function() |
| 693 { | 702 { |
| 694 if (this._baseProfile === this._profiles()[this._baseSelect.selectedInde
x()]) | 703 if (this._baseProfile === this._profiles()[this._baseSelect.selectedInde
x()]) |
| 695 return; | 704 return; |
| 696 | 705 |
| 697 this._baseProfile = this._profiles()[this._baseSelect.selectedIndex()]; | 706 this._baseProfile = this._profiles()[this._baseSelect.selectedIndex()]; |
| 698 var dataGrid = /** @type {!WebInspector.HeapSnapshotDiffDataGrid} */ (th
is._dataGrid); | 707 var dataGrid = /** @type {!WebInspector.HeapSnapshotDiffDataGrid} */ (th
is._dataGrid); |
| 699 // Change set base data source only if main data source is already set. | 708 // Change set base data source only if main data source is already set. |
| 700 if (dataGrid.snapshot) | 709 if (dataGrid.snapshot) |
| 701 this._baseProfile.load(dataGrid.setBaseDataSource.bind(dataGrid)); | 710 this._baseProfile.load(dataGrid.setBaseDataSource.bind(dataGrid)); |
| 702 | 711 |
| 703 if (!this.currentQuery || !this._searchFinishedCallback || !this._search
Results) | 712 if (!this.currentQuery || !this._searchResults) |
| 704 return; | 713 return; |
| 705 | 714 |
| 706 // The current search needs to be performed again. First negate out prev
ious match | 715 // The current search needs to be performed again. First negate out prev
ious match |
| 707 // count by calling the search finished callback with a negative number
of matches. | 716 // count by calling the search finished callback with a negative number
of matches. |
| 708 // Then perform the search again with the same query and callback. | 717 // Then perform the search again with the same query and callback. |
| 709 this._searchFinishedCallback(this, -this._searchResults.length); | 718 this.performSearch(this.currentQuery, false); |
| 710 this.performSearch(this.currentQuery, this._searchFinishedCallback); | |
| 711 }, | 719 }, |
| 712 | 720 |
| 713 _changeFilter: function() | 721 _changeFilter: function() |
| 714 { | 722 { |
| 715 var profileIndex = this._filterSelect.selectedIndex() - 1; | 723 var profileIndex = this._filterSelect.selectedIndex() - 1; |
| 716 this._dataGrid.filterSelectIndexChanged(this._profiles(), profileIndex); | 724 this._dataGrid.filterSelectIndexChanged(this._profiles(), profileIndex); |
| 717 | 725 |
| 718 WebInspector.notifications.dispatchEventToListeners(WebInspector.UserMet
rics.UserAction, { | 726 WebInspector.notifications.dispatchEventToListeners(WebInspector.UserMet
rics.UserAction, { |
| 719 action: WebInspector.UserMetrics.UserActionNames.HeapSnapshotFilterC
hanged, | 727 action: WebInspector.UserMetrics.UserActionNames.HeapSnapshotFilterC
hanged, |
| 720 label: this._filterSelect.selectedOption().label | 728 label: this._filterSelect.selectedOption().label |
| 721 }); | 729 }); |
| 722 | 730 |
| 723 if (!this.currentQuery || !this._searchFinishedCallback || !this._search
Results) | 731 if (!this.currentQuery || !this._searchResults) |
| 724 return; | 732 return; |
| 725 | 733 |
| 726 // The current search needs to be performed again. First negate out prev
ious match | 734 // The current search needs to be performed again. First negate out prev
ious match |
| 727 // count by calling the search finished callback with a negative number
of matches. | 735 // count by calling the search finished callback with a negative number
of matches. |
| 728 // Then perform the search again with the same query and callback. | 736 // Then perform the search again with the same query and callback. |
| 729 this._searchFinishedCallback(this, -this._searchResults.length); | 737 this.performSearch(this.currentQuery, false); |
| 730 this.performSearch(this.currentQuery, this._searchFinishedCallback); | |
| 731 }, | 738 }, |
| 732 | 739 |
| 733 /** | 740 /** |
| 734 * @return {!Array.<!WebInspector.ProfileHeader>} | 741 * @return {!Array.<!WebInspector.ProfileHeader>} |
| 735 */ | 742 */ |
| 736 _profiles: function() | 743 _profiles: function() |
| 737 { | 744 { |
| 738 return this._profile.profileType().getProfiles(); | 745 return this._profile.profileType().getProfiles(); |
| 739 }, | 746 }, |
| 740 | 747 |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 881 this._currentPerspective = perspective; | 888 this._currentPerspective = perspective; |
| 882 this._dataGrid = perspective.masterGrid(this); | 889 this._dataGrid = perspective.masterGrid(this); |
| 883 perspective.activate(this); | 890 perspective.activate(this); |
| 884 | 891 |
| 885 this.refreshVisibleData(); | 892 this.refreshVisibleData(); |
| 886 if (this._dataGrid) | 893 if (this._dataGrid) |
| 887 this._dataGrid.updateWidths(); | 894 this._dataGrid.updateWidths(); |
| 888 | 895 |
| 889 this._updateDataSourceAndView(); | 896 this._updateDataSourceAndView(); |
| 890 | 897 |
| 891 if (!this.currentQuery || !this._searchFinishedCallback || !this._search
Results) | 898 if (!this.currentQuery || !this._searchResults) |
| 892 return; | 899 return; |
| 893 | 900 |
| 894 // The current search needs to be performed again. First negate out prev
ious match | 901 // The current search needs to be performed again. First negate out prev
ious match |
| 895 // count by calling the search finished callback with a negative number
of matches. | 902 // count by calling the search finished callback with a negative number
of matches. |
| 896 // Then perform the search again the with same query and callback. | 903 // Then perform the search again the with same query and callback. |
| 897 this._searchFinishedCallback(this, -this._searchResults.length); | 904 this.performSearch(this.currentQuery, false); |
| 898 this.performSearch(this.currentQuery, this._searchFinishedCallback); | |
| 899 }, | 905 }, |
| 900 | 906 |
| 901 /** | 907 /** |
| 902 * @param {string} perspectiveName | 908 * @param {string} perspectiveName |
| 903 * @param {!HeapProfilerAgent.HeapSnapshotObjectId} snapshotObjectId | 909 * @param {!HeapProfilerAgent.HeapSnapshotObjectId} snapshotObjectId |
| 904 */ | 910 */ |
| 905 highlightLiveObject: function(perspectiveName, snapshotObjectId) | 911 highlightLiveObject: function(perspectiveName, snapshotObjectId) |
| 906 { | 912 { |
| 907 this._changePerspectiveAndWait(perspectiveName, didChangePerspective.bin
d(this)); | 913 this._changePerspectiveAndWait(perspectiveName, didChangePerspective.bin
d(this)); |
| 908 | 914 |
| (...skipping 21 matching lines...) Expand all Loading... |
| 930 if (!row) | 936 if (!row) |
| 931 return; | 937 return; |
| 932 span.node = row._dataGridNode; | 938 span.node = row._dataGridNode; |
| 933 return span; | 939 return span; |
| 934 }, | 940 }, |
| 935 | 941 |
| 936 _resolveObjectForPopover: function(element, showCallback, objectGroupName) | 942 _resolveObjectForPopover: function(element, showCallback, objectGroupName) |
| 937 { | 943 { |
| 938 if (!this._profile.target()) | 944 if (!this._profile.target()) |
| 939 return; | 945 return; |
| 946 if (!element.node) |
| 947 return; |
| 940 element.node.queryObjectContent(this._profile.target(), showCallback, ob
jectGroupName); | 948 element.node.queryObjectContent(this._profile.target(), showCallback, ob
jectGroupName); |
| 941 }, | 949 }, |
| 942 | 950 |
| 943 _updateBaseOptions: function() | 951 _updateBaseOptions: function() |
| 944 { | 952 { |
| 945 var list = this._profiles(); | 953 var list = this._profiles(); |
| 946 // We're assuming that snapshots can only be added. | 954 // We're assuming that snapshots can only be added. |
| 947 if (this._baseSelect.size() === list.length) | 955 if (this._baseSelect.size() === list.length) |
| 948 return; | 956 return; |
| 949 | 957 |
| (...skipping 1246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2196 name.textContent = frame.functionName; | 2204 name.textContent = frame.functionName; |
| 2197 if (frame.scriptId) { | 2205 if (frame.scriptId) { |
| 2198 var urlElement = this._linkifier.linkifyScriptLocation(this._tar
get, String(frame.scriptId), frame.scriptName, frame.line - 1, frame.column - 1)
; | 2206 var urlElement = this._linkifier.linkifyScriptLocation(this._tar
get, String(frame.scriptId), frame.scriptName, frame.line - 1, frame.column - 1)
; |
| 2199 frameDiv.appendChild(urlElement); | 2207 frameDiv.appendChild(urlElement); |
| 2200 } | 2208 } |
| 2201 } | 2209 } |
| 2202 }, | 2210 }, |
| 2203 | 2211 |
| 2204 __proto__: WebInspector.View.prototype | 2212 __proto__: WebInspector.View.prototype |
| 2205 } | 2213 } |
| OLD | NEW |