diff options
author | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-03-03 00:21:56 +0000 |
---|---|---|
committer | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-03-03 00:21:56 +0000 |
commit | 9d4ff5edc11098ff872ddd9454216723f6a9b96d (patch) | |
tree | 8bcd359063e1bd8edc0d89c945babb7f2d514b9c | |
parent | 2af820051c41917a00f7ef58863cc8754e0f5943 (diff) | |
download | chromium_src-9d4ff5edc11098ff872ddd9454216723f6a9b96d.zip chromium_src-9d4ff5edc11098ff872ddd9454216723f6a9b96d.tar.gz chromium_src-9d4ff5edc11098ff872ddd9454216723f6a9b96d.tar.bz2 |
Add some speculative MessageLoop::RunAllPending calls to IPC::SyncChannel unittest to try to solve intermittent memory leaks in those tests.
Review URL: http://codereview.chromium.org/27360
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@10753 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/common/ipc_sync_channel_unittest.cc | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/chrome/common/ipc_sync_channel_unittest.cc b/chrome/common/ipc_sync_channel_unittest.cc index f59cced..6e00fca 100644 --- a/chrome/common/ipc_sync_channel_unittest.cc +++ b/chrome/common/ipc_sync_channel_unittest.cc @@ -57,7 +57,7 @@ class Worker : public Channel::Listener, public Message::Sender { virtual ~Worker() { WaitableEvent listener_done(false, false), ipc_done(false, false); ListenerThread()->message_loop()->PostTask(FROM_HERE, NewRunnableMethod( - this, &Worker::OnListenerThreadShutdown, &listener_done, + this, &Worker::OnListenerThreadShutdown1, &listener_done, &ipc_done)); listener_done.Wait(); ipc_done.Wait(); @@ -148,18 +148,29 @@ class Worker : public Channel::Listener, public Message::Sender { Run(); } - void OnListenerThreadShutdown(WaitableEvent* listener_event, - WaitableEvent* ipc_event) { + void OnListenerThreadShutdown1(WaitableEvent* listener_event, + WaitableEvent* ipc_event) { // SyncChannel needs to be destructed on the thread that it was created on. channel_.reset(); - listener_event->Signal(); + + MessageLoop::current()->RunAllPending(); ipc_thread_.message_loop()->PostTask(FROM_HERE, NewRunnableMethod( - this, &Worker::OnIPCThreadShutdown, ipc_event)); + this, &Worker::OnIPCThreadShutdown, listener_event, ipc_event)); } - void OnIPCThreadShutdown(WaitableEvent* ipc_event) { + void OnIPCThreadShutdown(WaitableEvent* listener_event, + WaitableEvent* ipc_event) { + MessageLoop::current()->RunAllPending(); ipc_event->Signal(); + + listener_thread_.message_loop()->PostTask(FROM_HERE, NewRunnableMethod( + this, &Worker::OnListenerThreadShutdown2, listener_event)); + } + + void OnListenerThreadShutdown2(WaitableEvent* listener_event) { + MessageLoop::current()->RunAllPending(); + listener_event->Signal(); } void OnMessageReceived(const Message& message) { |