diff options
author | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-11-05 21:53:08 +0000 |
---|---|---|
committer | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-11-05 21:53:08 +0000 |
commit | 877d55dcd3e01d1db858f154a1f369e76b2ebaf2 (patch) | |
tree | ee2364ca767826deed3d541603d6c92ca2f0062e /ipc | |
parent | aaa47ee9d83f773d37aa4fd4a04097425ce62063 (diff) | |
download | chromium_src-877d55dcd3e01d1db858f154a1f369e76b2ebaf2.zip chromium_src-877d55dcd3e01d1db858f154a1f369e76b2ebaf2.tar.gz chromium_src-877d55dcd3e01d1db858f154a1f369e76b2ebaf2.tar.bz2 |
First patch in making destructors of refcounted objects private.
BUG=26749
Review URL: http://codereview.chromium.org/360042
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@31136 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ipc')
-rw-r--r-- | ipc/file_descriptor_set_posix.h | 5 | ||||
-rw-r--r-- | ipc/ipc_channel_proxy.cc | 6 | ||||
-rw-r--r-- | ipc/ipc_channel_proxy.h | 16 | ||||
-rw-r--r-- | ipc/ipc_sync_channel.cc | 7 | ||||
-rw-r--r-- | ipc/ipc_sync_channel.h | 5 |
5 files changed, 21 insertions, 18 deletions
diff --git a/ipc/file_descriptor_set_posix.h b/ipc/file_descriptor_set_posix.h index c3d26ba8..7653eb6 100644 --- a/ipc/file_descriptor_set_posix.h +++ b/ipc/file_descriptor_set_posix.h @@ -19,7 +19,6 @@ class FileDescriptorSet : public base::RefCountedThreadSafe<FileDescriptorSet> { public: FileDescriptorSet(); - ~FileDescriptorSet(); // This is the maximum number of descriptors per message. We need to know this // because the control message kernel interface has to be given a buffer which @@ -90,6 +89,10 @@ class FileDescriptorSet : public base::RefCountedThreadSafe<FileDescriptorSet> { // --------------------------------------------------------------------------- private: + friend class base::RefCountedThreadSafe<FileDescriptorSet>; + + ~FileDescriptorSet(); + // A vector of descriptors and close flags. If this message is sent, then // these descriptors are sent as control data. After sending, any descriptors // with a true flag are closed. If this message has been received, then these diff --git a/ipc/ipc_channel_proxy.cc b/ipc/ipc_channel_proxy.cc index 4d13b2b8..cbe8cc2 100644 --- a/ipc/ipc_channel_proxy.cc +++ b/ipc/ipc_channel_proxy.cc @@ -10,12 +10,6 @@ namespace IPC { -// static -void ChannelProxy::MessageFilterTraits::Destruct( - ChannelProxy::MessageFilter* filter) { - filter->OnDestruct(); -} - //------------------------------------------------------------------------------ // This task ensures the message is deleted if the task is deleted without diff --git a/ipc/ipc_channel_proxy.h b/ipc/ipc_channel_proxy.h index 3369f50..aee6dae 100644 --- a/ipc/ipc_channel_proxy.h +++ b/ipc/ipc_channel_proxy.h @@ -47,10 +47,7 @@ class SendTask; class ChannelProxy : public Message::Sender { public: - class MessageFilter; - struct MessageFilterTraits { - static void Destruct(MessageFilter* filter); - }; + struct MessageFilterTraits; // A class that receives messages on the thread where the IPC channel is // running. It can choose to prevent the default action for an IPC message. @@ -95,6 +92,12 @@ class ChannelProxy : public Message::Sender { } }; + struct MessageFilterTraits { + static void Destruct(MessageFilter* filter) { + filter->OnDestruct(); + } + }; + // Initializes a channel proxy. The channel_id and mode parameters are // passed directly to the underlying IPC::Channel. The listener is called on // the thread that creates the ChannelProxy. The filter's OnMessageReceived @@ -158,7 +161,6 @@ class ChannelProxy : public Message::Sender { public: Context(Channel::Listener* listener, MessageFilter* filter, MessageLoop* ipc_thread); - virtual ~Context() { } void ClearIPCMessageLoop() { ipc_message_loop_ = NULL; } MessageLoop* ipc_message_loop() const { return ipc_message_loop_; } const std::string& channel_id() const { return channel_id_; } @@ -167,6 +169,9 @@ class ChannelProxy : public Message::Sender { void OnDispatchMessage(const Message& message); protected: + friend class base::RefCountedThreadSafe<Context>; + virtual ~Context() { } + // IPC::Channel::Listener methods: virtual void OnMessageReceived(const Message& message); virtual void OnChannelConnected(int32 peer_pid); @@ -191,6 +196,7 @@ class ChannelProxy : public Message::Sender { private: friend class ChannelProxy; friend class SendTask; + // Create the Channel void CreateChannel(const std::string& id, const Channel::Mode& mode); diff --git a/ipc/ipc_sync_channel.cc b/ipc/ipc_sync_channel.cc index 784b835..d34ea6f 100644 --- a/ipc/ipc_sync_channel.cc +++ b/ipc/ipc_sync_channel.cc @@ -51,9 +51,6 @@ class SyncChannel::ReceivedSyncMsgQueue : return rv; } - ~ReceivedSyncMsgQueue() { - } - // Called on IPC thread when a synchronous message or reply arrives. void QueueMessage(const Message& msg, SyncChannel::SyncContext* context) { bool was_task_pending; @@ -157,6 +154,8 @@ class SyncChannel::ReceivedSyncMsgQueue : } private: + friend class base::RefCountedThreadSafe<ReceivedSyncMsgQueue>; + // See the comment in SyncChannel::SyncChannel for why this event is created // as manual reset. ReceivedSyncMsgQueue() : @@ -167,6 +166,8 @@ class SyncChannel::ReceivedSyncMsgQueue : top_send_done_watcher_(NULL) { } + ~ReceivedSyncMsgQueue() {} + // Holds information about a queued synchronous message or reply. struct QueuedMessage { QueuedMessage(Message* m, SyncContext* c) : message(m), context(c) { } diff --git a/ipc/ipc_sync_channel.h b/ipc/ipc_sync_channel.h index 1c7360d..cde293a58 100644 --- a/ipc/ipc_sync_channel.h +++ b/ipc/ipc_sync_channel.h @@ -61,8 +61,6 @@ class SyncChannel : public ChannelProxy, MessageLoop* ipc_thread, base::WaitableEvent* shutdown_event); - ~SyncContext(); - // Adds information about an outgoing sync message to the context so that // we know how to deserialize the reply. void Push(IPC::SyncMessage* sync_msg); @@ -97,10 +95,11 @@ class SyncChannel : public ChannelProxy, } private: + ~SyncContext(); // IPC::ChannelProxy methods that we override. // Called on the listener thread. - virtual void Clear(); + virtual void Clear(); // Called on the IPC thread. virtual void OnMessageReceived(const Message& msg); |