Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(9)

Unified Diff: webkit/glue/devtools/debugger_agent_manager.cc

Issue 155090: DevTools: clear breakpoints when devtools window is closing (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | webkit/glue/devtools/js/debugger_agent.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webkit/glue/devtools/debugger_agent_manager.cc
===================================================================
--- webkit/glue/devtools/debugger_agent_manager.cc (revision 19942)
+++ webkit/glue/devtools/debugger_agent_manager.cc (working copy)
@@ -120,18 +120,33 @@
}
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();
}
}
« no previous file with comments | « no previous file | webkit/glue/devtools/js/debugger_agent.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698