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

Unified Diff: chrome/browser/resources/gpu_internals/raw_events_view.js

Issue 6551019: Trace_event upgrades (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: More gooder js thanks to arv. Created 9 years, 10 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/resources/gpu_internals/raw_events_view.js
diff --git a/chrome/browser/resources/gpu_internals/raw_events_view.js b/chrome/browser/resources/gpu_internals/raw_events_view.js
new file mode 100644
index 0000000000000000000000000000000000000000..73f8eb17dfadb36fef2a3f3df83f05ab15803d4f
--- /dev/null
+++ b/chrome/browser/resources/gpu_internals/raw_events_view.js
@@ -0,0 +1,73 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+/**
+ * This view displays the traced data. Its primarily usefulness is to
+ * allow users to copy-paste their data in an easy to read format for
+ * bug reports.
+ *
+ */
+cr.define('gpu', function() {
+ /**
+ * Provides information on the GPU process and underlying graphics hardware.
+ * @constructor
+ */
+ RawEventsView = cr.ui.define(gpu.Tab);
arv (Not doing code reviews) 2011/02/25 00:51:29 missing var
+
+ RawEventsView.prototype = {
+ __proto__: gpu.Tab.prototype,
+
+ decorate : function() {
+ tracingController.addEventListener('traceBegun', this.refresh.bind(this));
+ tracingController.addEventListener('traceEnded', this.refresh.bind(this));
+ this.addEventListener('selectedChange', this.on_selected_change_);
+ this.refresh();
+ },
+
+ on_selected_change_ : function() {
arv (Not doing code reviews) 2011/02/25 00:51:29 no underscores
+ if (this.selected) {
+ if (tracingController.traceEvents.length == 0) {
+ tracingController.beginTracing();
+ }
+ if (this.needsRefreshOnShow_) {
+ this.needsRefreshOnShow_ = false;
+ this.refresh();
+ }
+ }
+ },
+
+ /**
+ * Updates the view based on its currently known data
+ */
+ refresh: function(data) {
+ if (this.parentNode.selectedTab != this) {
+ this.needsRefreshOnShow_ = true;
+ }
+
+ var dataElement = $('raw-events-view-data');
+ if (tracingController.isTracingEnabled) {
+ var tmp = "Still tracing.";
arv (Not doing code reviews) 2011/02/25 00:51:29 use singel quotes
+ tmp += " Uncheck the enable tracing button to see traced data.";
+ dataElement.innerText = tmp;
arv (Not doing code reviews) 2011/02/25 00:51:29 dataelement.textContent = '...' + '...';
+ } else if (!tracingController.traceEvents.length) {
+ 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
+ } else {
+ var events = tracingController.traceEvents;
+ var text = JSON.stringify(events);
+ dataElement.innerText = text;
+
+ var selection = window.getSelection();
+ selection.removeAllRanges();
+ var range = document.createRange();
+ range.selectNodeContents(dataElement);
+ selection.addRange(range);
+ }
+ }
+
+ };
+
+ return {
+ RawEventsView: RawEventsView
+ };
+});

Powered by Google App Engine
This is Rietveld 408576698