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

Side by Side Diff: tracing/tracing/model/object_instance.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) 2013 The Chromium Authors. All rights reserved. 3 Copyright (c) 2013 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/range.html"> 8 <link rel="import" href="/tracing/base/math/range.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/event.html"> 10 <link rel="import" href="/tracing/model/event.html">
11 <link rel="import" href="/tracing/model/object_snapshot.html"> 11 <link rel="import" href="/tracing/model/object_snapshot.html">
12 12
13 <script> 13 <script>
14 'use strict'; 14 'use strict';
15 15
16 /** 16 /**
17 * @fileoverview Provides the ObjectSnapshot and ObjectHistory classes. 17 * @fileoverview Provides the ObjectSnapshot and ObjectHistory classes.
18 */ 18 */
19 tr.exportTo('tr.model', function() { 19 tr.exportTo('tr.model', function() {
(...skipping 11 matching lines...) Expand all
31 this.parent = parent; 31 this.parent = parent;
32 this.scopedId = scopedId; 32 this.scopedId = scopedId;
33 this.category = category; 33 this.category = category;
34 this.baseTypeName = opt_baseTypeName ? opt_baseTypeName : name; 34 this.baseTypeName = opt_baseTypeName ? opt_baseTypeName : name;
35 this.name = name; 35 this.name = name;
36 this.creationTs = creationTs; 36 this.creationTs = creationTs;
37 this.creationTsWasExplicit = false; 37 this.creationTsWasExplicit = false;
38 this.deletionTs = Number.MAX_VALUE; 38 this.deletionTs = Number.MAX_VALUE;
39 this.deletionTsWasExplicit = false; 39 this.deletionTsWasExplicit = false;
40 this.colorId = 0; 40 this.colorId = 0;
41 this.bounds = new tr.b.Range(); 41 this.bounds = new tr.b.math.Range();
42 this.snapshots = []; 42 this.snapshots = [];
43 this.hasImplicitSnapshots = false; 43 this.hasImplicitSnapshots = false;
44 } 44 }
45 45
46 ObjectInstance.prototype = { 46 ObjectInstance.prototype = {
47 __proto__: tr.model.Event.prototype, 47 __proto__: tr.model.Event.prototype,
48 48
49 get typeName() { 49 get typeName() {
50 return this.name; 50 return this.name;
51 }, 51 },
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 getSnapshotAt: function(ts) { 131 getSnapshotAt: function(ts) {
132 if (ts < this.creationTs) { 132 if (ts < this.creationTs) {
133 if (this.creationTsWasExplicit) 133 if (this.creationTsWasExplicit)
134 throw new Error('ts must be within lifetime of this instance'); 134 throw new Error('ts must be within lifetime of this instance');
135 return this.snapshots[0]; 135 return this.snapshots[0];
136 } 136 }
137 if (ts > this.deletionTs) 137 if (ts > this.deletionTs)
138 throw new Error('ts must be within lifetime of this instance'); 138 throw new Error('ts must be within lifetime of this instance');
139 139
140 var snapshots = this.snapshots; 140 var snapshots = this.snapshots;
141 var i = tr.b.findIndexInSortedIntervals( 141 var i = tr.b.math.findIndexInSortedIntervals(
142 snapshots, 142 snapshots,
143 function(snapshot) { return snapshot.ts; }, 143 function(snapshot) { return snapshot.ts; },
144 function(snapshot, i) { 144 function(snapshot, i) {
145 if (i === snapshots.length - 1) 145 if (i === snapshots.length - 1)
146 return snapshots[i].objectInstance.deletionTs; 146 return snapshots[i].objectInstance.deletionTs;
147 return snapshots[i + 1].ts - snapshots[i].ts; 147 return snapshots[i + 1].ts - snapshots[i].ts;
148 }, 148 },
149 ts); 149 ts);
150 if (i < 0) { 150 if (i < 0) {
151 // Note, this is a little bit sketchy: this lets early ts point at the 151 // Note, this is a little bit sketchy: this lets early ts point at the
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 { 188 {
189 name: 'objectInstance', 189 name: 'objectInstance',
190 pluralName: 'objectInstances' 190 pluralName: 'objectInstances'
191 }); 191 });
192 192
193 return { 193 return {
194 ObjectInstance, 194 ObjectInstance,
195 }; 195 };
196 }); 196 });
197 </script> 197 </script>
OLDNEW
« no previous file with comments | « tracing/tracing/model/object_collection.html ('k') | tracing/tracing/model/power_sample_test.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698