| OLD | NEW |
| 1 // Copyright (c) 2016 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2016 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 * @constructor | 6 * @constructor |
| 7 * @extends {WebInspector.Panel} | 7 * @extends {WebInspector.Panel} |
| 8 */ | 8 */ |
| 9 WebInspector.Audits2Panel = function() | 9 WebInspector.Audits2Panel = function() |
| 10 { | 10 { |
| 11 WebInspector.Panel.call(this, "audits2"); | 11 WebInspector.Panel.call(this, "audits2"); |
| 12 this.contentElement.classList.add("vbox"); | 12 this.contentElement.classList.add("vbox"); |
| 13 this.contentElement.appendChild(createTextButton(WebInspector.UIString("Star
t"), this._start.bind(this))); | 13 this.contentElement.appendChild(createTextButton(WebInspector.UIString("Star
t"), this._start.bind(this))); |
| 14 this.contentElement.appendChild(createTextButton(WebInspector.UIString("Stop
"), this._stop.bind(this))); | 14 this.contentElement.appendChild(createTextButton(WebInspector.UIString("Stop
"), this._stop.bind(this))); |
| 15 } | 15 }; |
| 16 | 16 |
| 17 WebInspector.Audits2Panel.prototype = { | 17 WebInspector.Audits2Panel.prototype = { |
| 18 _start: function() | 18 _start: function() |
| 19 { | 19 { |
| 20 WebInspector.targetManager.interceptMainConnection(this._dispatchProtoco
lMessage.bind(this)).then(rawConnection => { | 20 WebInspector.targetManager.interceptMainConnection(this._dispatchProtoco
lMessage.bind(this)).then(rawConnection => { |
| 21 this._rawConnection = rawConnection; | 21 this._rawConnection = rawConnection; |
| 22 this._send("start"); | 22 this._send("start"); |
| 23 }); | 23 }); |
| 24 }, | 24 }, |
| 25 | 25 |
| (...skipping 25 matching lines...) Expand all Loading... |
| 51 if (!this._backendPromise) { | 51 if (!this._backendPromise) { |
| 52 this._backendPromise = WebInspector.serviceManager.createAppService(
"audits2_worker", "Audits2Service", false).then(backend => { | 52 this._backendPromise = WebInspector.serviceManager.createAppService(
"audits2_worker", "Audits2Service", false).then(backend => { |
| 53 this._backend = backend; | 53 this._backend = backend; |
| 54 this._backend.on("sendProtocolMessage", result => this._rawConne
ction.send(result.message)); | 54 this._backend.on("sendProtocolMessage", result => this._rawConne
ction.send(result.message)); |
| 55 }); | 55 }); |
| 56 } | 56 } |
| 57 return this._backendPromise.then(() => this._backend ? this._backend.sen
d(method, params) : undefined); | 57 return this._backendPromise.then(() => this._backend ? this._backend.sen
d(method, params) : undefined); |
| 58 }, | 58 }, |
| 59 | 59 |
| 60 __proto__: WebInspector.Panel.prototype | 60 __proto__: WebInspector.Panel.prototype |
| 61 } | 61 }; |
| OLD | NEW |