| Index: third_party/WebKit/Source/devtools/front_end/host/InspectorFrontendHost.js
|
| diff --git a/third_party/WebKit/Source/devtools/front_end/host/InspectorFrontendHost.js b/third_party/WebKit/Source/devtools/front_end/host/InspectorFrontendHost.js
|
| index db265278b540c4e6c39189125cbcf83d74ac6799..d6c4d2d7fb1ae0382952e5bd9e7adee180450f0c 100644
|
| --- a/third_party/WebKit/Source/devtools/front_end/host/InspectorFrontendHost.js
|
| +++ b/third_party/WebKit/Source/devtools/front_end/host/InspectorFrontendHost.js
|
| @@ -463,6 +463,65 @@ WebInspector.InspectorFrontendHostStub.prototype = {
|
| };
|
|
|
| /**
|
| + * @constructor
|
| + */
|
| +function InspectorFrontendAPIImpl()
|
| +{
|
| + this._debugFrontend = !!Runtime.queryParam("debugFrontend") || (window["InspectorTest"] && window["InspectorTest"]["debugTest"]);
|
| +
|
| + var descriptors = InspectorFrontendHostAPI.EventDescriptors;
|
| + for (var i = 0; i < descriptors.length; ++i)
|
| + this[descriptors[i][1]] = this._dispatch.bind(this, descriptors[i][0], descriptors[i][2], descriptors[i][3]);
|
| +}
|
| +
|
| +InspectorFrontendAPIImpl.prototype = {
|
| + /**
|
| + * @param {symbol} name
|
| + * @param {!Array.<string>} signature
|
| + * @param {boolean} runOnceLoaded
|
| + */
|
| + _dispatch: function(name, signature, runOnceLoaded)
|
| + {
|
| + var params = Array.prototype.slice.call(arguments, 3);
|
| +
|
| + if (this._debugFrontend)
|
| + setImmediate(innerDispatch);
|
| + else
|
| + innerDispatch();
|
| +
|
| + function innerDispatch()
|
| + {
|
| + // Single argument methods get dispatched with the param.
|
| + if (signature.length < 2) {
|
| + try {
|
| + InspectorFrontendHost.events.dispatchEventToListeners(name, params[0]);
|
| + } catch (e) {
|
| + console.error(e + " " + e.stack);
|
| + }
|
| + return;
|
| + }
|
| + var data = {};
|
| + for (var i = 0; i < signature.length; ++i)
|
| + data[signature[i]] = params[i];
|
| + try {
|
| + InspectorFrontendHost.events.dispatchEventToListeners(name, data);
|
| + } catch (e) {
|
| + console.error(e + " " + e.stack);
|
| + }
|
| + }
|
| + },
|
| +
|
| + /**
|
| + * @param {number} id
|
| + * @param {string} chunk
|
| + */
|
| + streamWrite: function(id, chunk)
|
| + {
|
| + WebInspector.ResourceLoader.streamWrite(id, chunk);
|
| + }
|
| +};
|
| +
|
| +/**
|
| * @type {!InspectorFrontendHostAPI}
|
| */
|
| var InspectorFrontendHost = window.InspectorFrontendHost || null;
|
| @@ -501,65 +560,6 @@ window.InspectorFrontendHost = InspectorFrontendHost;
|
| InspectorFrontendHost.events = new WebInspector.Object();
|
| }
|
|
|
| - /**
|
| - * @constructor
|
| - */
|
| - function InspectorFrontendAPIImpl()
|
| - {
|
| - this._debugFrontend = !!Runtime.queryParam("debugFrontend") || (window["InspectorTest"] && window["InspectorTest"]["debugTest"]);
|
| -
|
| - var descriptors = InspectorFrontendHostAPI.EventDescriptors;
|
| - for (var i = 0; i < descriptors.length; ++i)
|
| - this[descriptors[i][1]] = this._dispatch.bind(this, descriptors[i][0], descriptors[i][2], descriptors[i][3]);
|
| - }
|
| -
|
| - InspectorFrontendAPIImpl.prototype = {
|
| - /**
|
| - * @param {symbol} name
|
| - * @param {!Array.<string>} signature
|
| - * @param {boolean} runOnceLoaded
|
| - */
|
| - _dispatch: function(name, signature, runOnceLoaded)
|
| - {
|
| - var params = Array.prototype.slice.call(arguments, 3);
|
| -
|
| - if (this._debugFrontend)
|
| - setImmediate(innerDispatch);
|
| - else
|
| - innerDispatch();
|
| -
|
| - function innerDispatch()
|
| - {
|
| - // Single argument methods get dispatched with the param.
|
| - if (signature.length < 2) {
|
| - try {
|
| - InspectorFrontendHost.events.dispatchEventToListeners(name, params[0]);
|
| - } catch (e) {
|
| - console.error(e + " " + e.stack);
|
| - }
|
| - return;
|
| - }
|
| - var data = {};
|
| - for (var i = 0; i < signature.length; ++i)
|
| - data[signature[i]] = params[i];
|
| - try {
|
| - InspectorFrontendHost.events.dispatchEventToListeners(name, data);
|
| - } catch (e) {
|
| - console.error(e + " " + e.stack);
|
| - }
|
| - }
|
| - },
|
| -
|
| - /**
|
| - * @param {number} id
|
| - * @param {string} chunk
|
| - */
|
| - streamWrite: function(id, chunk)
|
| - {
|
| - WebInspector.ResourceLoader.streamWrite(id, chunk);
|
| - }
|
| - };
|
| -
|
| // FIXME: This file is included into both apps, since the devtools_app needs the InspectorFrontendHostAPI only,
|
| // so the host instance should not initialized there.
|
| initializeInspectorFrontendHost();
|
|
|