| 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 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 throw "Main connection was not initialized"; | 97 throw "Main connection was not initialized"; |
| 98 return this._connection; | 98 return this._connection; |
| 99 }, | 99 }, |
| 100 | 100 |
| 101 /** | 101 /** |
| 102 * @param {!InspectorBackendClass.MainConnection} connection | 102 * @param {!InspectorBackendClass.MainConnection} connection |
| 103 */ | 103 */ |
| 104 setConnection: function(connection) | 104 setConnection: function(connection) |
| 105 { | 105 { |
| 106 this._connection = connection; | 106 this._connection = connection; |
| 107 this._connection.initialize(this._agentPrototypes, this._dispatcherProto
types); | |
| 108 | 107 |
| 109 this._connection.registerAgentsOn(window); | 108 this._connection.registerAgentsOn(window); |
| 110 for (var type in this._enums) { | 109 for (var type in this._enums) { |
| 111 var domainAndMethod = type.split("."); | 110 var domainAndMethod = type.split("."); |
| 112 window[domainAndMethod[0] + "Agent"][domainAndMethod[1]] = this._enu
ms[type]; | 111 window[domainAndMethod[0] + "Agent"][domainAndMethod[1]] = this._enu
ms[type]; |
| 113 } | 112 } |
| 114 }, | 113 }, |
| 115 | 114 |
| 116 /** | 115 /** |
| 117 * @param {string} domain | 116 * @param {string} domain |
| (...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 333 * @constructor | 332 * @constructor |
| 334 * @extends {WebInspector.Object} | 333 * @extends {WebInspector.Object} |
| 335 */ | 334 */ |
| 336 InspectorBackendClass.Connection = function() | 335 InspectorBackendClass.Connection = function() |
| 337 { | 336 { |
| 338 this._lastMessageId = 1; | 337 this._lastMessageId = 1; |
| 339 this._pendingResponsesCount = 0; | 338 this._pendingResponsesCount = 0; |
| 340 this._agents = {}; | 339 this._agents = {}; |
| 341 this._dispatchers = {}; | 340 this._dispatchers = {}; |
| 342 this._callbacks = {}; | 341 this._callbacks = {}; |
| 342 this._initialize(InspectorBackend._agentPrototypes, InspectorBackend._dispat
cherPrototypes); |
| 343 } | 343 } |
| 344 | 344 |
| 345 InspectorBackendClass.Connection.Events = { | 345 InspectorBackendClass.Connection.Events = { |
| 346 Disconnected: "Disconnected", | 346 Disconnected: "Disconnected", |
| 347 } | 347 } |
| 348 | 348 |
| 349 InspectorBackendClass.Connection.prototype = { | 349 InspectorBackendClass.Connection.prototype = { |
| 350 | 350 |
| 351 /** | 351 /** |
| 352 * @param {!Object.<string, !InspectorBackendClass.AgentPrototype>} agentPro
totypes | 352 * @param {!Object.<string, !InspectorBackendClass.AgentPrototype>} agentPro
totypes |
| 353 * @param {!Object.<string, !InspectorBackendClass.DispatcherPrototype>} dis
patcherPrototypes | 353 * @param {!Object.<string, !InspectorBackendClass.DispatcherPrototype>} dis
patcherPrototypes |
| 354 */ | 354 */ |
| 355 initialize: function(agentPrototypes, dispatcherPrototypes) | 355 _initialize: function(agentPrototypes, dispatcherPrototypes) |
| 356 { | 356 { |
| 357 for (var domain in agentPrototypes) { | 357 for (var domain in agentPrototypes) { |
| 358 this._agents[domain] = Object.create(agentPrototypes[domain]); | 358 this._agents[domain] = Object.create(agentPrototypes[domain]); |
| 359 this._agents[domain].setConnection(this); | 359 this._agents[domain].setConnection(this); |
| 360 } | 360 } |
| 361 | 361 |
| 362 for (var domain in dispatcherPrototypes) | 362 for (var domain in dispatcherPrototypes) |
| 363 this._dispatchers[domain] = Object.create(dispatcherPrototypes[domai
n]) | 363 this._dispatchers[domain] = Object.create(dispatcherPrototypes[domai
n]) |
| 364 | 364 |
| 365 }, | 365 }, |
| (...skipping 494 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 860 } | 860 } |
| 861 | 861 |
| 862 } | 862 } |
| 863 | 863 |
| 864 InspectorBackendClass.Options = { | 864 InspectorBackendClass.Options = { |
| 865 dumpInspectorTimeStats: false, | 865 dumpInspectorTimeStats: false, |
| 866 dumpInspectorProtocolMessages: false | 866 dumpInspectorProtocolMessages: false |
| 867 } | 867 } |
| 868 | 868 |
| 869 InspectorBackend = new InspectorBackendClass(); | 869 InspectorBackend = new InspectorBackendClass(); |
| OLD | NEW |