Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1420)

Unified Diff: Source/devtools/front_end/sdk/InspectorBackend.js

Issue 1355423003: Devtools: initialize protocol enums synchronously (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: removed WebInspector._connectionForTests Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/devtools/front_end/main/module.json ('k') | Source/devtools/scripts/generate_protocol_externs.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/devtools/front_end/sdk/InspectorBackend.js
diff --git a/Source/devtools/front_end/sdk/InspectorBackend.js b/Source/devtools/front_end/sdk/InspectorBackend.js
index 6d5f8b30a8c618c8fa61709728b2cf82a4e4fb84..fdbc8bacf74fe1d6499d85493e2d0eb8d30ea50d 100644
--- a/Source/devtools/front_end/sdk/InspectorBackend.js
+++ b/Source/devtools/front_end/sdk/InspectorBackend.js
@@ -33,11 +33,9 @@
*/
function InspectorBackendClass()
{
- this._connection = null;
this._agentPrototypes = {};
this._dispatcherPrototypes = {};
this._initialized = false;
- this._enums = {};
this._initProtocolAgentsConstructor();
}
@@ -100,30 +98,6 @@ InspectorBackendClass.prototype = {
},
/**
- * @return {!InspectorBackendClass.Connection}
- */
- connection: function()
- {
- if (!this._connection)
- throw "Main connection was not initialized";
- return this._connection;
- },
-
- /**
- * @param {!InspectorBackendClass.MainConnection} connection
- */
- setConnection: function(connection)
- {
- this._connection = connection;
-
- this._connection.registerAgentsOn(window);
- for (var type in this._enums) {
- var domainAndMethod = type.split(".");
- window[domainAndMethod[0] + "Agent"][domainAndMethod[1]] = this._enums[type];
- }
- },
-
- /**
* @param {string} domain
* @return {!InspectorBackendClass.AgentPrototype}
*/
@@ -167,7 +141,12 @@ InspectorBackendClass.prototype = {
*/
registerEnum: function(type, values)
{
- this._enums[type] = values;
+ var domainAndMethod = type.split(".");
+ var agentName = domainAndMethod[0] + "Agent";
+ if (!window[agentName])
+ window[agentName] = {};
+
+ window[agentName][domainAndMethod[1]] = values;
this._initialized = true;
},
@@ -366,15 +345,6 @@ InspectorBackendClass.Connection.prototype = {
},
/**
- * @param {!Object} object
- */
- registerAgentsOn: function(object)
- {
- for (var domain in this._agents)
- object[domain + "Agent"] = {};
- },
-
- /**
* @return {number}
*/
nextMessageId: function()
« no previous file with comments | « Source/devtools/front_end/main/module.json ('k') | Source/devtools/scripts/generate_protocol_externs.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698