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 612 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
623 performSearch: function(searchConfig, shouldJump, jumpBackwards) | 623 performSearch: function(searchConfig, shouldJump, jumpBackwards) |
624 { | 624 { |
625 var nextQuery = new WebInspector.HeapSnapshotCommon.SearchConfig( | 625 var nextQuery = new WebInspector.HeapSnapshotCommon.SearchConfig( |
626 searchConfig.query.trim(), | 626 searchConfig.query.trim(), |
627 searchConfig.caseSensitive, | 627 searchConfig.caseSensitive, |
628 searchConfig.isRegex, | 628 searchConfig.isRegex, |
629 shouldJump, | 629 shouldJump, |
630 jumpBackwards || false | 630 jumpBackwards || false |
631 ); | 631 ); |
632 | 632 |
633 // FIXME: remove this function once the Throttler becomes promisified. | 633 this._searchThrottler.schedule(this._performSearch.bind(this, nextQuery)
); |
634 /** | |
635 * @param {!WebInspector.HeapSnapshotCommon.SearchConfig} nextQuery | |
636 * @param {function()} callback | |
637 * @this {WebInspector.HeapSnapshotView} | |
638 */ | |
639 function performSearchWrapper(nextQuery, callback) | |
640 { | |
641 this._performSearch(nextQuery).then(callback); | |
642 } | |
643 this._searchThrottler.schedule(performSearchWrapper.bind(this, nextQuery
)); | |
644 }, | 634 }, |
645 | 635 |
646 /** | 636 /** |
647 * @param {!WebInspector.HeapSnapshotCommon.SearchConfig} nextQuery | 637 * @param {!WebInspector.HeapSnapshotCommon.SearchConfig} nextQuery |
648 * @return {!Promise<?>} | 638 * @return {!Promise<?>} |
649 */ | 639 */ |
650 _performSearch: function(nextQuery) | 640 _performSearch: function(nextQuery) |
651 { | 641 { |
652 // Call searchCanceled since it will reset everything we need before doi
ng a new search. | 642 // Call searchCanceled since it will reset everything we need before doi
ng a new search. |
653 this.searchCanceled(); | 643 this.searchCanceled(); |
(...skipping 25 matching lines...) Expand all Loading... |
679 this._searchableView.updateSearchMatchesCount(this._searchResults.le
ngth); | 669 this._searchableView.updateSearchMatchesCount(this._searchResults.le
ngth); |
680 if (this._searchResults.length) | 670 if (this._searchResults.length) |
681 this._currentSearchResultIndex = nextQuery.jumpBackwards ? this.
_searchResults.length - 1 : 0; | 671 this._currentSearchResultIndex = nextQuery.jumpBackwards ? this.
_searchResults.length - 1 : 0; |
682 return this._jumpToSearchResult(this._currentSearchResultIndex); | 672 return this._jumpToSearchResult(this._currentSearchResultIndex); |
683 } | 673 } |
684 | 674 |
685 return this._profile._snapshotProxy.search(this.currentQuery, this._data
Grid.nodeFilter()).then(didSearch.bind(this)); | 675 return this._profile._snapshotProxy.search(this.currentQuery, this._data
Grid.nodeFilter()).then(didSearch.bind(this)); |
686 }, | 676 }, |
687 | 677 |
688 /** | 678 /** |
689 * @param {number} searchResultIndex | |
690 * @param {function()} callback | |
691 */ | |
692 _jumpToSearchResultWrapper: function(searchResultIndex, callback) | |
693 { | |
694 // FIXME: remove this function once the Throttler becomes promisified. | |
695 this._jumpToSearchResult(searchResultIndex).then(callback); | |
696 }, | |
697 | |
698 /** | |
699 * @override | 679 * @override |
700 */ | 680 */ |
701 jumpToNextSearchResult: function() | 681 jumpToNextSearchResult: function() |
702 { | 682 { |
703 if (!this._searchResults.length) | 683 if (!this._searchResults.length) |
704 return; | 684 return; |
705 this._currentSearchResultIndex = (this._currentSearchResultIndex + 1) %
this._searchResults.length; | 685 this._currentSearchResultIndex = (this._currentSearchResultIndex + 1) %
this._searchResults.length; |
706 this._searchThrottler.schedule(this._jumpToSearchResultWrapper.bind(this
, this._currentSearchResultIndex)); | 686 this._searchThrottler.schedule(this._jumpToSearchResult.bind(this, this.
_currentSearchResultIndex)); |
707 }, | 687 }, |
708 | 688 |
709 /** | 689 /** |
710 * @override | 690 * @override |
711 */ | 691 */ |
712 jumpToPreviousSearchResult: function() | 692 jumpToPreviousSearchResult: function() |
713 { | 693 { |
714 if (!this._searchResults.length) | 694 if (!this._searchResults.length) |
715 return; | 695 return; |
716 this._currentSearchResultIndex = (this._currentSearchResultIndex + this.
_searchResults.length - 1) % this._searchResults.length; | 696 this._currentSearchResultIndex = (this._currentSearchResultIndex + this.
_searchResults.length - 1) % this._searchResults.length; |
717 this._searchThrottler.schedule(this._jumpToSearchResultWrapper.bind(this
, this._currentSearchResultIndex)); | 697 this._searchThrottler.schedule(this._jumpToSearchResult.bind(this, this.
_currentSearchResultIndex)); |
718 }, | 698 }, |
719 | 699 |
720 /** | 700 /** |
721 * @param {number} searchResultIndex | 701 * @param {number} searchResultIndex |
722 * @return {!Promise<undefined>} | 702 * @return {!Promise<undefined>} |
723 */ | 703 */ |
724 _jumpToSearchResult: function(searchResultIndex) | 704 _jumpToSearchResult: function(searchResultIndex) |
725 { | 705 { |
726 this._searchableView.updateCurrentMatchIndex(searchResultIndex); | 706 this._searchableView.updateCurrentMatchIndex(searchResultIndex); |
727 return this._dataGrid.revealObjectByHeapSnapshotId(String(this._searchRe
sults[searchResultIndex])).then(this._selectRevealedNode.bind(this)); | 707 return this._dataGrid.revealObjectByHeapSnapshotId(String(this._searchRe
sults[searchResultIndex])).then(this._selectRevealedNode.bind(this)); |
(...skipping 1566 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2294 name.textContent = WebInspector.beautifyFunctionName(frame.functionN
ame); | 2274 name.textContent = WebInspector.beautifyFunctionName(frame.functionN
ame); |
2295 if (frame.scriptId) { | 2275 if (frame.scriptId) { |
2296 var urlElement = this._linkifier.linkifyScriptLocation(this._tar
get, String(frame.scriptId), frame.scriptName, frame.line - 1, frame.column - 1)
; | 2276 var urlElement = this._linkifier.linkifyScriptLocation(this._tar
get, String(frame.scriptId), frame.scriptName, frame.line - 1, frame.column - 1)
; |
2297 frameDiv.appendChild(urlElement); | 2277 frameDiv.appendChild(urlElement); |
2298 } | 2278 } |
2299 } | 2279 } |
2300 }, | 2280 }, |
2301 | 2281 |
2302 __proto__: WebInspector.Widget.prototype | 2282 __proto__: WebInspector.Widget.prototype |
2303 } | 2283 } |
OLD | NEW |