summaryrefslogtreecommitdiffstats
path: root/ipc/ipc_sync_channel.h
diff options
context:
space:
mode:
authordmichael@chromium.org <dmichael@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-01-31 23:14:27 +0000
committerdmichael@chromium.org <dmichael@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-01-31 23:14:27 +0000
commit1eaa5479c4a0a2a4667bfd4a73b0d2892dd18d6d (patch)
tree5d6554291d650602264feb2df80ab53073344141 /ipc/ipc_sync_channel.h
parenta60adb56fb30b9e00116e425219e486d6ade6ef9 (diff)
downloadchromium_src-1eaa5479c4a0a2a4667bfd4a73b0d2892dd18d6d.zip
chromium_src-1eaa5479c4a0a2a4667bfd4a73b0d2892dd18d6d.tar.gz
chromium_src-1eaa5479c4a0a2a4667bfd4a73b0d2892dd18d6d.tar.bz2
Revert 179987
Caused memory leak: Leak_DefinitelyLost 4,196 (1,600 direct, 2,596 indirect) bytes in 4 blocks are definitely lost in loss record 608 of 639 operator new(unsigned long) (m_replacemalloc/vg_replace_malloc.c:1140) IPC::SyncChannel::SyncChannel(IPC::ChannelHandle const&, IPC::Channel::Mode, IPC::Listener*, base::SingleThreadTaskRunner*, bool, base::WaitableEvent*) (ipc/ipc_sync_channel.cc:410) (anonymous namespace)::RestrictedDispatchPipeWorker::Run() (ipc/ipc_sync_channel_unittest.cc:1636) (anonymous namespace)::Worker::OnStart() (ipc/ipc_sync_channel_unittest.cc:176) Suppression (error hash=#2A77226DFEFF6041#): For more info on using suppressions see http://dev.chromium.org/developers/tree-sheriffs/sheriff-details-chromium/memory-sheriff#TOC-Suppressing-memory-reports { <insert_a_suppression_name_here> Memcheck:Leak fun:_Znw* fun:_ZN3IPC11SyncChannelC1ERKNS_13ChannelHandleENS_7Channel4ModeEPNS_8ListenerEPN4base22SingleThreadTaskRunnerEbPNS8_13WaitableEventE fun:_ZN12_GLOBAL__N_128RestrictedDispatchPipeWorker3RunEv fun:_ZN12_GLOBAL__N_16Worker7OnStartEv } 15:02:51 memcheck_a http://build.chromium.org/p/chromium.memory.fyi/builders/Chromium%20OS%20%28valgrind%29%282%29/builds/22101 > Refactor: Simplify WaitableEventWatcher. > > This change uses a callback instead of a delegate for specifying what > should be called when a WaitableEvent occurs. > > This simplifies the class and gets rid of a workaround internal to the > class to prevent name collision on "Delegate" inner classes. > > Tested (on linux and windows): > ninja -C out/Debug chrome > out/Debug/base_unittests --gtest_filter=*WaitableEventWatcherTest* > > BUG= > > > Review URL: https://chromiumcodereview.appspot.com/11953112 TBR=teravest@chromium.org Review URL: https://codereview.chromium.org/12087120 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@179993 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ipc/ipc_sync_channel.h')
-rw-r--r--ipc/ipc_sync_channel.h18
1 files changed, 8 insertions, 10 deletions
diff --git a/ipc/ipc_sync_channel.h b/ipc/ipc_sync_channel.h
index 7b34b72..87fc1f4 100644
--- a/ipc/ipc_sync_channel.h
+++ b/ipc/ipc_sync_channel.h
@@ -58,7 +58,8 @@ class SyncMessage;
// is more than this object. If the message loop goes away while this object
// is running and it's used to send a message, then it will use the invalid
// message loop pointer to proxy it to the ipc thread.
-class IPC_EXPORT SyncChannel : public ChannelProxy {
+class IPC_EXPORT SyncChannel : public ChannelProxy,
+ public base::WaitableEventWatcher::Delegate {
public:
enum RestrictDispatchGroup {
kRestrictDispatchGroup_None = 0,
@@ -114,7 +115,8 @@ class IPC_EXPORT SyncChannel : public ChannelProxy {
// SyncContext holds the per object data for SyncChannel, so that SyncChannel
// can be deleted while it's being used in a different thread. See
// ChannelProxy::Context for more information.
- class SyncContext : public Context {
+ class SyncContext : public Context,
+ public base::WaitableEventWatcher::Delegate {
public:
SyncContext(Listener* listener,
base::SingleThreadTaskRunner* ipc_task_runner,
@@ -148,10 +150,6 @@ class IPC_EXPORT SyncChannel : public ChannelProxy {
void OnSendTimeout(int message_id);
base::WaitableEvent* shutdown_event() { return shutdown_event_; }
- base::WaitableEventWatcher::EventCallback
- shutdown_watcher_callback() const {
- return shutdown_watcher_callback_;
- }
ReceivedSyncMsgQueue* received_sync_msgs() {
return received_sync_msgs_;
@@ -181,7 +179,8 @@ class IPC_EXPORT SyncChannel : public ChannelProxy {
// Cancels all pending Send calls.
void CancelPendingSends();
- void OnWaitableEventSignaled(base::WaitableEvent* arg);
+ // WaitableEventWatcher::Delegate implementation.
+ virtual void OnWaitableEventSignaled(base::WaitableEvent* arg) OVERRIDE;
typedef std::deque<PendingSyncMsg> PendingSyncMessageQueue;
PendingSyncMessageQueue deserializers_;
@@ -191,12 +190,12 @@ class IPC_EXPORT SyncChannel : public ChannelProxy {
base::WaitableEvent* shutdown_event_;
base::WaitableEventWatcher shutdown_watcher_;
- base::WaitableEventWatcher::EventCallback shutdown_watcher_callback_;
int restrict_dispatch_group_;
};
private:
- void OnWaitableEventSignaled(base::WaitableEvent* arg);
+ // WaitableEventWatcher::Delegate implementation.
+ virtual void OnWaitableEventSignaled(base::WaitableEvent* arg) OVERRIDE;
SyncContext* sync_context() {
return reinterpret_cast<SyncContext*>(context());
@@ -218,7 +217,6 @@ class IPC_EXPORT SyncChannel : public ChannelProxy {
// Used to signal events between the IPC and listener threads.
base::WaitableEventWatcher dispatch_watcher_;
- base::Callback<void(base::WaitableEvent*)> dispatch_watcher_callback_;
DISALLOW_COPY_AND_ASSIGN(SyncChannel);
};