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,112 @@ |
+// 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. |
+ */ |
+cr.define('gpu', function() { |
+ /** |
+ * Provides information on the GPU process and underlying graphics hardware. |
+ * @constructor |
+ */ |
+ function InfoView(mainBoxId) { |
+ DivView.call(this, mainBoxId); |
+ |
+ this.textDiv_ = document.getElementById('info-text'); |
arv (Not doing code reviews)
2010/12/08 17:55:19
Can you pass this in? Binding this global element
nduca
2010/12/08 19:08:22
Not even used. Deleted. Haha.
On 2010/12/08 17:55
|
+ this.gpuInfo_ = undefined; |
arv (Not doing code reviews)
2010/12/08 17:55:19
Most likely useless statement
nduca
2010/12/08 19:08:22
Done.
|
+ this.clientInfo_ = undefined; |
+ |
+ var self = this; |
arv (Not doing code reviews)
2010/12/08 17:55:19
self is not used
nduca
2010/12/08 19:08:22
Done.
|
+ |
+ this.beginRequestClientInfo(); |
+ this.beginRequestGpuInfo(); |
+ this.refresh(); |
+ } |
+ |
+ InfoView.prototype = { |
+ __proto__: DivView.prototype, |
+ |
+ /** |
+ * This function begins a request for the ClientInfo. If it comes back |
+ * as undefined, then we will issue the request again in 250ms. |
+ */ |
+ beginRequestClientInfo : function() { |
+ browserBridge.callAsync('requestClientInfo', undefined, (function(data) { |
+ this.clientInfo_ = data; |
+ this.refresh(); |
+ if(data === undefined) { // try again in 250 ms |
arv (Not doing code reviews)
2010/12/08 17:55:19
whitespace after if
nduca
2010/12/08 19:08:22
Done.
|
+ window.setTimeout(this.beginRequestClientInfo.bind(this), 250); |
+ } |
+ }).bind(this)); |
+ }, |
+ |
+ /** |
+ * This function begins a request for the GpuInfo. If it comes back |
+ * as undefined, then we will issue the request again in 250ms. |
+ */ |
+ beginRequestGpuInfo : function() { |
+ browserBridge.callAsync('requestGpuInfo', undefined, (function(data) { |
+ this.gpuInfo_ = data; |
+ this.refresh(); |
+ if(data === undefined) { // try again in 250 ms |
+ window.setTimeout(this.beginRequestGpuInfo.bind(this), 250); |
+ } |
+ }).bind(this)); |
+ }, |
+ |
+ /** |
+ * Updates the view based on its currently known data |
+ */ |
+ refresh: function(data) { |
+ // Client info |
+ if (this.clientInfo_) { |
+ var chromeVersion = this.clientInfo_.version + |
+ ' (' + this.clientInfo_.official + |
+ ' ' + this.clientInfo_.cl + |
+ ') ' + this.clientInfo_.version_mod; |
+ this.updateTable_('client-info', [ |
+ {description: 'Data exported', |
arv (Not doing code reviews)
2010/12/08 17:55:19
{
key: value,
...
}
nduca
2010/12/08 19:08:22
Done.
|
+ value: (new Date()).toLocaleString()}, |
+ {description: 'Chrome version', value: chromeVersion}]); |
+ } else { |
+ this.updateTable_('client-info', [ |
+ {description: "", value: "... loading..."}]); |
+ } |
+ |
+ // GPU info, basic |
+ if (this.gpuInfo_) { |
+ this.updateTable_('basic-info', this.gpuInfo_.basic_info); |
+ if(this.gpuInfo_.diagnostics) { |
+ this.updateTable_('diagnostics', this.gpuInfo_.diagnostics); |
+ } |
+ } else { |
+ this.updateTable_('basic-info', [ |
+ {description: "", value: "... loading..."}]); |
+ } |
+ }, |
+ |
+ updateTable_: function(outputElementId,inputData) { |
+ var template = jstGetTemplate('info-view-table-template'); |
+ jstProcess(new JsEvalContext({value: inputData}), |
+ template); |
+ |
+ var peg = document.getElementById(outputElementId); |
+ if(!peg) |
+ throw new Error('Node ' + outputElementId + ' not found'); |
+ |
+ peg.innerHTML = ''; |
+ peg.appendChild(template); |
+ } |
+ }; |
+ |
+ return { |
+ InfoView: InfoView |
+ }; |
+}); |
Property changes on: chrome/browser/resources/gpu_internals/info_view.js |
___________________________________________________________________ |
Added: svn:eol-style |
+ LF |