summaryrefslogtreecommitdiffstats
path: root/webkit
diff options
context:
space:
mode:
authoryurys@google.com <yurys@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-07-07 12:18:00 +0000
committeryurys@google.com <yurys@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-07-07 12:18:00 +0000
commit68649186ecf6ad9d9029c959f7201688bc6c7bd3 (patch)
treea7a514b749b03b47a48dffc2af9616009271fce9 /webkit
parent979fb44f0b83dd2a62e84012c188b51f6ccd809f (diff)
downloadchromium_src-68649186ecf6ad9d9029c959f7201688bc6c7bd3.zip
chromium_src-68649186ecf6ad9d9029c959f7201688bc6c7bd3.tar.gz
chromium_src-68649186ecf6ad9d9029c959f7201688bc6c7bd3.tar.bz2
DevTools: clear breakpoints when devtools window is closing. This change depends on v8 change: http://codereview.chromium.org/149197
BUG=15993 Review URL: http://codereview.chromium.org/155090 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@20020 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit')
-rw-r--r--webkit/glue/devtools/debugger_agent_manager.cc21
-rw-r--r--webkit/glue/devtools/js/debugger_agent.js2
2 files changed, 20 insertions, 3 deletions
diff --git a/webkit/glue/devtools/debugger_agent_manager.cc b/webkit/glue/devtools/debugger_agent_manager.cc
index d2f41d3..791831c 100644
--- a/webkit/glue/devtools/debugger_agent_manager.cc
+++ b/webkit/glue/devtools/debugger_agent_manager.cc
@@ -120,18 +120,33 @@ void DebuggerAgentManager::DebugDetach(DebuggerAgentImpl* debugger_agent) {
}
int host_id = debugger_agent->webdevtools_agent()->host_id();
DCHECK(attached_agents_map_->get(host_id) == debugger_agent);
+ bool is_on_breakpoint = (FindAgentForCurrentV8Context() == debugger_agent);
attached_agents_map_->remove(host_id);
if (attached_agents_map_->isEmpty()) {
delete attached_agents_map_;
attached_agents_map_ = NULL;
// Note that we do not empty handlers while in dispatch - we schedule
- // continue and do removal once we are out of the dispatch.
+ // continue and do removal once we are out of the dispatch. Also there is
+ // no need to send continue command in this case since removing message
+ // handler will cause debugger unload and all breakpoints will be cleared.
if (!in_host_dispatch_handler_) {
v8::Debug::SetMessageHandler2(NULL);
v8::Debug::SetHostDispatchHandler(NULL);
- } else if (FindAgentForCurrentV8Context() == debugger_agent) {
- // Force continue just in case to handle close while on a breakpoint.
+ }
+ } else {
+ // Remove all breakpoints set by the agent.
+ std::wstring clear_breakpoint_group_cmd(StringPrintf(
+ L"{\"seq\":1,\"type\":\"request\",\"command\":\"clearbreakpointgroup\","
+ L"\"arguments\":{\"groupId\":%d}}",
+ host_id));
+ SendCommandToV8(WideToUTF16(clear_breakpoint_group_cmd),
+ new CallerIdWrapper());
+
+ if (is_on_breakpoint) {
+ // Force continue if detach happened in nessted message loop while
+ // debugger was paused on a breakpoint(as long as there are other
+ // attached agents v8 will wait for explicit'continue' message).
SendContinueCommandToV8();
}
}
diff --git a/webkit/glue/devtools/js/debugger_agent.js b/webkit/glue/devtools/js/debugger_agent.js
index 251577c..bab5b4c 100644
--- a/webkit/glue/devtools/js/debugger_agent.js
+++ b/webkit/glue/devtools/js/debugger_agent.js
@@ -223,6 +223,7 @@ devtools.DebuggerAgent.prototype.addBreakpoint = function(sourceId, line) {
breakpoints[line] = breakpointInfo;
commandArguments = {
+ 'groupId': this.contextId_,
'type': 'script',
'target': script.getUrl(),
'line': line
@@ -237,6 +238,7 @@ devtools.DebuggerAgent.prototype.addBreakpoint = function(sourceId, line) {
script.addBreakpointInfo(breakpointInfo);
commandArguments = {
+ 'groupId': this.contextId_,
'type': 'scriptId',
'target': sourceId,
'line': line