OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 | 55 |
56 this._sortedCategories = []; | 56 this._sortedCategories = []; |
57 | 57 |
58 this._headerElement = createElement("h1"); | 58 this._headerElement = createElement("h1"); |
59 this._headerElement.className = "no-audits"; | 59 this._headerElement.className = "no-audits"; |
60 this._headerElement.textContent = WebInspector.UIString("No audits to run"); | 60 this._headerElement.textContent = WebInspector.UIString("No audits to run"); |
61 this._contentElement.appendChild(this._headerElement); | 61 this._contentElement.appendChild(this._headerElement); |
62 | 62 |
63 WebInspector.targetManager.addModelListener(WebInspector.NetworkManager, Web
Inspector.NetworkManager.EventTypes.RequestStarted, this._onRequestStarted, this
); | 63 WebInspector.targetManager.addModelListener(WebInspector.NetworkManager, Web
Inspector.NetworkManager.EventTypes.RequestStarted, this._onRequestStarted, this
); |
64 WebInspector.targetManager.addModelListener(WebInspector.NetworkManager, Web
Inspector.NetworkManager.EventTypes.RequestFinished, this._onRequestFinished, th
is); | 64 WebInspector.targetManager.addModelListener(WebInspector.NetworkManager, Web
Inspector.NetworkManager.EventTypes.RequestFinished, this._onRequestFinished, th
is); |
65 WebInspector.profilingLock().addEventListener(WebInspector.Lock.Events.State
Changed, this._updateButton, this); | |
66 | 65 |
67 var defaultSelectedAuditCategory = {}; | 66 var defaultSelectedAuditCategory = {}; |
68 defaultSelectedAuditCategory[WebInspector.AuditLauncherView.AllCategoriesKey
] = true; | 67 defaultSelectedAuditCategory[WebInspector.AuditLauncherView.AllCategoriesKey
] = true; |
69 this._selectedCategoriesSetting = WebInspector.settings.createSetting("selec
tedAuditCategories", defaultSelectedAuditCategory); | 68 this._selectedCategoriesSetting = WebInspector.settings.createSetting("selec
tedAuditCategories", defaultSelectedAuditCategory); |
70 } | 69 } |
71 | 70 |
72 WebInspector.AuditLauncherView.AllCategoriesKey = "__AllCategories"; | 71 WebInspector.AuditLauncherView.AllCategoriesKey = "__AllCategories"; |
73 | 72 |
74 WebInspector.AuditLauncherView.prototype = { | 73 WebInspector.AuditLauncherView.prototype = { |
75 _resetResourceCount: function() | 74 _resetResourceCount: function() |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 /** | 133 /** |
135 * @param {boolean} auditRunning | 134 * @param {boolean} auditRunning |
136 */ | 135 */ |
137 _setAuditRunning: function(auditRunning) | 136 _setAuditRunning: function(auditRunning) |
138 { | 137 { |
139 if (this._auditRunning === auditRunning) | 138 if (this._auditRunning === auditRunning) |
140 return; | 139 return; |
141 this._auditRunning = auditRunning; | 140 this._auditRunning = auditRunning; |
142 this._updateButton(); | 141 this._updateButton(); |
143 this._toggleUIComponents(this._auditRunning); | 142 this._toggleUIComponents(this._auditRunning); |
144 if (this._auditRunning) { | 143 if (this._auditRunning) |
145 WebInspector.profilingLock().acquire(); | |
146 this._startAudit(); | 144 this._startAudit(); |
147 } else { | 145 else |
148 this._stopAudit(); | 146 this._stopAudit(); |
149 WebInspector.profilingLock().release(); | |
150 } | |
151 }, | 147 }, |
152 | 148 |
153 _startAudit: function() | 149 _startAudit: function() |
154 { | 150 { |
155 var catIds = []; | 151 var catIds = []; |
156 for (var category = 0; category < this._sortedCategories.length; ++categ
ory) { | 152 for (var category = 0; category < this._sortedCategories.length; ++categ
ory) { |
157 if (this._sortedCategories[category]._checkboxElement.checked) | 153 if (this._sortedCategories[category]._checkboxElement.checked) |
158 catIds.push(this._sortedCategories[category].id); | 154 catIds.push(this._sortedCategories[category].id); |
159 } | 155 } |
160 | 156 |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
317 var childNodes = this._categoriesElement.childNodes; | 313 var childNodes = this._categoriesElement.childNodes; |
318 for (var i = 0, length = childNodes.length; i < length; ++i) | 314 for (var i = 0, length = childNodes.length; i < length; ++i) |
319 selectedCategories[childNodes[i].__displayName] = childNodes[i].firs
tChild.checked; | 315 selectedCategories[childNodes[i].__displayName] = childNodes[i].firs
tChild.checked; |
320 selectedCategories[WebInspector.AuditLauncherView.AllCategoriesKey] = th
is._selectAllCheckboxElement.checked; | 316 selectedCategories[WebInspector.AuditLauncherView.AllCategoriesKey] = th
is._selectAllCheckboxElement.checked; |
321 this._selectedCategoriesSetting.set(selectedCategories); | 317 this._selectedCategoriesSetting.set(selectedCategories); |
322 this._updateButton(); | 318 this._updateButton(); |
323 }, | 319 }, |
324 | 320 |
325 _updateButton: function() | 321 _updateButton: function() |
326 { | 322 { |
327 var enable = this._auditRunning || (this._currentCategoriesCount && !Web
Inspector.profilingLock().isAcquired()); | |
328 this._launchButton.textContent = this._auditRunning ? WebInspector.UIStr
ing("Stop") : WebInspector.UIString("Run"); | 323 this._launchButton.textContent = this._auditRunning ? WebInspector.UIStr
ing("Stop") : WebInspector.UIString("Run"); |
329 this._launchButton.disabled = !enable; | 324 this._launchButton.disabled = !this._currentCategoriesCount; |
330 this._launchButton.title = enable ? "" : WebInspector.anotherProfilerAct
iveLabel(); | |
331 }, | 325 }, |
332 | 326 |
333 __proto__: WebInspector.VBox.prototype | 327 __proto__: WebInspector.VBox.prototype |
334 } | 328 } |
OLD | NEW |