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

Side by Side Diff: tracing/tracing/ui/tracks/letter_dot_track.html

Issue 2771723003: [tracing] Move math utilities from base into their own subdirectory (attempt 2) (Closed)
Patch Set: rebase Created 3 years, 9 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 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <!-- 2 <!--
3 Copyright (c) 2015 The Chromium Authors. All rights reserved. 3 Copyright (c) 2015 The Chromium Authors. All rights reserved.
4 Use of this source code is governed by a BSD-style license that can be 4 Use of this source code is governed by a BSD-style license that can be
5 found in the LICENSE file. 5 found in the LICENSE file.
6 --> 6 -->
7 7
8 <link rel="import" href="/tracing/base/color_scheme.html"> 8 <link rel="import" href="/tracing/base/color_scheme.html">
9 <link rel="import" href="/tracing/base/sorted_array_utils.html"> 9 <link rel="import" href="/tracing/base/math/sorted_array_utils.html">
10 <link rel="import" href="/tracing/model/proxy_selectable_item.html"> 10 <link rel="import" href="/tracing/model/proxy_selectable_item.html">
11 <link rel="import" href="/tracing/ui/base/event_presenter.html"> 11 <link rel="import" href="/tracing/ui/base/event_presenter.html">
12 <link rel="import" href="/tracing/ui/base/heading.html"> 12 <link rel="import" href="/tracing/ui/base/heading.html">
13 <link rel="import" href="/tracing/ui/base/ui.html"> 13 <link rel="import" href="/tracing/ui/base/ui.html">
14 <link rel="import" href="/tracing/ui/tracks/track.html"> 14 <link rel="import" href="/tracing/ui/tracks/track.html">
15 15
16 <style> 16 <style>
17 .letter-dot-track { 17 .letter-dot-track {
18 height: 18px; 18 height: 18px;
19 } 19 }
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 var halfHeight = height * 0.5; 98 var halfHeight = height * 0.5;
99 var twoPi = Math.PI * 2; 99 var twoPi = Math.PI * 2;
100 100
101 // Culling parameters. 101 // Culling parameters.
102 var dt = this.viewport.currentDisplayTransform; 102 var dt = this.viewport.currentDisplayTransform;
103 var dumpRadiusView = this.dumpRadiusView; 103 var dumpRadiusView = this.dumpRadiusView;
104 var itemRadiusWorld = dt.xViewVectorToWorld(height); 104 var itemRadiusWorld = dt.xViewVectorToWorld(height);
105 105
106 // Draw the memory dumps. 106 // Draw the memory dumps.
107 var items = this.items_; 107 var items = this.items_;
108 var loI = tr.b.findLowIndexInSortedArray( 108 var loI = tr.b.math.findLowIndexInSortedArray(
109 items, 109 items,
110 function(item) { return item.start; }, 110 function(item) { return item.start; },
111 viewLWorld); 111 viewLWorld);
112 112
113 var oldFont = ctx.font; 113 var oldFont = ctx.font;
114 ctx.font = '400 ' + Math.floor(9 * pixelRatio) + 'px Arial'; 114 ctx.font = '400 ' + Math.floor(9 * pixelRatio) + 'px Arial';
115 ctx.strokeStyle = 'rgb(0,0,0)'; 115 ctx.strokeStyle = 'rgb(0,0,0)';
116 ctx.textBaseline = 'middle'; 116 ctx.textBaseline = 'middle';
117 ctx.textAlign = 'center'; 117 ctx.textAlign = 'center';
118 118
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 item.addToTrackMap(eventToTrackMap, this); 168 item.addToTrackMap(eventToTrackMap, this);
169 }, this); 169 }, this);
170 }, 170 },
171 171
172 addIntersectingEventsInRangeToSelectionInWorldSpace: function( 172 addIntersectingEventsInRangeToSelectionInWorldSpace: function(
173 loWX, hiWX, viewPixWidthWorld, selection) { 173 loWX, hiWX, viewPixWidthWorld, selection) {
174 if (this.items_ === undefined) 174 if (this.items_ === undefined)
175 return; 175 return;
176 176
177 var itemRadiusWorld = viewPixWidthWorld * this.dumpRadiusView; 177 var itemRadiusWorld = viewPixWidthWorld * this.dumpRadiusView;
178 tr.b.iterateOverIntersectingIntervals( 178 tr.b.math.iterateOverIntersectingIntervals(
179 this.items_, 179 this.items_,
180 function(x) { return x.start - itemRadiusWorld; }, 180 function(x) { return x.start - itemRadiusWorld; },
181 function(x) { return 2 * itemRadiusWorld; }, 181 function(x) { return 2 * itemRadiusWorld; },
182 loWX, hiWX, 182 loWX, hiWX,
183 function(item) { 183 function(item) {
184 item.addToSelection(selection); 184 item.addToSelection(selection);
185 }.bind(this)); 185 }.bind(this));
186 }, 186 },
187 187
188 /** 188 /**
(...skipping 26 matching lines...) Expand all
215 }, 215 },
216 216
217 addAllEventsMatchingFilterToSelection: function(filter, selection) { 217 addAllEventsMatchingFilterToSelection: function(filter, selection) {
218 }, 218 },
219 219
220 addClosestEventToSelection: function(worldX, worldMaxDist, loY, hiY, 220 addClosestEventToSelection: function(worldX, worldMaxDist, loY, hiY,
221 selection) { 221 selection) {
222 if (this.items_ === undefined) 222 if (this.items_ === undefined)
223 return; 223 return;
224 224
225 var item = tr.b.findClosestElementInSortedArray( 225 var item = tr.b.math.findClosestElementInSortedArray(
226 this.items_, 226 this.items_,
227 function(x) { return x.start; }, 227 function(x) { return x.start; },
228 worldX, 228 worldX,
229 worldMaxDist); 229 worldMaxDist);
230 230
231 if (!item) 231 if (!item)
232 return; 232 return;
233 233
234 item.addToSelection(selection); 234 item.addToSelection(selection);
235 } 235 }
(...skipping 15 matching lines...) Expand all
251 LetterDot.prototype = { 251 LetterDot.prototype = {
252 __proto__: tr.model.ProxySelectableItem.prototype 252 __proto__: tr.model.ProxySelectableItem.prototype
253 }; 253 };
254 254
255 return { 255 return {
256 LetterDotTrack, 256 LetterDotTrack,
257 LetterDot, 257 LetterDot,
258 }; 258 };
259 }); 259 });
260 </script> 260 </script>
OLDNEW
« no previous file with comments | « tracing/tracing/ui/tracks/chart_series_y_axis_test.html ('k') | tracing/tracing/ui/tracks/model_track.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698