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

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

Issue 696703003: DevTools: implement search for CPUProfiler FlameChart view (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: comments addressed Created 6 years, 1 month 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
« no previous file with comments | « Source/devtools/front_end/profiler/ProfileLauncherView.js ('k') | no next file » | 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) 2008 Apple Inc. All Rights Reserved. 2 * Copyright (C) 2008 Apple 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 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 413 matching lines...) Expand 10 before | Expand all | Expand 10 after
424 setFromFile: function() 424 setFromFile: function()
425 { 425 {
426 this._fromFile = true; 426 this._fromFile = true;
427 }, 427 },
428 428
429 __proto__: WebInspector.Object.prototype 429 __proto__: WebInspector.Object.prototype
430 } 430 }
431 431
432 /** 432 /**
433 * @constructor 433 * @constructor
434 * @implements {WebInspector.Searchable}
435 * @implements {WebInspector.ProfileType.DataDisplayDelegate} 434 * @implements {WebInspector.ProfileType.DataDisplayDelegate}
436 * @extends {WebInspector.PanelWithSidebarTree} 435 * @extends {WebInspector.PanelWithSidebarTree}
437 */ 436 */
438 WebInspector.ProfilesPanel = function() 437 WebInspector.ProfilesPanel = function()
439 { 438 {
440 WebInspector.PanelWithSidebarTree.call(this, "profiles"); 439 WebInspector.PanelWithSidebarTree.call(this, "profiles");
441 this.registerRequiredCSS("components/panelEnablerView.css"); 440 this.registerRequiredCSS("components/panelEnablerView.css");
442 this.registerRequiredCSS("profiler/heapProfiler.css"); 441 this.registerRequiredCSS("profiler/heapProfiler.css");
443 this.registerRequiredCSS("profiler/profilesPanel.css"); 442 this.registerRequiredCSS("profiler/profilesPanel.css");
444 443
445 this._searchableView = new WebInspector.SearchableView(this);
446
447 var mainView = new WebInspector.VBox(); 444 var mainView = new WebInspector.VBox();
448 this._searchableView.show(mainView.element);
449 mainView.show(this.mainElement()); 445 mainView.show(this.mainElement());
450 446
451 this.profilesItemTreeElement = new WebInspector.ProfilesSidebarTreeElement(t his); 447 this.profilesItemTreeElement = new WebInspector.ProfilesSidebarTreeElement(t his);
452 this.sidebarTree.setFocusable(false); 448 this.sidebarTree.setFocusable(false);
453 this.sidebarTree.appendChild(this.profilesItemTreeElement); 449 this.sidebarTree.appendChild(this.profilesItemTreeElement);
454 450
455 this.profileViews = createElement("div"); 451 this.profileViews = createElement("div");
456 this.profileViews.id = "profile-views"; 452 this.profileViews.id = "profile-views";
457 this.profileViews.classList.add("vbox"); 453 this.profileViews.classList.add("vbox");
458 this._searchableView.element.appendChild(this.profileViews); 454 mainView.element.appendChild(this.profileViews);
459 455
460 var statusBarContainer = createElementWithClass("div", "profiles-status-bar" ); 456 var statusBarContainer = createElementWithClass("div", "profiles-status-bar" );
461 mainView.element.insertBefore(statusBarContainer, mainView.element.firstChil d); 457 mainView.element.insertBefore(statusBarContainer, mainView.element.firstChil d);
462 this._statusBarElement = statusBarContainer.createChild("div", "status-bar") ; 458 this._statusBarElement = statusBarContainer.createChild("div", "status-bar") ;
463 459
464 this.sidebarElement().classList.add("profiles-sidebar-tree-box"); 460 this.sidebarElement().classList.add("profiles-sidebar-tree-box");
465 var statusBarContainerLeft = createElementWithClass("div", "profiles-status- bar"); 461 var statusBarContainerLeft = createElementWithClass("div", "profiles-status- bar");
466 this.sidebarElement().insertBefore(statusBarContainerLeft, this.sidebarEleme nt().firstChild); 462 this.sidebarElement().insertBefore(statusBarContainerLeft, this.sidebarEleme nt().firstChild);
467 this._statusBarButtons = statusBarContainerLeft.createChild("div", "status-b ar"); 463 this._statusBarButtons = statusBarContainerLeft.createChild("div", "status-b ar");
468 464
(...skipping 23 matching lines...) Expand all
492 488
493 this._createFileSelectorElement(); 489 this._createFileSelectorElement();
494 this.element.addEventListener("contextmenu", this._handleContextMenuEvent.bi nd(this), true); 490 this.element.addEventListener("contextmenu", this._handleContextMenuEvent.bi nd(this), true);
495 this._registerShortcuts(); 491 this._registerShortcuts();
496 492
497 WebInspector.targetManager.addEventListener(WebInspector.TargetManager.Event s.SuspendStateChanged, this._onSuspendStateChanged, this); 493 WebInspector.targetManager.addEventListener(WebInspector.TargetManager.Event s.SuspendStateChanged, this._onSuspendStateChanged, this);
498 } 494 }
499 495
500 WebInspector.ProfilesPanel.prototype = { 496 WebInspector.ProfilesPanel.prototype = {
501 /** 497 /**
502 * @return {!WebInspector.SearchableView} 498 * @return {?WebInspector.SearchableView}
503 */ 499 */
504 searchableView: function() 500 searchableView: function()
505 { 501 {
506 return this._searchableView; 502 return this.visibleView.searchableView();
507 }, 503 },
508 504
509 _createFileSelectorElement: function() 505 _createFileSelectorElement: function()
510 { 506 {
511 if (this._fileSelectorElement) 507 if (this._fileSelectorElement)
512 this.element.removeChild(this._fileSelectorElement); 508 this.element.removeChild(this._fileSelectorElement);
513 this._fileSelectorElement = WebInspector.createFileSelectorElement(this. _loadFromFile.bind(this)); 509 this._fileSelectorElement = WebInspector.createFileSelectorElement(this. _loadFromFile.bind(this));
514 this.element.appendChild(this._fileSelectorElement); 510 this.element.appendChild(this._fileSelectorElement);
515 }, 511 },
516 512
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
631 627
632 _reset: function() 628 _reset: function()
633 { 629 {
634 WebInspector.Panel.prototype.reset.call(this); 630 WebInspector.Panel.prototype.reset.call(this);
635 631
636 var types = WebInspector.ProfileTypeRegistry.instance.profileTypes(); 632 var types = WebInspector.ProfileTypeRegistry.instance.profileTypes();
637 for (var i = 0; i < types.length; i++) 633 for (var i = 0; i < types.length; i++)
638 types[i]._reset(); 634 types[i]._reset();
639 635
640 delete this.visibleView; 636 delete this.visibleView;
641 delete this.currentQuery;
642 this.searchCanceled();
643 637
644 this._profileGroups = {}; 638 this._profileGroups = {};
645 this._updateRecordButton(false); 639 this._updateRecordButton(false);
646 this._launcherView.profileFinished(); 640 this._launcherView.profileFinished();
647 641
648 this.sidebarTree.element.classList.remove("some-expandable"); 642 this.sidebarTree.element.classList.remove("some-expandable");
649 643
650 this._launcherView.detach(); 644 this._launcherView.detach();
651 this.profileViews.removeChildren(); 645 this.profileViews.removeChildren();
652 this._profileViewStatusBarItemsContainer.removeChildren(); 646 this._profileViewStatusBarItemsContainer.removeChildren();
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after
864 }, 858 },
865 859
866 closeVisibleView: function() 860 closeVisibleView: function()
867 { 861 {
868 if (this.visibleView) 862 if (this.visibleView)
869 this.visibleView.detach(); 863 this.visibleView.detach();
870 delete this.visibleView; 864 delete this.visibleView;
871 }, 865 },
872 866
873 /** 867 /**
874 * @param {!WebInspector.SearchableView.SearchConfig} searchConfig
875 * @param {boolean} shouldJump
876 * @param {boolean=} jumpBackwards
877 */
878 performSearch: function(searchConfig, shouldJump, jumpBackwards)
879 {
880 var query = searchConfig.query;
881 this.searchCanceled();
882
883 var visibleView = this.visibleView;
884 if (!visibleView)
885 return;
886
887 /**
888 * @this {WebInspector.ProfilesPanel}
889 */
890 function finishedCallback(view, searchMatches)
891 {
892 if (!searchMatches)
893 return;
894 this._searchableView.updateSearchMatchesCount(searchMatches);
895 this._searchResultsView = view;
896 if (shouldJump) {
897 if (jumpBackwards)
898 view.jumpToLastSearchResult();
899 else
900 view.jumpToFirstSearchResult();
901 this._searchableView.updateCurrentMatchIndex(view.currentSearchR esultIndex());
902 }
903 }
904
905 visibleView.currentQuery = query;
906 visibleView.performSearch(query, finishedCallback.bind(this));
907 },
908
909 jumpToNextSearchResult: function()
910 {
911 if (!this._searchResultsView)
912 return;
913 if (this._searchResultsView !== this.visibleView)
914 return;
915 this._searchResultsView.jumpToNextSearchResult();
916 this._searchableView.updateCurrentMatchIndex(this._searchResultsView.cur rentSearchResultIndex());
917 },
918
919 jumpToPreviousSearchResult: function()
920 {
921 if (!this._searchResultsView)
922 return;
923 if (this._searchResultsView !== this.visibleView)
924 return;
925 this._searchResultsView.jumpToPreviousSearchResult();
926 this._searchableView.updateCurrentMatchIndex(this._searchResultsView.cur rentSearchResultIndex());
927 },
928
929 /**
930 * @return {boolean}
931 */
932 supportsCaseSensitiveSearch: function()
933 {
934 return false;
935 },
936
937 /**
938 * @return {boolean}
939 */
940 supportsRegexSearch: function()
941 {
942 return false;
943 },
944
945 searchCanceled: function()
946 {
947 if (this._searchResultsView) {
948 if (this._searchResultsView.searchCanceled)
949 this._searchResultsView.searchCanceled();
950 this._searchResultsView.currentQuery = null;
951 this._searchResultsView = null;
952 }
953 this._searchableView.updateSearchMatchesCount(0);
954 },
955
956 /**
957 * @param {!Event} event 868 * @param {!Event} event
958 * @param {!WebInspector.ContextMenu} contextMenu 869 * @param {!WebInspector.ContextMenu} contextMenu
959 * @param {!Object} target 870 * @param {!Object} target
960 */ 871 */
961 appendApplicableItems: function(event, contextMenu, target) 872 appendApplicableItems: function(event, contextMenu, target)
962 { 873 {
963 if (!(target instanceof WebInspector.RemoteObject)) 874 if (!(target instanceof WebInspector.RemoteObject))
964 return; 875 return;
965 876
966 if (WebInspector.inspectorView.currentPanel() !== this) 877 if (WebInspector.inspectorView.currentPanel() !== this)
(...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after
1342 1253
1343 WebInspector.ProfilesPanelFactory.prototype = { 1254 WebInspector.ProfilesPanelFactory.prototype = {
1344 /** 1255 /**
1345 * @return {!WebInspector.Panel} 1256 * @return {!WebInspector.Panel}
1346 */ 1257 */
1347 createPanel: function() 1258 createPanel: function()
1348 { 1259 {
1349 return WebInspector.ProfilesPanel._instance(); 1260 return WebInspector.ProfilesPanel._instance();
1350 } 1261 }
1351 } 1262 }
OLDNEW
« no previous file with comments | « Source/devtools/front_end/profiler/ProfileLauncherView.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698