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

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

Issue 5228004: Switch the about:gpu implementation from an about handler to dom_ui.... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 10 years 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/info_view.js
===================================================================
--- chrome/browser/resources/gpu_internals/info_view.js (revision 0)
+++ chrome/browser/resources/gpu_internals/info_view.js (revision 0)
@@ -0,0 +1,113 @@
+// Copyright (c) 2010 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 options for importing/exporting the captured data. Its
+ * primarily usefulness is to allow users to copy-paste their data in an easy
+ * to read format for bug reports.
+ *
+ * - Has a button to generate a text report.
+ *
+ * - Shows how many events have been captured.
+ * @constructor
+ */
+function InfoView(mainBoxId) {
+ DivView.call(this, mainBoxId);
+
+ this.textDiv_ = document.getElementById('info-text');
+ this.gpuInfo_ = undefined;
+ this.clientInfo_ = undefined;
+
+ var self = this;
+
+ // This function begins a request for the ClientInfo. If it comes back
+ // as undefined, then we will issue the request again in 250ms.
+ function beginRequestClientInfo() {
+ g_browser.callAsync('requestClientInfo', undefined, function(data) {
+ self.clientInfo_ = data;
+ self.refresh_();
+ if(data === undefined) { // try again in 250 ms
+ window.setTimeout(beginRequestClientInfo, 250);
+ }
+ });
+ }
+ beginRequestClientInfo();
+
+ // This function begins a request for the GpuInfo. If it comes back
+ // as undefined, then we will issue the request again in 250ms.
+ function beginRequestGpuInfo() {
+ g_browser.callAsync('requestGpuInfo', undefined, function(data) {
+ self.gpuInfo_ = data;
+ self.refresh_();
+ if(data === undefined) { // try again in 250 ms
+ window.setTimeout(beginRequestGpuInfo, 250);
+ }
+ });
+ }
+ beginRequestGpuInfo();
+ this.refresh_();
+}
+
+inherits(InfoView, DivView);
arv (Not doing code reviews) 2010/12/03 22:19:20 Use __proto__ etc
nduca 2010/12/03 22:49:39 Done.
+
+/**
+* Updates the view based on its currently known data
+*/
+InfoView.prototype.refresh_ = function(data) {
+ var html = [];
+ function outputObject(obj) {
+ var all_values = true;
+ for (var k in obj) { // output values
+ var v = obj[k];
+ if(!(typeof(v) === 'number' || typeof(v) === "string")) {
+ all_values = false;
+ }
+ }
+ if (all_values)
+ html.push("<table class='border'>");
+ else
+ html.push("<table>");
+ for (var k in obj) { // output values
+ var v = obj[k];
+ if (typeof(v) === 'number' || typeof(v) === "string") {
+ html.push("<tr><td><strong>");
+ html.push(k);
+ html.push("</strong></td><td>");
+ html.push(v);
+ html.push("</td></tr>");
+ } else {
+ html.push("<tr><td colspan=2><strong>" + k + ":</strong>");
+ html.push("<div style=\"padding-left: 8px;\">");
+ outputObject(v);
+ html.push("</div>");
+ html.push("</td></tr>");
+ }
+ }
+ html.push("</table>");
+ }
+
+ html.push('<h2>Chrome information</h2>');
+ if (this.clientInfo_) {
+ var chromeVersion = this.clientInfo_.version +
+ ' (' + this.clientInfo_.official +
+ ' ' + this.clientInfo_.cl +
+ ') ' + this.clientInfo_.version_mod + "</p>";
+ var data = {'Data exported on' : (new Date()).toLocaleString(),
+ 'Chrome version: ' : chromeVersion};
+ outputObject(data);
+ } else {
+ html.push('... refreshing data ...');
+ }
+
+ html.push('<h2>GPU information</h2>');
+ if (this.gpuInfo_) {
+ outputObject(this.gpuInfo_);
+ } else {
+ html.push('... refreshing data ...');
+ }
+
+ // Open a new window to display this text.
+ this.textDiv_.innerHTML = html.join("\n");
+};
+
Property changes on: chrome/browser/resources/gpu_internals/info_view.js
___________________________________________________________________
Added: svn:eol-style
+ LF

Powered by Google App Engine
This is Rietveld 408576698