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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
Property Changes:
Added: svn:eol-style
+ LF
OLDNEW
(Empty)
1 // Copyright (c) 2010 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 options for importing/exporting the captured data. Its
7 * primarily usefulness is to allow users to copy-paste their data in an easy
8 * to read format for bug reports.
9 *
10 * - Has a button to generate a text report.
11 *
12 * - Shows how many events have been captured.
13 */
14 cr.define('gpu', function() {
15 /**
16 * Provides information on the GPU process and underlying graphics hardware.
17 * @constructor
18 */
19 function InfoView(mainBoxId) {
20 DivView.call(this, mainBoxId);
21
22 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
23 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.
24 this.clientInfo_ = undefined;
25
26 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.
27
28 this.beginRequestClientInfo();
29 this.beginRequestGpuInfo();
30 this.refresh();
31 }
32
33 InfoView.prototype = {
34 __proto__: DivView.prototype,
35
36 /**
37 * This function begins a request for the ClientInfo. If it comes back
38 * as undefined, then we will issue the request again in 250ms.
39 */
40 beginRequestClientInfo : function() {
41 browserBridge.callAsync('requestClientInfo', undefined, (function(data) {
42 this.clientInfo_ = data;
43 this.refresh();
44 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.
45 window.setTimeout(this.beginRequestClientInfo.bind(this), 250);
46 }
47 }).bind(this));
48 },
49
50 /**
51 * This function begins a request for the GpuInfo. If it comes back
52 * as undefined, then we will issue the request again in 250ms.
53 */
54 beginRequestGpuInfo : function() {
55 browserBridge.callAsync('requestGpuInfo', undefined, (function(data) {
56 this.gpuInfo_ = data;
57 this.refresh();
58 if(data === undefined) { // try again in 250 ms
59 window.setTimeout(this.beginRequestGpuInfo.bind(this), 250);
60 }
61 }).bind(this));
62 },
63
64 /**
65 * Updates the view based on its currently known data
66 */
67 refresh: function(data) {
68 // Client info
69 if (this.clientInfo_) {
70 var chromeVersion = this.clientInfo_.version +
71 ' (' + this.clientInfo_.official +
72 ' ' + this.clientInfo_.cl +
73 ') ' + this.clientInfo_.version_mod;
74 this.updateTable_('client-info', [
75 {description: 'Data exported',
arv (Not doing code reviews) 2010/12/08 17:55:19 { key: value, ... }
nduca 2010/12/08 19:08:22 Done.
76 value: (new Date()).toLocaleString()},
77 {description: 'Chrome version', value: chromeVersion}]);
78 } else {
79 this.updateTable_('client-info', [
80 {description: "", value: "... loading..."}]);
81 }
82
83 // GPU info, basic
84 if (this.gpuInfo_) {
85 this.updateTable_('basic-info', this.gpuInfo_.basic_info);
86 if(this.gpuInfo_.diagnostics) {
87 this.updateTable_('diagnostics', this.gpuInfo_.diagnostics);
88 }
89 } else {
90 this.updateTable_('basic-info', [
91 {description: "", value: "... loading..."}]);
92 }
93 },
94
95 updateTable_: function(outputElementId,inputData) {
96 var template = jstGetTemplate('info-view-table-template');
97 jstProcess(new JsEvalContext({value: inputData}),
98 template);
99
100 var peg = document.getElementById(outputElementId);
101 if(!peg)
102 throw new Error('Node ' + outputElementId + ' not found');
103
104 peg.innerHTML = '';
105 peg.appendChild(template);
106 }
107 };
108
109 return {
110 InfoView: InfoView
111 };
112 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698