Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 /** | |
| 6 * This view displays the traced data. Its primarily usefulness is to | |
| 7 * allow users to copy-paste their data in an easy to read format for | |
| 8 * bug reports. | |
| 9 * | |
| 10 */ | |
| 11 cr.define('gpu', function() { | |
| 12 /** | |
| 13 * Provides information on the GPU process and underlying graphics hardware. | |
| 14 * @constructor | |
| 15 */ | |
| 16 RawEventsView = cr.ui.define(gpu.Tab); | |
|
arv (Not doing code reviews)
2011/02/25 00:51:29
missing var
| |
| 17 | |
| 18 RawEventsView.prototype = { | |
| 19 __proto__: gpu.Tab.prototype, | |
| 20 | |
| 21 decorate : function() { | |
| 22 tracingController.addEventListener('traceBegun', this.refresh.bind(this)); | |
| 23 tracingController.addEventListener('traceEnded', this.refresh.bind(this)); | |
| 24 this.addEventListener('selectedChange', this.on_selected_change_); | |
| 25 this.refresh(); | |
| 26 }, | |
| 27 | |
| 28 on_selected_change_ : function() { | |
|
arv (Not doing code reviews)
2011/02/25 00:51:29
no underscores
| |
| 29 if (this.selected) { | |
| 30 if (tracingController.traceEvents.length == 0) { | |
| 31 tracingController.beginTracing(); | |
| 32 } | |
| 33 if (this.needsRefreshOnShow_) { | |
| 34 this.needsRefreshOnShow_ = false; | |
| 35 this.refresh(); | |
| 36 } | |
| 37 } | |
| 38 }, | |
| 39 | |
| 40 /** | |
| 41 * Updates the view based on its currently known data | |
| 42 */ | |
| 43 refresh: function(data) { | |
| 44 if (this.parentNode.selectedTab != this) { | |
| 45 this.needsRefreshOnShow_ = true; | |
| 46 } | |
| 47 | |
| 48 var dataElement = $('raw-events-view-data'); | |
| 49 if (tracingController.isTracingEnabled) { | |
| 50 var tmp = "Still tracing."; | |
|
arv (Not doing code reviews)
2011/02/25 00:51:29
use singel quotes
| |
| 51 tmp += " Uncheck the enable tracing button to see traced data."; | |
| 52 dataElement.innerText = tmp; | |
|
arv (Not doing code reviews)
2011/02/25 00:51:29
dataelement.textContent = '...' +
'...';
| |
| 53 } else if (!tracingController.traceEvents.length) { | |
| 54 dataElement.innerText = "No trace data collected. Collect data first."; | |
|
arv (Not doing code reviews)
2011/02/25 00:51:29
In general use textContent. innerText does a lot o
| |
| 55 } else { | |
| 56 var events = tracingController.traceEvents; | |
| 57 var text = JSON.stringify(events); | |
| 58 dataElement.innerText = text; | |
| 59 | |
| 60 var selection = window.getSelection(); | |
| 61 selection.removeAllRanges(); | |
| 62 var range = document.createRange(); | |
| 63 range.selectNodeContents(dataElement); | |
| 64 selection.addRange(range); | |
| 65 } | |
| 66 } | |
| 67 | |
| 68 }; | |
| 69 | |
| 70 return { | |
| 71 RawEventsView: RawEventsView | |
| 72 }; | |
| 73 }); | |
| OLD | NEW |