void DebuggerAgentManager::debugDetach(DebuggerAgentImpl* debuggerAgent) { #if ENABLE(V8_SCRIPT_DEBUG_SERVER) if (!s_exposeV8DebuggerProtocol) return; #endif if (!s_attachedAgentsMap) { ASSERT_NOT_REACHED(); return; } int hostId = debuggerAgent->webdevtoolsAgent()->hostId(); ASSERT(s_attachedAgentsMap->get(hostId) == debuggerAgent); bool isOnBreakpoint = (findAgentForCurrentV8Context() == debuggerAgent); s_attachedAgentsMap->remove(hostId); if (s_attachedAgentsMap->isEmpty()) { delete s_attachedAgentsMap; s_attachedAgentsMap = 0; // Note that we do not empty handlers while in dispatch - we schedule // 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 (!s_inHostDispatchHandler) { v8::Debug::SetMessageHandler2(0); v8::Debug::SetHostDispatchHandler(0); } } else { // Remove all breakpoints set by the agent. String clearBreakpointGroupCmd = String::format( "{\"seq\":1,\"type\":\"request\",\"command\":\"clearbreakpointgroup\"," "\"arguments\":{\"groupId\":%d}}", hostId); sendCommandToV8(clearBreakpointGroupCmd, new CallerIdWrapper()); if (isOnBreakpoint) { // 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(); } } }
void DebuggerAgentManager::sendContinueCommandToV8() { WTF::String continueCmd("{\"seq\":1,\"type\":\"request\",\"command\":\"continue\"}"); sendCommandToV8(continueCmd, new CallerIdWrapper()); }
void DebuggerAgentManager::executeDebuggerCommand(const WTF::String& command, int callerId) { sendCommandToV8(command, new CallerIdWrapper(callerId)); }