| OLD | NEW |
| 1 <link rel="import" href="/mojo/public/html/connection.html" as="connection" /> | 1 <link rel="import" href="/mojo/public/html/connection.html" as="connection" /> |
| 2 <link rel="import" href="/mojo/public/html/core.html" as="core" /> | 2 <link rel="import" href="/mojo/public/html/core.html" as="core" /> |
| 3 <link rel="import" href="/mojo/public/html/support.html" as="support" /> | 3 <link rel="import" href="/mojo/public/html/support.html" as="support" /> |
| 4 <link rel="import" href="/sky/framework/inspector/server/inspector.mojom.html" a
s="inspector" /> | 4 <link rel="import" href="/sky/framework/inspector/server/inspector.mojom.html" a
s="inspector" /> |
| 5 <link rel="import" href="console-agent.sky" as="ConsoleAgent" /> | 5 <link rel="import" href="console-agent.sky" as="ConsoleAgent" /> |
| 6 <link rel="import" href="dom-agent.sky" as="DOMAgent" /> | 6 <link rel="import" href="dom-agent.sky" as="DOMAgent" /> |
| 7 <link rel="import" href="page-agent.sky" as="PageAgent" /> | 7 <link rel="import" href="page-agent.sky" as="PageAgent" /> |
| 8 <link rel="import" href="worker-agent.sky" as="WorkerAgent" /> | 8 <link rel="import" href="worker-agent.sky" as="WorkerAgent" /> |
| 9 <link rel="import" href="runtime-agent.sky" as="RuntimeAgent" /> |
| 10 <link rel="import" href="indexeddb-agent.sky" as="IndexedDBAgent" /> |
| 9 <script> | 11 <script> |
| 10 function InspectorBackend(frontend) { | 12 function InspectorBackend(frontend) { |
| 11 this.frontend = frontend; | 13 this.frontend = frontend; |
| 12 this.agents = { | 14 this.agents = { |
| 13 Console: new ConsoleAgent(), | 15 Console: new ConsoleAgent(), |
| 14 DOM: new DOMAgent(this), | 16 DOM: new DOMAgent(this), |
| 15 Page: new PageAgent(), | 17 Page: new PageAgent(), |
| 16 Worker: new WorkerAgent(), | 18 Worker: new WorkerAgent(), |
| 19 Runtime: new RuntimeAgent(this), |
| 20 IndexedDB: new IndexedDBAgent(), |
| 17 }; | 21 }; |
| 18 } | 22 } |
| 19 | 23 |
| 20 InspectorBackend.prototype = Object.create( | 24 InspectorBackend.prototype = Object.create( |
| 21 inspector.InspectorBackend.stubClass.prototype); | 25 inspector.InspectorBackend.stubClass.prototype); |
| 22 | 26 |
| 23 InspectorBackend.prototype.onConnect = function() { | 27 InspectorBackend.prototype.onConnect = function() { |
| 24 }; | 28 }; |
| 25 | 29 |
| 26 InspectorBackend.prototype.onDisconnect = function() { | 30 InspectorBackend.prototype.onDisconnect = function() { |
| 27 }; | 31 }; |
| 28 | 32 |
| 29 InspectorBackend.prototype.dispatch_ = function(descriptor, params) { | 33 InspectorBackend.prototype.dispatch_ = function(descriptor, params) { |
| 30 var parsed = descriptor.split('.'); | 34 var parsed = descriptor.split('.'); |
| 31 | 35 |
| 32 var agentName = parsed[0]; | 36 var agentName = parsed[0]; |
| 33 var methodName = parsed[1]; | 37 var methodName = parsed[1]; |
| 34 | 38 |
| 35 if (!(agentName in this.agents)) { | 39 if (!(agentName in this.agents)) { |
| 36 console.log("InspectorBackend cannot find agent " + agentName); | 40 console.log("InspectorBackend missing " + agentName); |
| 37 return {}; | 41 return {}; |
| 38 } | 42 } |
| 39 | 43 |
| 40 var agent = this.agents[agentName]; | 44 var agent = this.agents[agentName]; |
| 41 | 45 |
| 42 if (!(methodName in agent)) { | 46 if (!(methodName in agent)) { |
| 43 console.log("InspectorBackend cannot find method " + | 47 console.log("InspectorBackend missing " + agentName + "." + methodName); |
| 44 methodName + " on agent " + agentName); | |
| 45 return {}; | 48 return {}; |
| 46 } | 49 } |
| 47 | 50 |
| 48 try { | 51 try { |
| 49 return agent[methodName](params); | 52 return agent[methodName](params); |
| 50 } catch(ex) { | 53 } catch(ex) { |
| 51 console.log(descriptor + ": " + ex); | 54 console.log(descriptor + ": " + ex); |
| 52 } | 55 } |
| 53 }; | 56 }; |
| 54 | 57 |
| (...skipping 19 matching lines...) Expand all Loading... |
| 74 var frontendHandle = internals.connectToService( | 77 var frontendHandle = internals.connectToService( |
| 75 "mojo:sky_inspector_server", inspector.InspectorFrontend.name); | 78 "mojo:sky_inspector_server", inspector.InspectorFrontend.name); |
| 76 window.frontendConnection = new connection.Connection( | 79 window.frontendConnection = new connection.Connection( |
| 77 frontendHandle, | 80 frontendHandle, |
| 78 InspectorBackend, | 81 InspectorBackend, |
| 79 inspector.InspectorFrontend.proxyClass); | 82 inspector.InspectorFrontend.proxyClass); |
| 80 | 83 |
| 81 window.frontend = frontendConnection.remote; | 84 window.frontend = frontendConnection.remote; |
| 82 frontend.listen(9898); | 85 frontend.listen(9898); |
| 83 </script> | 86 </script> |
| OLD | NEW |