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/services/inspector/inspector.mojom.html" as="inspe
ctor" /> | 4 <link rel="import" href="/sky/services/inspector/inspector.mojom.html" as="inspe
ctor" /> |
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" /> | 9 <link rel="import" href="runtime-agent.sky" as="RuntimeAgent" /> |
10 <link rel="import" href="indexeddb-agent.sky" as="IndexedDBAgent" /> | 10 <link rel="import" href="indexeddb-agent.sky" as="IndexedDBAgent" /> |
| 11 <link rel="import" href="css-agent.sky" as="CSSAgent" /> |
11 <script> | 12 <script> |
12 function InspectorBackend(frontend) { | 13 function InspectorBackend(frontend) { |
13 this.frontend = frontend; | 14 this.frontend = frontend; |
| 15 var domAgent = new DOMAgent(this); |
14 this.agents = { | 16 this.agents = { |
15 Console: new ConsoleAgent(), | 17 Console: new ConsoleAgent(), |
16 DOM: new DOMAgent(this), | 18 DOM: domAgent, |
17 Page: new PageAgent(), | 19 Page: new PageAgent(), |
18 Worker: new WorkerAgent(), | 20 Worker: new WorkerAgent(), |
19 Runtime: new RuntimeAgent(this), | 21 Runtime: new RuntimeAgent(this), |
| 22 CSS: new CSSAgent(domAgent), |
20 IndexedDB: new IndexedDBAgent(), | 23 IndexedDB: new IndexedDBAgent(), |
21 }; | 24 }; |
| 25 this.missingNames_ = {}; |
22 } | 26 } |
23 | 27 |
24 InspectorBackend.prototype = Object.create( | 28 InspectorBackend.prototype = Object.create( |
25 inspector.InspectorBackend.stubClass.prototype); | 29 inspector.InspectorBackend.stubClass.prototype); |
26 | 30 |
27 InspectorBackend.prototype.onConnect = function() { | 31 InspectorBackend.prototype.onConnect = function() { |
28 }; | 32 }; |
29 | 33 |
30 InspectorBackend.prototype.onDisconnect = function() { | 34 InspectorBackend.prototype.onDisconnect = function() { |
31 }; | 35 }; |
32 | 36 |
| 37 InspectorBackend.prototype.logMissing_ = function(name) { |
| 38 if (name in this.missingNames_) |
| 39 return; |
| 40 this.missingNames_[name] = true; |
| 41 console.log("InspectorBackend missing " + name); |
| 42 } |
| 43 |
33 InspectorBackend.prototype.dispatch_ = function(descriptor, params) { | 44 InspectorBackend.prototype.dispatch_ = function(descriptor, params) { |
34 var parsed = descriptor.split('.'); | 45 var parsed = descriptor.split('.'); |
35 | 46 |
36 var agentName = parsed[0]; | 47 var agentName = parsed[0]; |
37 var methodName = parsed[1]; | 48 var methodName = parsed[1]; |
38 | 49 |
39 if (!(agentName in this.agents)) { | 50 if (!(agentName in this.agents)) { |
40 console.log("InspectorBackend missing " + agentName); | 51 this.logMissing_(agentName); |
41 return {}; | 52 return {}; |
42 } | 53 } |
43 | 54 |
44 var agent = this.agents[agentName]; | 55 var agent = this.agents[agentName]; |
45 | 56 |
46 if (!(methodName in agent)) { | 57 if (!(methodName in agent)) { |
47 console.log("InspectorBackend missing " + agentName + "." + methodName); | 58 this.logMissing_(agentName + "." + methodName); |
48 return {}; | 59 return {}; |
49 } | 60 } |
50 | 61 |
51 try { | 62 try { |
52 return agent[methodName](params); | 63 return agent[methodName](params); |
53 } catch(ex) { | 64 } catch(ex) { |
54 console.log(descriptor + ": " + ex); | 65 console.log(descriptor + ": " + ex); |
55 } | 66 } |
56 }; | 67 }; |
57 | 68 |
(...skipping 19 matching lines...) Expand all Loading... |
77 var frontendHandle = internals.connectToService( | 88 var frontendHandle = internals.connectToService( |
78 "mojo:sky_inspector_server", inspector.InspectorFrontend.name); | 89 "mojo:sky_inspector_server", inspector.InspectorFrontend.name); |
79 window.frontendConnection = new connection.Connection( | 90 window.frontendConnection = new connection.Connection( |
80 frontendHandle, | 91 frontendHandle, |
81 InspectorBackend, | 92 InspectorBackend, |
82 inspector.InspectorFrontend.proxyClass); | 93 inspector.InspectorFrontend.proxyClass); |
83 | 94 |
84 window.frontend = frontendConnection.remote; | 95 window.frontend = frontendConnection.remote; |
85 frontend.listen(9898); | 96 frontend.listen(9898); |
86 </script> | 97 </script> |
OLD | NEW |