OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 | 5 |
6 /** | 6 /** |
7 * @fileoverview This view displays information on the current GPU | 7 * @fileoverview This view displays information on the current GPU |
8 * hardware. Its primary usefulness is to allow users to copy-paste | 8 * hardware. Its primary usefulness is to allow users to copy-paste |
9 * their data in an easy to read format for bug reports. | 9 * their data in an easy to read format for bug reports. |
10 */ | 10 */ |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 { | 83 { |
84 description: 'Software rendering list version', | 84 description: 'Software rendering list version', |
85 value: this.clientInfo_.blacklist_version | 85 value: this.clientInfo_.blacklist_version |
86 }]); | 86 }]); |
87 } else { | 87 } else { |
88 this.setText_('client-info', '... loading...'); | 88 this.setText_('client-info', '... loading...'); |
89 } | 89 } |
90 | 90 |
91 // GPU info, basic | 91 // GPU info, basic |
92 var diagnostics = this.querySelector('.diagnostics'); | 92 var diagnostics = this.querySelector('.diagnostics'); |
93 var blacklistedIndicator = this.querySelector('.blacklisted-indicator'); | 93 var featureStatusList = this.querySelector('.feature-status-list'); |
| 94 var problemsDiv = this.querySelector('.problems-div'); |
| 95 var problemsList = this.querySelector('.problems-list'); |
94 var gpuInfo = browserBridge.gpuInfo; | 96 var gpuInfo = browserBridge.gpuInfo; |
| 97 var i; |
95 if (gpuInfo) { | 98 if (gpuInfo) { |
96 if (gpuInfo.blacklistingReasons) { | 99 // Not using jstemplate here for blacklist status because we construct |
97 blacklistedIndicator.hidden = false; | 100 // href from data, which jstemplate can't seem to do. |
98 // Not using jstemplate here because we need to manipulate | 101 if (gpuInfo.blacklistStatus) { |
99 // href on the fly | 102 console.log(JSON.stringify(gpuInfo.blacklistStatus)); |
100 var reasonsEl = blacklistedIndicator.querySelector( | 103 // feature status list |
101 '.blacklisted-reasons'); | 104 featureStatusList.textContent = ''; |
102 reasonsEl.textContent = ''; | 105 for (i = 0; i < gpuInfo.blacklistStatus.featureStatus.length; |
103 for (var i = 0; i < gpuInfo.blacklistingReasons.length; i++) { | 106 i++) { |
104 var reason = gpuInfo.blacklistingReasons[i]; | 107 var feature = gpuInfo.blacklistStatus.featureStatus[i]; |
| 108 var featureEl = document.createElement('li'); |
105 | 109 |
106 var reasonEl = document.createElement('li'); | 110 var nameEl = document.createElement('span'); |
| 111 nameEl.textContent = feature.name + ': '; |
| 112 featureEl.appendChild(nameEl); |
107 | 113 |
108 // Description of issue | 114 var statusEl = document.createElement('span'); |
109 var desc = document.createElement('a'); | 115 statusEl.textContent = feature.enabled ? 'enabled' : 'disabled'; |
110 desc.textContent = reason.description; | 116 if (feature.enabled) |
111 reasonEl.appendChild(desc); | 117 statusEl.className = 'feature-enabled'; |
| 118 else |
| 119 statusEl.className = 'feature-disabled'; |
| 120 featureEl.appendChild(statusEl); |
112 | 121 |
113 // Spacing ':' element | 122 featureStatusList.appendChild(featureEl); |
114 if (reason.cr_bugs.length + reason.webkit_bugs.length > 0) { | 123 } |
115 var tmp = document.createElement('span'); | 124 |
116 tmp.textContent = ' '; | 125 // problems list |
117 reasonEl.appendChild(tmp); | 126 if (gpuInfo.blacklistStatus.problems.length) { |
| 127 problemsDiv.hidden = false; |
| 128 problemsList.textContent = ''; |
| 129 for (i = 0; i < gpuInfo.blacklistStatus.problems.length; i++) { |
| 130 var problem = gpuInfo.blacklistStatus.problems[i]; |
| 131 var problemEl = this.createProblemEl_(problem); |
| 132 problemsList.appendChild(problemEl); |
118 } | 133 } |
| 134 } else { |
| 135 problemsDiv.hidden = true; |
| 136 } |
119 | 137 |
120 var nreasons = 0; | |
121 var j; | |
122 // cr_bugs | |
123 for (j = 0; j < reason.cr_bugs.length; ++j) { | |
124 if (nreasons > 0) { | |
125 var tmp = document.createElement('span'); | |
126 tmp.textContent = ', '; | |
127 reasonEl.appendChild(tmp); | |
128 } | |
129 | |
130 var link = document.createElement('a'); | |
131 var bugid = parseInt(reason.cr_bugs[j]); | |
132 link.textContent = bugid; | |
133 link.href = 'http://crbug.com/' + bugid; | |
134 reasonEl.appendChild(link); | |
135 nreasons++; | |
136 } | |
137 | |
138 for (j = 0; j < reason.webkit_bugs.length; ++j) { | |
139 if (nreasons > 0) { | |
140 var tmp = document.createElement('span'); | |
141 tmp.textContent = ', '; | |
142 reasonEl.appendChild(tmp); | |
143 } | |
144 | |
145 var link = document.createElement('a'); | |
146 var bugid = parseInt(reason.webkit_bugs[j]); | |
147 link.textContent = bugid; | |
148 | |
149 link.href = 'https://bugs.webkit.org/show_bug.cgi?id=' + bugid; | |
150 reasonEl.appendChild(link); | |
151 nreasons++; | |
152 } | |
153 | |
154 reasonsEl.appendChild(reasonEl); | |
155 } | |
156 } else { | 138 } else { |
157 blacklistedIndicator.hidden = true; | 139 featureStatusList.textContent = ''; |
| 140 problemsList.hidden = true; |
158 } | 141 } |
159 this.setTable_('basic-info', gpuInfo.basic_info); | 142 this.setTable_('basic-info', gpuInfo.basic_info); |
160 | 143 |
161 if (gpuInfo.diagnostics) { | 144 if (gpuInfo.diagnostics) { |
162 diagnostics.hidden = false; | 145 diagnostics.hidden = false; |
163 this.setTable_('diagnostics-table', gpuInfo.diagnostics); | 146 this.setTable_('diagnostics-table', gpuInfo.diagnostics); |
164 } else { | 147 } else { |
165 diagnostics.hidden = true; | 148 diagnostics.hidden = true; |
166 } | 149 } |
167 } else { | 150 } else { |
168 blacklistedIndicator.hidden = true; | |
169 this.setText_('basic-info', '... loading ...'); | 151 this.setText_('basic-info', '... loading ...'); |
170 diagnostics.hidden = true; | 152 diagnostics.hidden = true; |
| 153 featureStatusList.textContent = ''; |
| 154 problemsDiv.hidden = true; |
171 } | 155 } |
172 | 156 |
173 // Log messages | 157 // Log messages |
174 if (!browserBridge.debugMode) { | 158 if (!browserBridge.debugMode) { |
175 jstProcess(new JsEvalContext({values: this.logMessages_}), | 159 jstProcess(new JsEvalContext({values: this.logMessages_}), |
176 document.getElementById('log-messages')); | 160 document.getElementById('log-messages')); |
177 } | 161 } |
178 }, | 162 }, |
179 | 163 |
| 164 createProblemEl_: function(problem) { |
| 165 var problemEl; |
| 166 problemEl = document.createElement('li'); |
| 167 |
| 168 // Description of issue |
| 169 var desc = document.createElement('a'); |
| 170 desc.textContent = problem.description; |
| 171 problemEl.appendChild(desc); |
| 172 |
| 173 // Spacing ':' element |
| 174 if (problem.crBugs.length + problem.webkitBugs.length > 0) { |
| 175 var tmp = document.createElement('span'); |
| 176 tmp.textContent = ' '; |
| 177 problemEl.appendChild(tmp); |
| 178 } |
| 179 |
| 180 var nbugs = 0; |
| 181 var j; |
| 182 |
| 183 // crBugs |
| 184 for (j = 0; j < problem.crBugs.length; ++j) { |
| 185 if (nbugs > 0) { |
| 186 var tmp = document.createElement('span'); |
| 187 tmp.textContent = ', '; |
| 188 problemEl.appendChild(tmp); |
| 189 } |
| 190 |
| 191 var link = document.createElement('a'); |
| 192 var bugid = parseInt(problem.crBugs[j]); |
| 193 link.textContent = bugid; |
| 194 link.href = 'http://crbug.com/' + bugid; |
| 195 problemEl.appendChild(link); |
| 196 nbugs++; |
| 197 } |
| 198 |
| 199 for (j = 0; j < problem.webkitBugs.length; ++j) { |
| 200 if (nbugs > 0) { |
| 201 var tmp = document.createElement('span'); |
| 202 tmp.textContent = ', '; |
| 203 problemEl.appendChild(tmp); |
| 204 } |
| 205 |
| 206 var link = document.createElement('a'); |
| 207 var bugid = parseInt(problem.webkitBugs[j]); |
| 208 link.textContent = bugid; |
| 209 |
| 210 link.href = 'https://bugs.webkit.org/show_bug.cgi?id=' + bugid; |
| 211 problemEl.appendChild(link); |
| 212 nbugs++; |
| 213 } |
| 214 |
| 215 return problemEl; |
| 216 }, |
| 217 |
180 setText_: function(outputElementId, text) { | 218 setText_: function(outputElementId, text) { |
181 var peg = document.getElementById(outputElementId); | 219 var peg = document.getElementById(outputElementId); |
182 peg.innerText = text; | 220 peg.innerText = text; |
183 }, | 221 }, |
184 | 222 |
185 setTable_: function(outputElementId, inputData) { | 223 setTable_: function(outputElementId, inputData) { |
186 var template = jstGetTemplate('info-view-table-template'); | 224 var template = jstGetTemplate('info-view-table-template'); |
187 jstProcess(new JsEvalContext({value: inputData}), | 225 jstProcess(new JsEvalContext({value: inputData}), |
188 template); | 226 template); |
189 | 227 |
190 var peg = document.getElementById(outputElementId); | 228 var peg = document.getElementById(outputElementId); |
191 if (!peg) | 229 if (!peg) |
192 throw new Error('Node ' + outputElementId + ' not found'); | 230 throw new Error('Node ' + outputElementId + ' not found'); |
193 | 231 |
194 peg.innerHTML = ''; | 232 peg.innerHTML = ''; |
195 peg.appendChild(template); | 233 peg.appendChild(template); |
196 } | 234 } |
197 }; | 235 }; |
198 | 236 |
199 return { | 237 return { |
200 InfoView: InfoView | 238 InfoView: InfoView |
201 }; | 239 }; |
202 }); | 240 }); |
OLD | NEW |