| Index: third_party/WebKit/Source/devtools/front_end/audits2/Audits2Panel.js
|
| diff --git a/third_party/WebKit/Source/devtools/front_end/audits2/Audits2Panel.js b/third_party/WebKit/Source/devtools/front_end/audits2/Audits2Panel.js
|
| index 1b4177b5b0005c4492102569a37504764e73dab5..b54389d3b8e22cfb6d100bc37b4a5cdd8ecca3fe 100644
|
| --- a/third_party/WebKit/Source/devtools/front_end/audits2/Audits2Panel.js
|
| +++ b/third_party/WebKit/Source/devtools/front_end/audits2/Audits2Panel.js
|
| @@ -1,66 +1,59 @@
|
| // Copyright (c) 2016 The Chromium Authors. All rights reserved.
|
| // Use of this source code is governed by a BSD-style license that can be
|
| // found in the LICENSE file.
|
| -
|
| /**
|
| - * @constructor
|
| - * @extends {WebInspector.Panel}
|
| + * @unrestricted
|
| */
|
| -WebInspector.Audits2Panel = function()
|
| -{
|
| - WebInspector.Panel.call(this, "audits2");
|
| - this.contentElement.classList.add("vbox");
|
| - this.contentElement.appendChild(createTextButton(WebInspector.UIString("Start"), this._start.bind(this)));
|
| - this.contentElement.appendChild(createTextButton(WebInspector.UIString("Stop"), this._stop.bind(this)));
|
| - this._resultElement = this.contentElement.createChild("div", "overflow-auto");
|
| -};
|
| -
|
| -WebInspector.Audits2Panel.prototype = {
|
| - _start: function()
|
| - {
|
| - WebInspector.targetManager.interceptMainConnection(this._dispatchProtocolMessage.bind(this)).then(rawConnection => {
|
| - this._rawConnection = rawConnection;
|
| - this._send("start").then(result => {
|
| - var section = new WebInspector.ObjectPropertiesSection(WebInspector.RemoteObject.fromLocalObject(result), WebInspector.UIString("Audit Results"));
|
| - this._resultElement.appendChild(section.element);
|
| - this._stop();
|
| - });
|
| - });
|
| - },
|
| +WebInspector.Audits2Panel = class extends WebInspector.Panel {
|
| + constructor() {
|
| + super('audits2');
|
| + this.contentElement.classList.add('vbox');
|
| + this.contentElement.appendChild(createTextButton(WebInspector.UIString('Start'), this._start.bind(this)));
|
| + this.contentElement.appendChild(createTextButton(WebInspector.UIString('Stop'), this._stop.bind(this)));
|
| + this._resultElement = this.contentElement.createChild('div', 'overflow-auto');
|
| + }
|
|
|
| - /**
|
| - * @param {string} message
|
| - */
|
| - _dispatchProtocolMessage: function(message)
|
| - {
|
| - this._send("dispatchProtocolMessage", {message: message});
|
| - },
|
| + _start() {
|
| + WebInspector.targetManager.interceptMainConnection(this._dispatchProtocolMessage.bind(this)).then(rawConnection => {
|
| + this._rawConnection = rawConnection;
|
| + this._send('start').then(result => {
|
| + var section = new WebInspector.ObjectPropertiesSection(
|
| + WebInspector.RemoteObject.fromLocalObject(result), WebInspector.UIString('Audit Results'));
|
| + this._resultElement.appendChild(section.element);
|
| + this._stop();
|
| + });
|
| + });
|
| + }
|
|
|
| - _stop: function()
|
| - {
|
| - this._send("stop").then(() => {
|
| - this._rawConnection.disconnect();
|
| - this._backend.dispose();
|
| - delete this._backend;
|
| - delete this._backendPromise;
|
| - });
|
| - },
|
| + /**
|
| + * @param {string} message
|
| + */
|
| + _dispatchProtocolMessage(message) {
|
| + this._send('dispatchProtocolMessage', {message: message});
|
| + }
|
|
|
| - /**
|
| - * @param {string} method
|
| - * @param {!Object=} params
|
| - * @return {!Promise<!Object|undefined>}
|
| - */
|
| - _send: function(method, params)
|
| - {
|
| - if (!this._backendPromise) {
|
| - this._backendPromise = WebInspector.serviceManager.createAppService("audits2_worker", "Audits2Service", false).then(backend => {
|
| - this._backend = backend;
|
| - this._backend.on("sendProtocolMessage", result => this._rawConnection.sendMessage(result.message));
|
| - });
|
| - }
|
| - return this._backendPromise.then(() => this._backend ? this._backend.send(method, params) : undefined);
|
| - },
|
| + _stop() {
|
| + this._send('stop').then(() => {
|
| + this._rawConnection.disconnect();
|
| + this._backend.dispose();
|
| + delete this._backend;
|
| + delete this._backendPromise;
|
| + });
|
| + }
|
|
|
| - __proto__: WebInspector.Panel.prototype
|
| + /**
|
| + * @param {string} method
|
| + * @param {!Object=} params
|
| + * @return {!Promise<!Object|undefined>}
|
| + */
|
| + _send(method, params) {
|
| + if (!this._backendPromise) {
|
| + this._backendPromise =
|
| + WebInspector.serviceManager.createAppService('audits2_worker', 'Audits2Service', false).then(backend => {
|
| + this._backend = backend;
|
| + this._backend.on('sendProtocolMessage', result => this._rawConnection.sendMessage(result.message));
|
| + });
|
| + }
|
| + return this._backendPromise.then(() => this._backend ? this._backend.send(method, params) : undefined);
|
| + }
|
| };
|
|
|