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

Side by Side Diff: chrome/browser/resources/tracing/timeline_track.js

Issue 10170001: Find feature for tracing, at long last. (Closed) Base URL: git://localhost/home/nduca/Local/chrome/src@master
Patch Set: patch for landing Created 8 years, 8 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 5
6 /** 6 /**
7 * @fileoverview Renders an array of slices into the provided div, 7 * @fileoverview Renders an array of slices into the provided div,
8 * using a child canvas element. Uses a FastRectRenderer to draw only 8 * using a child canvas element. Uses a FastRectRenderer to draw only
9 * the visible slices. 9 * the visible slices.
10 */ 10 */
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 * intersecting the interval. 101 * intersecting the interval.
102 */ 102 */
103 pickRange: function(loWX, hiWX, loY, hiY, onHitCallback) { 103 pickRange: function(loWX, hiWX, loY, hiY, onHitCallback) {
104 for (var i = 0; i < this.tracks_.length; i++) { 104 for (var i = 0; i < this.tracks_.length; i++) {
105 var trackClientRect = this.tracks_[i].getBoundingClientRect(); 105 var trackClientRect = this.tracks_[i].getBoundingClientRect();
106 var a = Math.max(loY, trackClientRect.top); 106 var a = Math.max(loY, trackClientRect.top);
107 var b = Math.min(hiY, trackClientRect.bottom); 107 var b = Math.min(hiY, trackClientRect.bottom);
108 if (a <= b) 108 if (a <= b)
109 this.tracks_[i].pickRange(loWX, hiWX, loY, hiY, onHitCallback); 109 this.tracks_[i].pickRange(loWX, hiWX, loY, hiY, onHitCallback);
110 } 110 }
111 },
112
113 /**
114 * @return {Array} Objects matching the given filter.
115 */
116 findAllObjectsMatchingFilter: function(filter) {
117 var hits = [];
118 for (var i = 0; i < this.tracks_.length; i++) {
119 var trackHits = this.tracks_[i].findAllObjectsMatchingFilter(filter);
120 Array.prototype.push.apply(hits, trackHits);
121 }
122 return hits;
111 } 123 }
112 }; 124 };
113 125
114 function addControlButtonElements(el, canCollapse) { 126 function addControlButtonElements(el, canCollapse) {
115 var closeEl = document.createElement('div'); 127 var closeEl = document.createElement('div');
116 closeEl.classList.add('timeline-track-button'); 128 closeEl.classList.add('timeline-track-button');
117 closeEl.classList.add('timeline-track-close-button'); 129 closeEl.classList.add('timeline-track-close-button');
118 closeEl.textContent = String.fromCharCode(215); // &times; 130 closeEl.textContent = String.fromCharCode(215); // &times;
119 closeEl.addEventListener('click', function() { 131 closeEl.addEventListener('click', function() {
120 el.style.display = 'None'; 132 el.style.display = 'None';
(...skipping 628 matching lines...) Expand 10 before | Expand all | Expand 10 after
749 * @param {slice} A slice. 761 * @param {slice} A slice.
750 * @return {slice} The previous slice, or undefined. 762 * @return {slice} The previous slice, or undefined.
751 */ 763 */
752 pickPrevious: function(slice) { 764 pickPrevious: function(slice) {
753 var index = this.indexOfSlice_(slice); 765 var index = this.indexOfSlice_(slice);
754 if (index == 0) 766 if (index == 0)
755 return undefined; 767 return undefined;
756 else if ((index != undefined) && (index > 0)) 768 else if ((index != undefined) && (index > 0))
757 index--; 769 index--;
758 return index != undefined ? this.slices_[index] : undefined; 770 return index != undefined ? this.slices_[index] : undefined;
771 },
772
773 findAllObjectsMatchingFilter: function(filter) {
774 var hits = [];
775 for (var i = 0; i < this.slices_.length; ++i)
776 if (filter.matchSlice(this.slices_[i]))
777 hits.push({track: this,
778 slice: this.slices_[i]});
779 return hits;
759 } 780 }
760
761 }; 781 };
762 782
763 /** 783 /**
764 * A track that displays the viewport size and scale. 784 * A track that displays the viewport size and scale.
765 * @constructor 785 * @constructor
766 * @extends {CanvasBasedTrack} 786 * @extends {CanvasBasedTrack}
767 */ 787 */
768 788
769 var TimelineViewportTrack = cr.ui.define(CanvasBasedTrack); 789 var TimelineViewportTrack = cr.ui.define(CanvasBasedTrack);
770 790
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
895 * @param {number} loY Lower Y bound of the interval to search, in 915 * @param {number} loY Lower Y bound of the interval to search, in
896 * offset space. 916 * offset space.
897 * @param {number} hiY Upper Y bound of the interval to search, in 917 * @param {number} hiY Upper Y bound of the interval to search, in
898 * offset space. 918 * offset space.
899 * @param {function():*} onHitCallback Function to call for each slice 919 * @param {function():*} onHitCallback Function to call for each slice
900 * intersecting the interval. 920 * intersecting the interval.
901 */ 921 */
902 pickRange: function(loWX, hiWX, loY, hiY, onHitCallback) { 922 pickRange: function(loWX, hiWX, loY, hiY, onHitCallback) {
903 // Does nothing. There's nothing interesting to pick on the viewport 923 // Does nothing. There's nothing interesting to pick on the viewport
904 // track. 924 // track.
925 },
926
927 findAllObjectsMatchingFilter: function(filter) {
928 return [];
905 } 929 }
906 930
907 }; 931 };
908 932
909 /** 933 /**
910 * A track that displays a TimelineCounter object. 934 * A track that displays a TimelineCounter object.
911 * @constructor 935 * @constructor
912 * @extends {CanvasBasedTrack} 936 * @extends {CanvasBasedTrack}
913 */ 937 */
914 938
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
1041 * @param {number} hiWX Upper X bound of the interval to search, in 1065 * @param {number} hiWX Upper X bound of the interval to search, in
1042 * worldspace. 1066 * worldspace.
1043 * @param {number} loY Lower Y bound of the interval to search, in 1067 * @param {number} loY Lower Y bound of the interval to search, in
1044 * offset space. 1068 * offset space.
1045 * @param {number} hiY Upper Y bound of the interval to search, in 1069 * @param {number} hiY Upper Y bound of the interval to search, in
1046 * offset space. 1070 * offset space.
1047 * @param {function():*} onHitCallback Function to call for each slice 1071 * @param {function():*} onHitCallback Function to call for each slice
1048 * intersecting the interval. 1072 * intersecting the interval.
1049 */ 1073 */
1050 pickRange: function(loWX, hiWX, loY, hiY, onHitCallback) { 1074 pickRange: function(loWX, hiWX, loY, hiY, onHitCallback) {
1075 },
1076
1077 findAllObjectsMatchingFilter: function(filter) {
1078 return [];
1051 } 1079 }
1052 1080
1053 }; 1081 };
1054 1082
1055 return { 1083 return {
1056 TimelineCounterTrack: TimelineCounterTrack, 1084 TimelineCounterTrack: TimelineCounterTrack,
1057 TimelineSliceTrack: TimelineSliceTrack, 1085 TimelineSliceTrack: TimelineSliceTrack,
1058 TimelineThreadTrack: TimelineThreadTrack, 1086 TimelineThreadTrack: TimelineThreadTrack,
1059 TimelineViewportTrack: TimelineViewportTrack, 1087 TimelineViewportTrack: TimelineViewportTrack,
1060 TimelineCpuTrack: TimelineCpuTrack 1088 TimelineCpuTrack: TimelineCpuTrack
1061 }; 1089 };
1062 }); 1090 });
OLDNEW
« no previous file with comments | « chrome/browser/resources/tracing/timeline_test.html ('k') | chrome/browser/resources/tracing/timeline_track_test.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698