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