| 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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 }, | 52 }, |
| 53 { | 53 { |
| 54 description: 'Software rendering list version', | 54 description: 'Software rendering list version', |
| 55 value: clientInfo.blacklist_version | 55 value: clientInfo.blacklist_version |
| 56 }]); | 56 }]); |
| 57 } else { | 57 } else { |
| 58 this.setText_('client-info', '... loading...'); | 58 this.setText_('client-info', '... loading...'); |
| 59 } | 59 } |
| 60 | 60 |
| 61 // Feature map | 61 // Feature map |
| 62 var featureNameMap = { | 62 var featureLabelMap = { |
| 63 'accelerated_2d_canvas': 'Canvas', | 63 '2d_canvas': 'Canvas', |
| 64 'accelerated_compositing': '3D CSS', | 64 '3d_css': '3D CSS', |
| 65 'compositing': 'Compositing', |
| 65 'webgl': 'WebGL', | 66 'webgl': 'WebGL', |
| 66 'multisampling': 'WebGL multisampling' | 67 'multisampling': 'WebGL multisampling' |
| 67 }; | 68 }; |
| 69 var statusLabelMap = { |
| 70 'disabled_software': 'Software only. Hardware acceleration disabled.', |
| 71 'disabled_off': 'Unavailable. Hardware acceleration disabled.', |
| 72 'software': 'Software rendered. Hardware acceleration not enabled.', |
| 73 'unavailable_off': 'Unavailable. Hardware acceleration unavailable', |
| 74 'unavailable_software': |
| 75 'Software only, hardware acceleration unavailable', |
| 76 'enabled': 'Hardware accelerated' |
| 77 }; |
| 78 var statusClassMap = { |
| 79 'disabled_software': 'feature-yellow', |
| 80 'disabled_off': 'feature-red', |
| 81 'software': 'feature-yellow', |
| 82 'unavailable_off': 'feature-red', |
| 83 'unavailable_software': 'feature-yellow', |
| 84 'enabled': 'feature-green' |
| 85 }; |
| 68 | 86 |
| 69 // GPU info, basic | 87 // GPU info, basic |
| 70 var diagnostics = this.querySelector('.diagnostics'); | 88 var diagnostics = this.querySelector('.diagnostics'); |
| 71 var featureStatusList = this.querySelector('.feature-status-list'); | 89 var featureStatusList = this.querySelector('.feature-status-list'); |
| 72 var problemsDiv = this.querySelector('.problems-div'); | 90 var problemsDiv = this.querySelector('.problems-div'); |
| 73 var problemsList = this.querySelector('.problems-list'); | 91 var problemsList = this.querySelector('.problems-list'); |
| 74 var gpuInfo = browserBridge.gpuInfo; | 92 var gpuInfo = browserBridge.gpuInfo; |
| 75 var i; | 93 var i; |
| 76 if (gpuInfo) { | 94 if (gpuInfo) { |
| 77 // Not using jstemplate here for blacklist status because we construct | 95 // Not using jstemplate here for blacklist status because we construct |
| 78 // href from data, which jstemplate can't seem to do. | 96 // href from data, which jstemplate can't seem to do. |
| 79 if (gpuInfo.featureStatus) { | 97 if (gpuInfo.featureStatus) { |
| 80 // feature status list | 98 // feature status list |
| 81 featureStatusList.textContent = ''; | 99 featureStatusList.textContent = ''; |
| 82 for (i = 0; i < gpuInfo.featureStatus.featureStatus.length; | 100 for (i = 0; i < gpuInfo.featureStatus.featureStatus.length; |
| 83 i++) { | 101 i++) { |
| 84 var feature = gpuInfo.featureStatus.featureStatus[i]; | 102 var feature = gpuInfo.featureStatus.featureStatus[i]; |
| 85 var featureEl = document.createElement('li'); | 103 var featureEl = document.createElement('li'); |
| 86 | 104 |
| 87 var nameEl = document.createElement('span'); | 105 var nameEl = document.createElement('span'); |
| 88 nameEl.textContent = featureNameMap[feature.name] + ': '; | 106 if (!featureLabelMap[feature.name]) |
| 107 console.log('Missing featureLabel for', feature.name); |
| 108 nameEl.textContent = featureLabelMap[feature.name] + ': '; |
| 89 featureEl.appendChild(nameEl); | 109 featureEl.appendChild(nameEl); |
| 90 | 110 |
| 91 var statusEl = document.createElement('span'); | 111 var statusEl = document.createElement('span'); |
| 92 if (feature.status == 'enabled') { | 112 if (!statusLabelMap[feature.status]) |
| 93 statusEl.textContent = 'enabled'; | 113 console.log('Missing statusLabel for', feature.status); |
| 94 statusEl.className = 'feature-enabled'; | 114 if (!statusClassMap[feature.status]) |
| 95 } else if (feature.status == 'software') { | 115 console.log('Missing statusClass for', feature.status); |
| 96 statusEl.textContent = 'software only'; | 116 statusEl.textContent = statusLabelMap[feature.status]; |
| 97 statusEl.className = 'feature-software'; | 117 statusEl.className = statusClassMap[feature.status]; |
| 98 } else if (feature.status == 'unavailable') { | |
| 99 statusEl.textContent = 'unavailable'; | |
| 100 statusEl.className = 'feature-disabled'; | |
| 101 } else { // disabled | |
| 102 statusEl.textContent = 'disabled'; | |
| 103 statusEl.className = 'feature-disabled'; | |
| 104 } | |
| 105 featureEl.appendChild(statusEl); | 118 featureEl.appendChild(statusEl); |
| 106 | 119 |
| 107 featureStatusList.appendChild(featureEl); | 120 featureStatusList.appendChild(featureEl); |
| 108 } | 121 } |
| 109 | 122 |
| 110 // problems list | 123 // problems list |
| 111 if (gpuInfo.featureStatus.problems.length) { | 124 if (gpuInfo.featureStatus.problems.length) { |
| 112 problemsDiv.hidden = false; | 125 problemsDiv.hidden = false; |
| 113 problemsList.textContent = ''; | 126 problemsList.textContent = ''; |
| 114 for (i = 0; i < gpuInfo.featureStatus.problems.length; i++) { | 127 for (i = 0; i < gpuInfo.featureStatus.problems.length; i++) { |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 217 | 230 |
| 218 peg.innerHTML = ''; | 231 peg.innerHTML = ''; |
| 219 peg.appendChild(template); | 232 peg.appendChild(template); |
| 220 } | 233 } |
| 221 }; | 234 }; |
| 222 | 235 |
| 223 return { | 236 return { |
| 224 InfoView: InfoView | 237 InfoView: InfoView |
| 225 }; | 238 }; |
| 226 }); | 239 }); |
| OLD | NEW |