OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 /** | 5 /** |
6 * @fileoverview Tools is a main class that wires all components of the | 6 * @fileoverview Tools is a main class that wires all components of the |
7 * DevTools frontend together. It is also responsible for overriding existing | 7 * DevTools frontend together. It is also responsible for overriding existing |
8 * WebInspector functionality while it is getting upstreamed into WebCore. | 8 * WebInspector functionality while it is getting upstreamed into WebCore. |
9 */ | 9 */ |
10 goog.provide('devtools.Tools'); | 10 goog.provide('devtools.Tools'); |
(...skipping 24 matching lines...) Expand all Loading... |
35 | 35 |
36 | 36 |
37 devtools.ToolsAgent = function() { | 37 devtools.ToolsAgent = function() { |
38 RemoteToolsAgent.DidDispatchOn = | 38 RemoteToolsAgent.DidDispatchOn = |
39 WebInspector.Callback.processCallback; | 39 WebInspector.Callback.processCallback; |
40 RemoteToolsAgent.FrameNavigate = | 40 RemoteToolsAgent.FrameNavigate = |
41 goog.bind(this.frameNavigate_, this); | 41 goog.bind(this.frameNavigate_, this); |
42 RemoteToolsAgent.DispatchOnClient = | 42 RemoteToolsAgent.DispatchOnClient = |
43 goog.bind(this.dispatchOnClient_, this); | 43 goog.bind(this.dispatchOnClient_, this); |
44 this.debuggerAgent_ = new devtools.DebuggerAgent(); | 44 this.debuggerAgent_ = new devtools.DebuggerAgent(); |
| 45 this.profilerAgent_ = new devtools.ProfilerAgent(); |
45 }; | 46 }; |
46 | 47 |
47 | 48 |
48 /** | 49 /** |
49 * Resets tools agent to its initial state. | 50 * Resets tools agent to its initial state. |
50 */ | 51 */ |
51 devtools.ToolsAgent.prototype.reset = function() { | 52 devtools.ToolsAgent.prototype.reset = function() { |
52 InspectorFrontendHost.reset(); | 53 InspectorFrontendHost.reset(); |
53 this.debuggerAgent_.reset(); | 54 this.debuggerAgent_.reset(); |
| 55 this.profilerAgent_.reset(); |
54 }; | 56 }; |
55 | 57 |
56 | 58 |
57 /** | 59 /** |
58 * @param {string} script Script exression to be evaluated in the context of the | 60 * @param {string} script Script exression to be evaluated in the context of the |
59 * inspected page. | 61 * inspected page. |
60 * @param {function(Object|string, boolean):undefined} opt_callback Function to | 62 * @param {function(Object|string, boolean):undefined} opt_callback Function to |
61 * call with the result. | 63 * call with the result. |
62 */ | 64 */ |
63 devtools.ToolsAgent.prototype.evaluateJavaScript = function(script, | 65 devtools.ToolsAgent.prototype.evaluateJavaScript = function(script, |
64 opt_callback) { | 66 opt_callback) { |
65 InspectorBackend.evaluate(script, opt_callback || function() {}); | 67 InspectorBackend.evaluate(script, opt_callback || function() {}); |
66 }; | 68 }; |
67 | 69 |
68 | 70 |
69 /** | 71 /** |
70 * @return {devtools.DebuggerAgent} Debugger agent instance. | 72 * @return {devtools.DebuggerAgent} Debugger agent instance. |
71 */ | 73 */ |
72 devtools.ToolsAgent.prototype.getDebuggerAgent = function() { | 74 devtools.ToolsAgent.prototype.getDebuggerAgent = function() { |
73 return this.debuggerAgent_; | 75 return this.debuggerAgent_; |
74 }; | 76 }; |
75 | 77 |
76 | 78 |
77 /** | 79 /** |
| 80 * @return {devtools.ProfilerAgent} Profiler agent instance. |
| 81 */ |
| 82 devtools.ToolsAgent.prototype.getProfilerAgent = function() { |
| 83 return this.profilerAgent_; |
| 84 }; |
| 85 |
| 86 |
| 87 /** |
78 * @param {string} url Url frame navigated to. | 88 * @param {string} url Url frame navigated to. |
79 * @see tools_agent.h | 89 * @see tools_agent.h |
80 * @private | 90 * @private |
81 */ | 91 */ |
82 devtools.ToolsAgent.prototype.frameNavigate_ = function(url) { | 92 devtools.ToolsAgent.prototype.frameNavigate_ = function(url) { |
83 this.reset(); | 93 this.reset(); |
84 // Do not reset Profiles panel. | 94 // Do not reset Profiles panel. |
85 var profiles = null; | 95 var profiles = null; |
86 if ('profiles' in WebInspector.panels) { | 96 if ('profiles' in WebInspector.panels) { |
87 profiles = WebInspector.panels['profiles']; | 97 profiles = WebInspector.panels['profiles']; |
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
312 devtools.tools.getDebuggerAgent().initUI(); | 322 devtools.tools.getDebuggerAgent().initUI(); |
313 this.enableToggleButton.visible = false; | 323 this.enableToggleButton.visible = false; |
314 oldShow.call(this); | 324 oldShow.call(this); |
315 }; | 325 }; |
316 })(); | 326 })(); |
317 | 327 |
318 | 328 |
319 (function InterceptProfilesPanelEvents() { | 329 (function InterceptProfilesPanelEvents() { |
320 var oldShow = WebInspector.ProfilesPanel.prototype.show; | 330 var oldShow = WebInspector.ProfilesPanel.prototype.show; |
321 WebInspector.ProfilesPanel.prototype.show = function() { | 331 WebInspector.ProfilesPanel.prototype.show = function() { |
322 devtools.tools.getDebuggerAgent().initializeProfiling(); | 332 devtools.tools.getProfilerAgent().initializeProfiling(); |
323 this.enableToggleButton.visible = false; | 333 this.enableToggleButton.visible = false; |
324 oldShow.call(this); | 334 oldShow.call(this); |
325 // Show is called on every show event of a panel, so | 335 // Show is called on every show event of a panel, so |
326 // we only need to intercept it once. | 336 // we only need to intercept it once. |
327 WebInspector.ProfilesPanel.prototype.show = oldShow; | 337 WebInspector.ProfilesPanel.prototype.show = oldShow; |
328 }; | 338 }; |
329 })(); | 339 })(); |
330 | 340 |
331 | 341 |
332 /* | 342 /* |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
476 (function() { | 486 (function() { |
477 var originalAddToFrame = InspectorFrontendHost.addResourceSourceToFrame; | 487 var originalAddToFrame = InspectorFrontendHost.addResourceSourceToFrame; |
478 InspectorFrontendHost.addResourceSourceToFrame = function(identifier, element) { | 488 InspectorFrontendHost.addResourceSourceToFrame = function(identifier, element) { |
479 var resource = WebInspector.resources[identifier]; | 489 var resource = WebInspector.resources[identifier]; |
480 if (!resource) { | 490 if (!resource) { |
481 return; | 491 return; |
482 } | 492 } |
483 originalAddToFrame.call(this, identifier, resource.mimeType, element); | 493 originalAddToFrame.call(this, identifier, resource.mimeType, element); |
484 }; | 494 }; |
485 })(); | 495 })(); |
OLD | NEW |