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

Side by Side Diff: chrome/browser/resources/tracing/profiling_view.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 'use strict'; 5 'use strict';
6 6
7 /** 7 /**
8 * @fileoverview ProfilingView visualizes TRACE_EVENT events using the 8 * @fileoverview ProfilingView glues the TimelineView control to
9 * tracing.Timeline component. 9 * TracingController.
10 */ 10 */
11 cr.define('tracing', function() { 11 cr.define('tracing', function() {
12 /** 12 /**
13 * ProfilingView 13 * ProfilingView
14 * @constructor 14 * @constructor
15 * @extends {ui.TabPanel} 15 * @extends {ui.TabPanel}
16 */ 16 */
17 var ProfilingView = cr.ui.define(cr.ui.TabPanel); 17 var ProfilingView = cr.ui.define(cr.ui.TabPanel);
18 18
19 ProfilingView.prototype = { 19 ProfilingView.prototype = {
20 __proto__: cr.ui.TabPanel.prototype, 20 __proto__: cr.ui.TabPanel.prototype,
21 21
22 traceEvents_: [], 22 traceEvents_: [],
23 systemTraceEvents_: [], 23 systemTraceEvents_: [],
24 24
25 decorate: function() { 25 decorate: function() {
26 cr.ui.TabPanel.prototype.decorate.apply(this); 26 cr.ui.TabPanel.prototype.decorate.apply(this);
27 this.classList.add('profiling-view'); 27 this.classList.add('profiling-view');
28 28
29 // make the <list>/add/save/record element 29 // make the <list>/add/save/record element
30 this.controlDiv_ = document.createElement('div');
31 this.controlDiv_.className = 'control';
32 this.appendChild(this.controlDiv_);
33
34 var tracingEl = document.createElement('span');
35 tracingEl.textContent = 'Tracing: ';
36
37 this.recordBn_ = document.createElement('button'); 30 this.recordBn_ = document.createElement('button');
38 this.recordBn_.className = 'record'; 31 this.recordBn_.className = 'record';
39 this.recordBn_.textContent = 'Record'; 32 this.recordBn_.textContent = 'Record';
40 this.recordBn_.addEventListener('click', this.onRecord_.bind(this)); 33 this.recordBn_.addEventListener('click', this.onRecord_.bind(this));
41 34
42 this.saveBn_ = document.createElement('button'); 35 this.saveBn_ = document.createElement('button');
43 this.saveBn_.textContent = 'Save'; 36 this.saveBn_.textContent = 'Save';
44 this.saveBn_.addEventListener('click', this.onSave_.bind(this)); 37 this.saveBn_.addEventListener('click', this.onSave_.bind(this));
45 38
46 this.loadBn_ = document.createElement('button'); 39 this.loadBn_ = document.createElement('button');
47 this.loadBn_.textContent = 'Load'; 40 this.loadBn_.textContent = 'Load';
48 this.loadBn_.addEventListener('click', this.onLoad_.bind(this)); 41 this.loadBn_.addEventListener('click', this.onLoad_.bind(this));
49 42
50 this.container_ = document.createElement('div');
51 this.container_.className = 'container';
52
53 this.timelineView_ = new tracing.TimelineView();
54
55 this.controlDiv_.appendChild(tracingEl);
56 this.controlDiv_.appendChild(this.recordBn_);
57 this.controlDiv_.appendChild(this.loadBn_);
58 this.controlDiv_.appendChild(this.saveBn_);
59
60 if (cr.isChromeOS) { 43 if (cr.isChromeOS) {
61 this.systemTracingBn_ = document.createElement('input'); 44 this.systemTracingBn_ = document.createElement('input');
62 this.systemTracingBn_.type = 'checkbox'; 45 this.systemTracingBn_.type = 'checkbox';
63 this.systemTracingBn_.checked = true; 46 this.systemTracingBn_.checked = true;
64 47
65 var systemTracingLabelEl = document.createElement('div'); 48 var systemTracingLabelEl = document.createElement('div');
66 systemTracingLabelEl.className = 'label'; 49 systemTracingLabelEl.className = 'label';
67 systemTracingLabelEl.textContent = 'System events'; 50 systemTracingLabelEl.textContent = 'System events';
68 systemTracingLabelEl.appendChild(this.systemTracingBn_); 51 systemTracingLabelEl.appendChild(this.systemTracingBn_);
69
70 this.controlDiv_.appendChild(systemTracingLabelEl);
71 } 52 }
72 53
73 this.container_.appendChild(this.timelineView_); 54 this.timelineView_ = new tracing.TimelineView();
74 this.appendChild(this.container_); 55 this.timelineView_.leftControls.appendChild(this.recordBn_);
56 this.timelineView_.leftControls.appendChild(this.saveBn_);
57 this.timelineView_.leftControls.appendChild(this.loadBn_);
58 if (cr.isChromeOS)
59 this.timelineView_.leftControls.appendChild(this.systemTracingBn_);
60
61 this.appendChild(this.timelineView_);
75 62
76 document.addEventListener('keypress', this.onKeypress_.bind(this)); 63 document.addEventListener('keypress', this.onKeypress_.bind(this));
77 64
78 this.refresh_(); 65 this.refresh_();
79 }, 66 },
80 67
81 didSetTracingController_: function(value, oldValue) { 68 didSetTracingController_: function(value, oldValue) {
82 if (oldValue) 69 if (oldValue)
83 throw 'Can only set tracing controller once.'; 70 throw 'Can only set tracing controller once.';
84 71
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 } 177 }
191 }; 178 };
192 179
193 cr.defineProperty(ProfilingView, 'tracingController', cr.PropertyKind.JS, 180 cr.defineProperty(ProfilingView, 'tracingController', cr.PropertyKind.JS,
194 ProfilingView.prototype.didSetTracingController_); 181 ProfilingView.prototype.didSetTracingController_);
195 182
196 return { 183 return {
197 ProfilingView: ProfilingView 184 ProfilingView: ProfilingView
198 }; 185 };
199 }); 186 });
OLDNEW
« no previous file with comments | « chrome/browser/resources/tracing/profiling_view.css ('k') | chrome/browser/resources/tracing/profiling_view_test.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698