diff options
-rw-r--r-- | base/message_loop.cc | 9 | ||||
-rw-r--r-- | base/message_loop.h | 4 | ||||
-rw-r--r-- | chrome/renderer/renderer_webkitclient_impl.cc | 6 | ||||
-rw-r--r-- | ipc/ipc_sync_channel.cc | 2 |
4 files changed, 15 insertions, 6 deletions
diff --git a/base/message_loop.cc b/base/message_loop.cc index dbe780a..6a73124 100644 --- a/base/message_loop.cc +++ b/base/message_loop.cc @@ -233,6 +233,15 @@ void MessageLoop::Quit() { } } +void MessageLoop::QuitNow() { + DCHECK(current() == this); + if (state_) { + pump_->Quit(); + } else { + NOTREACHED() << "Must be inside Run to call Quit"; + } +} + void MessageLoop::PostTask( const tracked_objects::Location& from_here, Task* task) { PostTask_Helper(from_here, task, 0, true); diff --git a/base/message_loop.h b/base/message_loop.h index 0338963..1a04323 100644 --- a/base/message_loop.h +++ b/base/message_loop.h @@ -158,6 +158,10 @@ class MessageLoop : public base::MessagePump::Delegate { // void Quit(); + // This method is a variant of Quit, that does not wait for pending messages + // to be processed before returning from Run. + void QuitNow(); + // Invokes Quit on the current MessageLoop when run. Useful to schedule an // arbitrary MessageLoop to Quit. class QuitTask : public Task { diff --git a/chrome/renderer/renderer_webkitclient_impl.cc b/chrome/renderer/renderer_webkitclient_impl.cc index 9b7327d..9a834ea 100644 --- a/chrome/renderer/renderer_webkitclient_impl.cc +++ b/chrome/renderer/renderer_webkitclient_impl.cc @@ -131,12 +131,8 @@ WebString RendererWebKitClientImpl::cookies( // when there is no active script context. int32 routing_id = RenderThread::RoutingIDForCurrentContext(); - // TODO(darin): We should use SendAndRunNestedMessageLoop here to avoid dead- - // locking the browser, but this causes a performance regression. Switching - // back to Send to verify. See http://crbug.com/36310. - std::string value_utf8; - RenderThread::current()->Send( + RenderThread::current()->SendAndRunNestedMessageLoop( new ViewHostMsg_GetCookies(routing_id, url, first_party_for_cookies, &value_utf8)); diff --git a/ipc/ipc_sync_channel.cc b/ipc/ipc_sync_channel.cc index 3aa7a26..bb0a245 100644 --- a/ipc/ipc_sync_channel.cc +++ b/ipc/ipc_sync_channel.cc @@ -350,7 +350,7 @@ void SyncChannel::SyncContext::OnWaitableEventSignaled(WaitableEvent* event) { } else { // We got the reply, timed out or the process shutdown. DCHECK(event == GetSendDoneEvent()); - MessageLoop::current()->Quit(); + MessageLoop::current()->QuitNow(); } } |