diff options
author | sievers@chromium.org <sievers@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-09-16 09:38:38 +0000 |
---|---|---|
committer | sievers@chromium.org <sievers@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-09-16 09:38:38 +0000 |
commit | 306923f4a29a9d593eb81d5a72ce6952344cc941 (patch) | |
tree | 25d27d3aa5a2d02946524fa0ae63612ecaa79aad /ipc | |
parent | 8b20c9cf69fd6082b927655c8ff96c2be29a472a (diff) | |
download | chromium_src-306923f4a29a9d593eb81d5a72ce6952344cc941.zip chromium_src-306923f4a29a9d593eb81d5a72ce6952344cc941.tar.gz chromium_src-306923f4a29a9d593eb81d5a72ce6952344cc941.tar.bz2 |
Have SyncMessageFilter hold a reference to MessageLoopProxy instead of a weak pointer.
BUG=95867
Review URL: http://codereview.chromium.org/7908013
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@101473 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ipc')
-rw-r--r-- | ipc/ipc_sync_message_filter.cc | 15 | ||||
-rw-r--r-- | ipc/ipc_sync_message_filter.h | 10 |
2 files changed, 14 insertions, 11 deletions
diff --git a/ipc/ipc_sync_message_filter.cc b/ipc/ipc_sync_message_filter.cc index cffbaa6..c7a184c 100644 --- a/ipc/ipc_sync_message_filter.cc +++ b/ipc/ipc_sync_message_filter.cc @@ -1,20 +1,21 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "ipc/ipc_sync_message_filter.h" #include "base/logging.h" -#include "base/message_loop.h" +#include "base/message_loop_proxy.h" #include "base/synchronization/waitable_event.h" #include "ipc/ipc_sync_message.h" +using base::MessageLoopProxy; + namespace IPC { SyncMessageFilter::SyncMessageFilter(base::WaitableEvent* shutdown_event) : channel_(NULL), - listener_loop_(MessageLoop::current()), - io_loop_(NULL), + listener_loop_(MessageLoopProxy::current()), shutdown_event_(shutdown_event) { } @@ -47,8 +48,8 @@ bool SyncMessageFilter::Send(Message* message) { base::AutoLock auto_lock(lock_); // Can't use this class on the main thread or else it can lead to deadlocks. // Also by definition, can't use this on IO thread since we're blocking it. - DCHECK(MessageLoop::current() != listener_loop_); - DCHECK(MessageLoop::current() != io_loop_); + DCHECK(MessageLoopProxy::current() != listener_loop_); + DCHECK(MessageLoopProxy::current() != io_loop_); pending_sync_messages_.insert(&pending_message); } @@ -94,7 +95,7 @@ void SyncMessageFilter::SignalAllEvents() { void SyncMessageFilter::OnFilterAdded(Channel* channel) { channel_ = channel; base::AutoLock auto_lock(lock_); - io_loop_ = MessageLoop::current(); + io_loop_ = MessageLoopProxy::current(); } void SyncMessageFilter::OnChannelError() { diff --git a/ipc/ipc_sync_message_filter.h b/ipc/ipc_sync_message_filter.h index 0dc471a..cdaef85 100644 --- a/ipc/ipc_sync_message_filter.h +++ b/ipc/ipc_sync_message_filter.h @@ -14,11 +14,10 @@ #include <set> namespace base { +class MessageLoopProxy; class WaitableEvent; } -class MessageLoop; - namespace IPC { class MessageReplyDeserializer; @@ -51,8 +50,11 @@ class IPC_EXPORT SyncMessageFilter : public ChannelProxy::MessageFilter, // The channel to which this filter was added. Channel* channel_; - MessageLoop* listener_loop_; // The process's main thread. - MessageLoop* io_loop_; // The message loop where the Channel lives. + // The process's main thread. + scoped_refptr<base::MessageLoopProxy> listener_loop_; + + // The message loop where the Channel lives. + scoped_refptr<base::MessageLoopProxy> io_loop_; typedef std::set<PendingSyncMsg*> PendingSyncMessages; PendingSyncMessages pending_sync_messages_; |