diff options
author | pfeldman@chromium.org <pfeldman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-07-08 15:19:00 +0000 |
---|---|---|
committer | pfeldman@chromium.org <pfeldman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-07-08 15:19:00 +0000 |
commit | c09a47cef0a96e98ed4c6b45cfe13da4be171ec0 (patch) | |
tree | 2c22bc4a3703ba57b8d07a11d6839dc7fe952e82 /webkit | |
parent | 3641da6c02910960ef419d38a161081a9ce1d7b2 (diff) | |
download | chromium_src-c09a47cef0a96e98ed4c6b45cfe13da4be171ec0.zip chromium_src-c09a47cef0a96e98ed4c6b45cfe13da4be171ec0.tar.gz chromium_src-c09a47cef0a96e98ed4c6b45cfe13da4be171ec0.tar.bz2 |
DevTools: Push context id to the client on 'window object cleared' event.
Review URL: http://codereview.chromium.org/155217
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@20146 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit')
-rw-r--r-- | webkit/glue/devtools/debugger_agent.h | 4 | ||||
-rw-r--r-- | webkit/glue/devtools/debugger_agent_impl.cc | 2 | ||||
-rw-r--r-- | webkit/glue/devtools/js/debugger_agent.js | 32 | ||||
-rw-r--r-- | webkit/glue/devtools/js/devtools.js | 2 | ||||
-rw-r--r-- | webkit/glue/webdevtoolsagent_impl.cc | 4 |
5 files changed, 19 insertions, 25 deletions
diff --git a/webkit/glue/devtools/debugger_agent.h b/webkit/glue/devtools/debugger_agent.h index 087bf6c..7b4bada 100644 --- a/webkit/glue/devtools/debugger_agent.h +++ b/webkit/glue/devtools/debugger_agent.h @@ -35,8 +35,8 @@ DEFINE_RPC_CLASS(DebuggerAgent, DEBUGGER_AGENT_STRUCT) METHOD4) \ METHOD1(DebuggerOutput, std::string /* output text */) \ \ - /* Response to GetContextId. */ \ - METHOD1(DidGetContextId, int /* context id */) \ + /* Pushes debugger context id into the client. */ \ + METHOD1(SetContextId, int /* context id */) \ \ /* Response to IsProfilingStarted. */ \ METHOD1(DidIsProfilingStarted, bool /* is_started */) \ diff --git a/webkit/glue/devtools/debugger_agent_impl.cc b/webkit/glue/devtools/debugger_agent_impl.cc index b1378c6..7ab0fb1 100644 --- a/webkit/glue/devtools/debugger_agent_impl.cc +++ b/webkit/glue/devtools/debugger_agent_impl.cc @@ -55,7 +55,7 @@ void DebuggerAgentImpl::DebugBreak() { } void DebuggerAgentImpl::GetContextId() { - delegate_->DidGetContextId(webdevtools_agent_->host_id()); + delegate_->SetContextId(webdevtools_agent_->host_id()); } void DebuggerAgentImpl::StartProfiling() { diff --git a/webkit/glue/devtools/js/debugger_agent.js b/webkit/glue/devtools/js/debugger_agent.js index d1fcf26d..112bb5c 100644 --- a/webkit/glue/devtools/js/debugger_agent.js +++ b/webkit/glue/devtools/js/debugger_agent.js @@ -15,8 +15,8 @@ goog.provide('devtools.DebuggerAgent'); devtools.DebuggerAgent = function() { RemoteDebuggerAgent.DebuggerOutput = goog.bind(this.handleDebuggerOutput_, this); - RemoteDebuggerAgent.DidGetContextId = - goog.bind(this.didGetContextId_, this); + RemoteDebuggerAgent.SetContextId = + goog.bind(this.setContextId_, this); RemoteDebuggerAgent.DidIsProfilingStarted = goog.bind(this.didIsProfilingStarted_, this); RemoteDebuggerAgent.DidGetNextLogLines = @@ -119,26 +119,18 @@ devtools.DebuggerAgent.prototype.reset = function() { /** - * Requests scripts list if it has not been requested yet. - */ -devtools.DebuggerAgent.prototype.initializeScriptsCache = function() { - if (!this.scriptsCacheInitialized_) { - this.scriptsCacheInitialized_ = true; - this.requestScripts(); - } -}; - - -/** * Asynchronously requests for all parsed script sources. Response will be * processed in handleScriptsResponse_. */ devtools.DebuggerAgent.prototype.requestScripts = function() { - if (this.contextId_ === null) { - // Update context id first to filter the scripts. - RemoteDebuggerAgent.GetContextId(); + if (this.contextId_) { + // We already have context id. This means that we are here from the + // very beginning of the page load cycle and hence will get all scripts + // via after-compile events. No need to request scripts for this session. return; } + + RemoteDebuggerAgent.GetContextId(); var cmd = new devtools.DebugCommand('scripts', { 'includeSource': false }); @@ -545,13 +537,11 @@ devtools.DebuggerAgent.prototype.requestLookup_ = function(handles, callback) { /** - * Handles GetContextId response. + * Sets debugger context id for scripts filtering. * @param {number} contextId Id of the inspected page global context. */ -devtools.DebuggerAgent.prototype.didGetContextId_ = function(contextId) { +devtools.DebuggerAgent.prototype.setContextId_ = function(contextId) { this.contextId_ = contextId; - // Update scripts. - this.requestScripts(); }; @@ -719,7 +709,7 @@ devtools.DebuggerAgent.prototype.handleSetBreakpointResponse_ = function(msg) { * @param {devtools.DebuggerMessage} msg */ devtools.DebuggerAgent.prototype.handleAfterCompileEvent_ = function(msg) { - if (!this.scriptsCacheInitialized_) { + if (!this.contextId_) { // Ignore scripts delta if main request has not been issued yet. return; } diff --git a/webkit/glue/devtools/js/devtools.js b/webkit/glue/devtools/js/devtools.js index cc5f454..5fd1be2 100644 --- a/webkit/glue/devtools/js/devtools.js +++ b/webkit/glue/devtools/js/devtools.js @@ -906,7 +906,7 @@ WebInspector.ScriptsPanel.prototype.doEvalInCallFrame = (function() { var oldShow = WebInspector.ScriptsPanel.prototype.show; WebInspector.ScriptsPanel.prototype.show = function() { - devtools.tools.getDebuggerAgent().initializeScriptsCache(); + devtools.tools.getDebuggerAgent().requestScripts(); this.enableToggleButton.addStyleClass('hidden'); oldShow.call(this); }; diff --git a/webkit/glue/webdevtoolsagent_impl.cc b/webkit/glue/webdevtoolsagent_impl.cc index cabcdd7..a4fb566 100644 --- a/webkit/glue/webdevtoolsagent_impl.cc +++ b/webkit/glue/webdevtoolsagent_impl.cc @@ -167,6 +167,10 @@ void WebDevToolsAgentImpl::DidCommitLoadForFrame( void WebDevToolsAgentImpl::WindowObjectCleared(WebFrameImpl* webframe) { DebuggerAgentManager::SetHostId(webframe, host_id_); + if (attached_) { + // Push context id into the client if it is already attached. + debugger_agent_delegate_stub_->SetContextId(host_id_); + } } void WebDevToolsAgentImpl::ForceRepaint() { |