diff options
author | yurys@google.com <yurys@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-04-02 06:54:15 +0000 |
---|---|---|
committer | yurys@google.com <yurys@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-04-02 06:54:15 +0000 |
commit | ce99295021b01038cd03d67e98b920c58c250578 (patch) | |
tree | bc091b87a43470695869eb79a308f4830993212e /chrome/renderer/devtools_agent.cc | |
parent | cd8f9778702ae1d7ff1585b73ea2a422e5375865 (diff) | |
download | chromium_src-ce99295021b01038cd03d67e98b920c58c250578.zip chromium_src-ce99295021b01038cd03d67e98b920c58c250578.tar.gz chromium_src-ce99295021b01038cd03d67e98b920c58c250578.tar.bz2 |
Debugger output is now handled on the render thread.
Review URL: http://codereview.chromium.org/60013
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@13007 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/renderer/devtools_agent.cc')
-rw-r--r-- | chrome/renderer/devtools_agent.cc | 24 |
1 files changed, 8 insertions, 16 deletions
diff --git a/chrome/renderer/devtools_agent.cc b/chrome/renderer/devtools_agent.cc index 7497cc6..2fe4ef6 100644 --- a/chrome/renderer/devtools_agent.cc +++ b/chrome/renderer/devtools_agent.cc @@ -32,7 +32,6 @@ DevToolsAgent::DevToolsAgent(int routing_id, : routing_id_(routing_id), view_(view), view_loop_(view_loop), - channel_(NULL), io_loop_(NULL) { } @@ -46,30 +45,20 @@ void DevToolsAgent::RenderViewDestroyed() { } void DevToolsAgent::Send(const IPC::Message& tools_client_message) { - // It's possible that this will get cleared out from under us. - MessageLoop* io_loop = io_loop_; - if (!io_loop) + DCHECK(MessageLoop::current() == view_loop_); + if (!view_) { return; + } IPC::Message* m = new ViewHostMsg_ForwardToDevToolsClient( routing_id_, tools_client_message); - io_loop->PostTask(FROM_HERE, NewRunnableMethod( - this, &DevToolsAgent::SendFromIOThread, m)); -} - -void DevToolsAgent::SendFromIOThread(IPC::Message* message) { - if (channel_) { - channel_->Send(message); - } else { - delete message; - } + view_->Send(m); } // Called on the IO thread. void DevToolsAgent::OnFilterAdded(IPC::Channel* channel) { io_loop_ = MessageLoop::current(); - channel_ = channel; } // Called on the IO thread. @@ -79,6 +68,10 @@ bool DevToolsAgent::OnMessageReceived(const IPC::Message& message) { if (message.routing_id() != routing_id_) return false; + // TODO(yurys): only DebuggerCommand message is handled on the IO thread + // all other messages could be handled in RenderView::OnMessageReceived. With + // that approach we wouldn't have to call view_loop_->PostTask for each of the + // messages. bool handled = true; IPC_BEGIN_MESSAGE_MAP(DevToolsAgent, message) IPC_MESSAGE_HANDLER(DevToolsAgentMsg_Attach, OnAttach) @@ -95,7 +88,6 @@ bool DevToolsAgent::OnMessageReceived(const IPC::Message& message) { // Called on the IO thread. void DevToolsAgent::OnFilterRemoved() { io_loop_ = NULL; - channel_ = NULL; } void DevToolsAgent::EvaluateScript(const std::wstring& script) { |