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

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

Issue 6691013: Introduce gpu_trace_event for gpu performance analysis. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Feedback updates Created 9 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 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..5ff981a8f54586d4605c2457546a716ea353acea
--- /dev/null
+++ b/chrome/browser/resources/gpu_internals/raw_events_view.js
@@ -0,0 +1,76 @@
+// 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.
+
+/**
+ *
+ * @fileoverview Displays the traced data in raw format. 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
+ * @extends {gpu.Tab}
+ */
+ var RawEventsView = cr.ui.define(gpu.Tab);
+
+ 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.onSelectedChange_);
+ this.refresh();
+ },
+
+ onSelectedChange_: function() {
+ if (this.selected) {
+ if (!tracingController.traceEvents.length) {
+ tracingController.beginTracing();
+ }
+ if (this.needsRefreshOnShow_) {
+ this.needsRefreshOnShow_ = false;
+ this.refresh();
+ }
+ }
+ },
+
+ /**
+ * Updates the view based on its currently known data
+ */
+ refresh: function() {
+ if (this.parentNode.selectedTab != this) {
+ this.needsRefreshOnShow_ = true;
+ }
+
+ var dataElement = this.querySelector('.raw-events-view-data');
+ if (tracingController.isTracingEnabled) {
+ var tmp = 'Still tracing. ' +
+ 'Uncheck the enable tracing button to see traced data.';
+ dataElement.textContent = tmp;
+ } else if (!tracingController.traceEvents.length) {
+ dataElement.textContent =
+ 'No trace data collected. Collect data first.';
+ } else {
+ var events = tracingController.traceEvents;
+ var text = JSON.stringify(events);
+ dataElement.textContent = 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