summaryrefslogtreecommitdiffstats
path: root/webkit/glue/devtools/debugger_agent_manager.cc
diff options
context:
space:
mode:
authorpfeldman@chromium.org <pfeldman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-04-22 11:33:05 +0000
committerpfeldman@chromium.org <pfeldman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-04-22 11:33:05 +0000
commitb4b967edacf8e291f78df2c8238e3446922a179f (patch)
tree621b8c0eedf48e7cb346f31277ce3b34a30cb99a /webkit/glue/devtools/debugger_agent_manager.cc
parent57b4ef12d0f726a79a3fa023cd6bb32b51925be8 (diff)
downloadchromium_src-b4b967edacf8e291f78df2c8238e3446922a179f.zip
chromium_src-b4b967edacf8e291f78df2c8238e3446922a179f.tar.gz
chromium_src-b4b967edacf8e291f78df2c8238e3446922a179f.tar.bz2
DevTools: Run nested message loop instead of whitelisting the messages.
Review URL: http://codereview.chromium.org/90007 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@14183 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/glue/devtools/debugger_agent_manager.cc')
-rw-r--r--webkit/glue/devtools/debugger_agent_manager.cc33
1 files changed, 15 insertions, 18 deletions
diff --git a/webkit/glue/devtools/debugger_agent_manager.cc b/webkit/glue/devtools/debugger_agent_manager.cc
index ef37b7d..907dd76 100644
--- a/webkit/glue/devtools/debugger_agent_manager.cc
+++ b/webkit/glue/devtools/debugger_agent_manager.cc
@@ -21,6 +21,8 @@
#include "v8/include/v8-debug.h"
#endif
+WebDevToolsAgent::MessageLoopDispatchHandler
+ DebuggerAgentManager::message_loop_dispatch_handler_ = NULL;
// static
void DebuggerAgentManager::V8DebugMessageHandler(const uint16_t* message,
@@ -33,13 +35,13 @@ void DebuggerAgentManager::V8DebugMessageHandler(const uint16_t* message,
#endif
}
-void DebuggerAgentManager::V8DebugHostDispatchHandler(
- void* dispatch,
- void* data) {
- WebDevToolsAgent::Message* m =
- reinterpret_cast<WebDevToolsAgent::Message*>(dispatch);
- m->Dispatch();
- delete m;
+void DebuggerAgentManager::V8DebugHostDispatchHandler() {
+ if (DebuggerAgentManager::message_loop_dispatch_handler_
+ && attached_agents_) {
+ DebuggerAgentImpl::RunWithDeferredMessages(
+ *attached_agents_,
+ message_loop_dispatch_handler_);
+ }
}
// static
@@ -53,11 +55,10 @@ void DebuggerAgentManager::DebugAttach(DebuggerAgentImpl* debugger_agent) {
attached_agents_ = new AttachedAgentsSet();
v8::Debug::SetMessageHandler(
&DebuggerAgentManager::V8DebugMessageHandler,
- NULL, /* no additional data */
false /* don't create separate thread for sending debugger output */);
- v8::Debug::SetHostDispatchHandler(
- &DebuggerAgentManager::V8DebugHostDispatchHandler,
- NULL /* no additional data */);
+ // TODO(pfeldman): Uncomment once V8 changes are landed.
+// v8::Debug::SetHostDispatchHandler(
+// &DebuggerAgentManager::V8DebugHostDispatchHandler, 100 /* ms */);
}
attached_agents_->add(debugger_agent);
#endif
@@ -165,7 +166,6 @@ bool DebuggerAgentManager::SendCommandResponse(DictionaryValue* response) {
return true;
}
-
// static
void DebuggerAgentManager::ExecuteDebuggerCommand(
const std::string& command,
@@ -178,11 +178,9 @@ void DebuggerAgentManager::ExecuteDebuggerCommand(
}
// static
-void DebuggerAgentManager::ScheduleMessageDispatch(
- WebDevToolsAgent::Message* message) {
-#if USE(V8)
- v8::Debug::SendHostDispatch(message);
-#endif
+void DebuggerAgentManager::SetMessageLoopDispatchHandler(
+ WebDevToolsAgent::MessageLoopDispatchHandler handler) {
+ message_loop_dispatch_handler_ = handler;
}
// static
@@ -193,7 +191,6 @@ void DebuggerAgentManager::SendCommandToV8(const std::wstring& cmd) {
#endif
}
-
// static
DebuggerAgentImpl* DebuggerAgentManager::FindAgentForCurrentV8Context() {
if (!attached_agents_) {