diff options
author | dcheng <dcheng@chromium.org> | 2014-10-21 11:02:42 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2014-10-21 18:03:14 +0000 |
commit | f3076af7e0dfc078e65039a0e6faebf9a7628a63 (patch) | |
tree | 7f14d722c23f05db0cf60f94acb20c246af059c7 | |
parent | 4f91ee56e740bc766dfd8964a3adbb776465cf87 (diff) | |
download | chromium_src-f3076af7e0dfc078e65039a0e6faebf9a7628a63.zip chromium_src-f3076af7e0dfc078e65039a0e6faebf9a7628a63.tar.gz chromium_src-f3076af7e0dfc078e65039a0e6faebf9a7628a63.tar.bz2 |
Revert of Standardize usage of virtual/override/final in ipc/ (patchset #1 id:1 of https://codereview.chromium.org/645623006/)
Reason for revert:
Addressing reviewer comments in a followup patch.
Original issue's description:
> Standardize usage of virtual/override/final in ipc/
>
> This patch was automatically generated by applying clang fixit hints
> generated by the plugin to the source tree.
>
> BUG=417463
> TBR=agl@chromium.org
>
> Committed: https://crrev.com/39be52ebbd6681c7d79ad63e2a0ab028075af0c2
> Cr-Commit-Position: refs/heads/master@{#300481}
TBR=agl@chromium.org
NOTREECHECKS=true
NOTRY=true
BUG=417463
Review URL: https://codereview.chromium.org/669953003
Cr-Commit-Position: refs/heads/master@{#300521}
30 files changed, 275 insertions, 241 deletions
diff --git a/ipc/ipc_channel.h b/ipc/ipc_channel.h index 2d8d449..a7982e5 100644 --- a/ipc/ipc_channel.h +++ b/ipc/ipc_channel.h @@ -143,7 +143,8 @@ class IPC_EXPORT Channel : public Sender { static scoped_ptr<Channel> CreateServer( const IPC::ChannelHandle &channel_handle, Listener* listener); - ~Channel() override; + + virtual ~Channel(); // Connect the pipe. On the server side, this will initiate // waiting for connections. On the client, it attempts to diff --git a/ipc/ipc_channel_factory.cc b/ipc/ipc_channel_factory.cc index 9bcaa75..f553203 100644 --- a/ipc/ipc_channel_factory.cc +++ b/ipc/ipc_channel_factory.cc @@ -15,9 +15,12 @@ class PlatformChannelFactory : public ChannelFactory { : handle_(handle), mode_(mode) { } - std::string GetName() const override { return handle_.name; } + virtual std::string GetName() const override { + return handle_.name; + } - scoped_ptr<Channel> BuildChannel(Listener* listener) override { + virtual scoped_ptr<Channel> BuildChannel( + Listener* listener) override { return Channel::Create(handle_, mode_, listener); } diff --git a/ipc/ipc_channel_posix.h b/ipc/ipc_channel_posix.h index 1cb7610..717e43e 100644 --- a/ipc/ipc_channel_posix.h +++ b/ipc/ipc_channel_posix.h @@ -56,16 +56,16 @@ class IPC_EXPORT ChannelPosix : public Channel, public: ChannelPosix(const IPC::ChannelHandle& channel_handle, Mode mode, Listener* listener); - ~ChannelPosix() override; + virtual ~ChannelPosix(); // Channel implementation - bool Connect() override; - void Close() override; - bool Send(Message* message) override; - base::ProcessId GetPeerPID() const override; - base::ProcessId GetSelfPID() const override; - int GetClientFileDescriptor() const override; - base::ScopedFD TakeClientFileDescriptor() override; + virtual bool Connect() override; + virtual void Close() override; + virtual bool Send(Message* message) override; + virtual base::ProcessId GetPeerPID() const override; + virtual base::ProcessId GetSelfPID() const override; + virtual int GetClientFileDescriptor() const override; + virtual base::ScopedFD TakeClientFileDescriptor() override; // Returns true if the channel supports listening for connections. bool AcceptsConnections() const; @@ -102,10 +102,12 @@ class IPC_EXPORT ChannelPosix : public Channel, void QueueCloseFDMessage(int fd, int hops); // ChannelReader implementation. - ReadState ReadData(char* buffer, int buffer_len, int* bytes_read) override; - bool WillDispatchInputMessage(Message* msg) override; - bool DidEmptyInputBuffers() override; - void HandleInternalMessage(const Message& msg) override; + virtual ReadState ReadData(char* buffer, + int buffer_len, + int* bytes_read) override; + virtual bool WillDispatchInputMessage(Message* msg) override; + virtual bool DidEmptyInputBuffers() override; + virtual void HandleInternalMessage(const Message& msg) override; #if defined(IPC_USES_READWRITE) // Reads the next message from the fd_pipe_ and appends them to the @@ -127,8 +129,8 @@ class IPC_EXPORT ChannelPosix : public Channel, void ClearInputFDs(); // MessageLoopForIO::Watcher implementation. - void OnFileCanReadWithoutBlocking(int fd) override; - void OnFileCanWriteWithoutBlocking(int fd) override; + virtual void OnFileCanReadWithoutBlocking(int fd) override; + virtual void OnFileCanWriteWithoutBlocking(int fd) override; Mode mode_; diff --git a/ipc/ipc_channel_posix_unittest.cc b/ipc/ipc_channel_posix_unittest.cc index 786623b..d5346b9 100644 --- a/ipc/ipc_channel_posix_unittest.cc +++ b/ipc/ipc_channel_posix_unittest.cc @@ -45,35 +45,35 @@ class IPCChannelPosixTestListener : public IPC::Listener { quit_only_on_message_(quit_only_on_message) { } - ~IPCChannelPosixTestListener() override {} + virtual ~IPCChannelPosixTestListener() {} - bool OnMessageReceived(const IPC::Message& message) override { + virtual bool OnMessageReceived(const IPC::Message& message) override { EXPECT_EQ(message.type(), kQuitMessage); status_ = MESSAGE_RECEIVED; QuitRunLoop(); return true; } - void OnChannelConnected(int32 peer_pid) override { + virtual void OnChannelConnected(int32 peer_pid) override { status_ = CONNECTED; if (!quit_only_on_message_) { QuitRunLoop(); } } - void OnChannelError() override { + virtual void OnChannelError() override { status_ = CHANNEL_ERROR; QuitRunLoop(); } - void OnChannelDenied() override { + virtual void OnChannelDenied() override { status_ = DENIED; if (!quit_only_on_message_) { QuitRunLoop(); } } - void OnChannelListenError() override { + virtual void OnChannelListenError() override { status_ = LISTEN_ERROR; if (!quit_only_on_message_) { QuitRunLoop(); diff --git a/ipc/ipc_channel_proxy.h b/ipc/ipc_channel_proxy.h index 71a014b..84abc65 100644 --- a/ipc/ipc_channel_proxy.h +++ b/ipc/ipc_channel_proxy.h @@ -76,7 +76,7 @@ class IPC_EXPORT ChannelProxy : public Sender, public base::NonThreadSafe { Listener* listener, const scoped_refptr<base::SingleThreadTaskRunner>& ipc_task_runner); - ~ChannelProxy() override; + virtual ~ChannelProxy(); // Initializes the channel proxy. Only call this once to initialize a channel // proxy that was not initialized in its constructor. If create_pipe_now is @@ -98,7 +98,7 @@ class IPC_EXPORT ChannelProxy : public Sender, public base::NonThreadSafe { // Send a message asynchronously. The message is routed to the background // thread where it is passed to the IPC::Channel's Send method. - bool Send(Message* message) override; + virtual bool Send(Message* message) override; // Used to intercept messages as they are received on the background thread. // @@ -152,12 +152,12 @@ class IPC_EXPORT ChannelProxy : public Sender, public base::NonThreadSafe { protected: friend class base::RefCountedThreadSafe<Context>; - ~Context() override; + virtual ~Context(); // IPC::Listener methods: - bool OnMessageReceived(const Message& message) override; - void OnChannelConnected(int32 peer_pid) override; - void OnChannelError() override; + virtual bool OnMessageReceived(const Message& message) override; + virtual void OnChannelConnected(int32 peer_pid) override; + virtual void OnChannelError() override; // Like OnMessageReceived but doesn't try the filters. bool OnMessageReceivedNoFilter(const Message& message); diff --git a/ipc/ipc_channel_proxy_unittest.cc b/ipc/ipc_channel_proxy_unittest.cc index 848367e..9042f44 100644 --- a/ipc/ipc_channel_proxy_unittest.cc +++ b/ipc/ipc_channel_proxy_unittest.cc @@ -47,9 +47,9 @@ namespace { class QuitListener : public IPC::Listener { public: QuitListener() : bad_message_received_(false) {} - ~QuitListener() override {} + virtual ~QuitListener() {} - bool OnMessageReceived(const IPC::Message& message) override { + virtual bool OnMessageReceived(const IPC::Message& message) override { IPC_BEGIN_MESSAGE_MAP(QuitListener, message) IPC_MESSAGE_HANDLER(WorkerMsg_Quit, OnQuit) IPC_MESSAGE_HANDLER(TestMsg_BadMessage, OnBadMessage) @@ -57,7 +57,7 @@ class QuitListener : public IPC::Listener { return true; } - void OnBadMessageReceived(const IPC::Message& message) override { + virtual void OnBadMessageReceived(const IPC::Message& message) override { bad_message_received_ = true; } @@ -76,14 +76,14 @@ class QuitListener : public IPC::Listener { class ChannelReflectorListener : public IPC::Listener { public: ChannelReflectorListener() : channel_(NULL) {} - ~ChannelReflectorListener() override {} + virtual ~ChannelReflectorListener() {} void Init(IPC::Channel* channel) { DCHECK(!channel_); channel_ = channel; } - bool OnMessageReceived(const IPC::Message& message) override { + virtual bool OnMessageReceived(const IPC::Message& message) override { IPC_BEGIN_MESSAGE_MAP(ChannelReflectorListener, message) IPC_MESSAGE_HANDLER(TestMsg_Bounce, OnTestBounce) IPC_MESSAGE_HANDLER(TestMsg_SendBadMessage, OnSendBadMessage) @@ -143,24 +143,24 @@ class MessageCountFilter : public IPC::MessageFilter { last_filter_event_(NONE), message_filtering_enabled_(false) {} - void OnFilterAdded(IPC::Sender* sender) override { + virtual void OnFilterAdded(IPC::Sender* sender) override { EXPECT_TRUE(sender); EXPECT_EQ(NONE, last_filter_event_); last_filter_event_ = FILTER_ADDED; } - void OnChannelConnected(int32_t peer_pid) override { + virtual void OnChannelConnected(int32_t peer_pid) override { EXPECT_EQ(FILTER_ADDED, last_filter_event_); EXPECT_NE(static_cast<int32_t>(base::kNullProcessId), peer_pid); last_filter_event_ = CHANNEL_CONNECTED; } - void OnChannelError() override { + virtual void OnChannelError() override { EXPECT_EQ(CHANNEL_CONNECTED, last_filter_event_); last_filter_event_ = CHANNEL_ERROR; } - void OnChannelClosing() override { + virtual void OnChannelClosing() override { // We may or may not have gotten OnChannelError; if not, the last event has // to be OnChannelConnected. if (last_filter_event_ != CHANNEL_ERROR) @@ -168,7 +168,7 @@ class MessageCountFilter : public IPC::MessageFilter { last_filter_event_ = CHANNEL_CLOSING; } - void OnFilterRemoved() override { + virtual void OnFilterRemoved() override { // If the channel didn't get a chance to connect, we might see the // OnFilterRemoved event with no other events preceding it. We still want // OnFilterRemoved to be called to allow for deleting the Filter. @@ -177,7 +177,7 @@ class MessageCountFilter : public IPC::MessageFilter { last_filter_event_ = FILTER_REMOVED; } - bool OnMessageReceived(const IPC::Message& message) override { + virtual bool OnMessageReceived(const IPC::Message& message) override { // We should always get the OnFilterAdded and OnChannelConnected events // prior to any messages. EXPECT_EQ(CHANNEL_CONNECTED, last_filter_event_); @@ -203,7 +203,7 @@ class MessageCountFilter : public IPC::MessageFilter { CHECK(false); } - bool GetSupportedMessageClasses( + virtual bool GetSupportedMessageClasses( std::vector<uint32>* supported_message_classes) const override { if (is_global_filter_) return false; @@ -219,7 +219,7 @@ class MessageCountFilter : public IPC::MessageFilter { FilterEvent last_filter_event() const { return last_filter_event_; } private: - ~MessageCountFilter() override {} + virtual ~MessageCountFilter() {} size_t messages_received_; uint32 supported_message_class_; diff --git a/ipc/ipc_channel_unittest.cc b/ipc/ipc_channel_unittest.cc index 1b28376..b9d0723 100644 --- a/ipc/ipc_channel_unittest.cc +++ b/ipc/ipc_channel_unittest.cc @@ -146,9 +146,11 @@ TEST_F(IPCChannelTest, ChannelProxyTest) { class ChannelListenerWithOnConnectedSend : public IPC::TestChannelListener { public: ChannelListenerWithOnConnectedSend() {} - ~ChannelListenerWithOnConnectedSend() override {} + virtual ~ChannelListenerWithOnConnectedSend() {} - void OnChannelConnected(int32 peer_pid) override { SendNextMessage(); } + virtual void OnChannelConnected(int32 peer_pid) override { + SendNextMessage(); + } }; #if defined(OS_WIN) diff --git a/ipc/ipc_forwarding_message_filter.h b/ipc/ipc_forwarding_message_filter.h index 7508084..474fbf4 100644 --- a/ipc/ipc_forwarding_message_filter.h +++ b/ipc/ipc_forwarding_message_filter.h @@ -45,10 +45,10 @@ class IPC_EXPORT ForwardingMessageFilter : public MessageFilter { void RemoveRoute(int routing_id); // MessageFilter methods: - bool OnMessageReceived(const Message& message) override; + virtual bool OnMessageReceived(const Message& message) override; private: - ~ForwardingMessageFilter() override; + virtual ~ForwardingMessageFilter(); std::set<int> message_ids_to_filter_; diff --git a/ipc/ipc_fuzzing_tests.cc b/ipc/ipc_fuzzing_tests.cc index f9475a1..a85491c 100644 --- a/ipc/ipc_fuzzing_tests.cc +++ b/ipc/ipc_fuzzing_tests.cc @@ -135,7 +135,7 @@ class FuzzerServerListener : public SimpleListener { public: FuzzerServerListener() : message_count_(2), pending_messages_(0) { } - bool OnMessageReceived(const IPC::Message& msg) override { + virtual bool OnMessageReceived(const IPC::Message& msg) override { if (msg.routing_id() == MSG_ROUTING_CONTROL) { ++pending_messages_; IPC_BEGIN_MESSAGE_MAP(FuzzerServerListener, msg) @@ -199,7 +199,7 @@ class FuzzerClientListener : public SimpleListener { FuzzerClientListener() : last_msg_(NULL) { } - bool OnMessageReceived(const IPC::Message& msg) override { + virtual bool OnMessageReceived(const IPC::Message& msg) override { last_msg_ = new IPC::Message(msg); base::MessageLoop::current()->Quit(); return true; diff --git a/ipc/ipc_message.h b/ipc/ipc_message.h index a1b26e1..a48fcb1 100644 --- a/ipc/ipc_message.h +++ b/ipc/ipc_message.h @@ -50,7 +50,7 @@ class IPC_EXPORT Message : public Pickle { HAS_SENT_TIME_BIT = 0x80, }; - ~Message() override; + virtual ~Message(); Message(); diff --git a/ipc/ipc_message_macros.h b/ipc/ipc_message_macros.h index 6004155..0978765 100644 --- a/ipc/ipc_message_macros.h +++ b/ipc/ipc_message_macros.h @@ -600,63 +600,66 @@ typedef Schema::Param Param; \ enum { ID = IPC_MESSAGE_ID() }; \ msg_class(IPC_TYPE_IN_##in_cnt in_list); \ - ~msg_class() override; \ + virtual ~msg_class(); \ static bool Read(const Message* msg, Schema::Param* p); \ static void Log(std::string* name, const Message* msg, std::string* l); \ IPC_ASYNC_MESSAGE_METHODS_##in_cnt \ }; -#define IPC_ASYNC_ROUTED_DECL(msg_class, in_cnt, out_cnt, in_list, out_list) \ - class IPC_MESSAGE_EXPORT msg_class : public IPC::Message { \ - public: \ - typedef IPC::MessageSchema<IPC_TUPLE_IN_##in_cnt in_list> Schema; \ - typedef Schema::Param Param; \ - enum { ID = IPC_MESSAGE_ID() }; \ - msg_class(int32 routing_id \ - IPC_COMMA_##in_cnt IPC_TYPE_IN_##in_cnt in_list); \ - ~msg_class() override; \ - static bool Read(const Message* msg, Schema::Param* p); \ - static void Log(std::string* name, const Message* msg, std::string* l); \ - IPC_ASYNC_MESSAGE_METHODS_##in_cnt \ +#define IPC_ASYNC_ROUTED_DECL(msg_class, in_cnt, out_cnt, in_list, out_list) \ + class IPC_MESSAGE_EXPORT msg_class : public IPC::Message { \ + public: \ + typedef IPC::MessageSchema<IPC_TUPLE_IN_##in_cnt in_list> Schema; \ + typedef Schema::Param Param; \ + enum { ID = IPC_MESSAGE_ID() }; \ + msg_class(int32 routing_id IPC_COMMA_##in_cnt \ + IPC_TYPE_IN_##in_cnt in_list); \ + virtual ~msg_class(); \ + static bool Read(const Message* msg, Schema::Param* p); \ + static void Log(std::string* name, const Message* msg, std::string* l); \ + IPC_ASYNC_MESSAGE_METHODS_##in_cnt \ }; -#define IPC_SYNC_CONTROL_DECL(msg_class, in_cnt, out_cnt, in_list, out_list) \ - class IPC_MESSAGE_EXPORT msg_class : public IPC::SyncMessage { \ - public: \ - typedef IPC::SyncMessageSchema<IPC_TUPLE_IN_##in_cnt in_list, \ - IPC_TUPLE_OUT_##out_cnt out_list> Schema; \ - typedef Schema::ReplyParam ReplyParam; \ - typedef Schema::SendParam SendParam; \ - enum { ID = IPC_MESSAGE_ID() }; \ - msg_class(IPC_TYPE_IN_##in_cnt in_list \ - IPC_COMMA_AND_##in_cnt(IPC_COMMA_##out_cnt) \ - IPC_TYPE_OUT_##out_cnt out_list); \ - ~msg_class() override; \ - static bool ReadSendParam(const Message* msg, Schema::SendParam* p); \ - static bool ReadReplyParam(const Message* msg, \ - TupleTypes<ReplyParam>::ValueTuple* p); \ - static void Log(std::string* name, const Message* msg, std::string* l); \ - IPC_SYNC_MESSAGE_METHODS_##out_cnt \ +#define IPC_SYNC_CONTROL_DECL(msg_class, in_cnt, out_cnt, in_list, out_list) \ + class IPC_MESSAGE_EXPORT msg_class : public IPC::SyncMessage { \ + public: \ + typedef IPC::SyncMessageSchema<IPC_TUPLE_IN_##in_cnt in_list, \ + IPC_TUPLE_OUT_##out_cnt out_list> Schema; \ + typedef Schema::ReplyParam ReplyParam; \ + typedef Schema::SendParam SendParam; \ + enum { ID = IPC_MESSAGE_ID() }; \ + msg_class(IPC_TYPE_IN_##in_cnt in_list \ + IPC_COMMA_AND_##in_cnt(IPC_COMMA_##out_cnt) \ + IPC_TYPE_OUT_##out_cnt out_list); \ + virtual ~msg_class(); \ + static bool ReadSendParam(const Message* msg, Schema::SendParam* p); \ + static bool ReadReplyParam( \ + const Message* msg, \ + TupleTypes<ReplyParam>::ValueTuple* p); \ + static void Log(std::string* name, const Message* msg, std::string* l); \ + IPC_SYNC_MESSAGE_METHODS_##out_cnt \ }; -#define IPC_SYNC_ROUTED_DECL(msg_class, in_cnt, out_cnt, in_list, out_list) \ - class IPC_MESSAGE_EXPORT msg_class : public IPC::SyncMessage { \ - public: \ - typedef IPC::SyncMessageSchema<IPC_TUPLE_IN_##in_cnt in_list, \ - IPC_TUPLE_OUT_##out_cnt out_list> Schema; \ - typedef Schema::ReplyParam ReplyParam; \ - typedef Schema::SendParam SendParam; \ - enum { ID = IPC_MESSAGE_ID() }; \ - msg_class(int32 routing_id IPC_COMMA_OR_##in_cnt(IPC_COMMA_##out_cnt) \ - IPC_TYPE_IN_##in_cnt in_list \ - IPC_COMMA_AND_##in_cnt(IPC_COMMA_##out_cnt) \ - IPC_TYPE_OUT_##out_cnt out_list); \ - ~msg_class() override; \ - static bool ReadSendParam(const Message* msg, Schema::SendParam* p); \ - static bool ReadReplyParam(const Message* msg, \ - TupleTypes<ReplyParam>::ValueTuple* p); \ - static void Log(std::string* name, const Message* msg, std::string* l); \ - IPC_SYNC_MESSAGE_METHODS_##out_cnt \ +#define IPC_SYNC_ROUTED_DECL(msg_class, in_cnt, out_cnt, in_list, out_list) \ + class IPC_MESSAGE_EXPORT msg_class : public IPC::SyncMessage { \ + public: \ + typedef IPC::SyncMessageSchema<IPC_TUPLE_IN_##in_cnt in_list, \ + IPC_TUPLE_OUT_##out_cnt out_list> Schema; \ + typedef Schema::ReplyParam ReplyParam; \ + typedef Schema::SendParam SendParam; \ + enum { ID = IPC_MESSAGE_ID() }; \ + msg_class(int32 routing_id \ + IPC_COMMA_OR_##in_cnt(IPC_COMMA_##out_cnt) \ + IPC_TYPE_IN_##in_cnt in_list \ + IPC_COMMA_AND_##in_cnt(IPC_COMMA_##out_cnt) \ + IPC_TYPE_OUT_##out_cnt out_list); \ + virtual ~msg_class(); \ + static bool ReadSendParam(const Message* msg, Schema::SendParam* p); \ + static bool ReadReplyParam( \ + const Message* msg, \ + TupleTypes<ReplyParam>::ValueTuple* p); \ + static void Log(std::string* name, const Message* msg, std::string* l); \ + IPC_SYNC_MESSAGE_METHODS_##out_cnt \ }; #if defined(IPC_MESSAGE_IMPL) diff --git a/ipc/ipc_perftest_support.cc b/ipc/ipc_perftest_support.cc index ab06ed6..e60de91 100644 --- a/ipc/ipc_perftest_support.cc +++ b/ipc/ipc_perftest_support.cc @@ -81,7 +81,7 @@ class ChannelReflectorListener : public Listener { VLOG(1) << "Client listener up"; } - ~ChannelReflectorListener() override { + virtual ~ChannelReflectorListener() { VLOG(1) << "Client listener down"; latency_tracker_.ShowResults(); } @@ -91,7 +91,7 @@ class ChannelReflectorListener : public Listener { channel_ = channel; } - bool OnMessageReceived(const Message& message) override { + virtual bool OnMessageReceived(const Message& message) override { CHECK(channel_); PickleIterator iter(message); @@ -142,7 +142,9 @@ class PerformanceChannelListener : public Listener { VLOG(1) << "Server listener up"; } - ~PerformanceChannelListener() override { VLOG(1) << "Server listener down"; } + virtual ~PerformanceChannelListener() { + VLOG(1) << "Server listener down"; + } void Init(Sender* sender) { DCHECK(!sender_); @@ -158,7 +160,7 @@ class PerformanceChannelListener : public Listener { payload_ = std::string(msg_size_, 'a'); } - bool OnMessageReceived(const Message& message) override { + virtual bool OnMessageReceived(const Message& message) override { CHECK(sender_); PickleIterator iter(message); diff --git a/ipc/ipc_send_fds_test.cc b/ipc/ipc_send_fds_test.cc index 332a631..3961fa1 100644 --- a/ipc/ipc_send_fds_test.cc +++ b/ipc/ipc_send_fds_test.cc @@ -33,7 +33,7 @@ const char* kDevZeroPath = "/dev/zero"; class MyChannelDescriptorListenerBase : public IPC::Listener { public: - bool OnMessageReceived(const IPC::Message& message) override { + virtual bool OnMessageReceived(const IPC::Message& message) override { PickleIterator iter(message); base::FileDescriptor descriptor; @@ -60,10 +60,12 @@ class MyChannelDescriptorListener : public MyChannelDescriptorListenerBase { return num_fds_received_ == kNumFDsToSend; } - void OnChannelError() override { base::MessageLoop::current()->Quit(); } + virtual void OnChannelError() override { + base::MessageLoop::current()->Quit(); + } protected: - void HandleFD(int fd) override { + virtual void HandleFD(int fd) override { // Check that we can read from the FD. char buf; ssize_t amt_read = read(fd, &buf, 1); @@ -200,7 +202,9 @@ class MyCBListener : public MyChannelDescriptorListenerBase { } protected: - void HandleFD(int fd) override { cb_.Run(fd); } + virtual void HandleFD(int fd) override { + cb_.Run(fd); + } private: base::Callback<void(int)> cb_; }; diff --git a/ipc/ipc_sync_channel.h b/ipc/ipc_sync_channel.h index 3593485..3f62d2f 100644 --- a/ipc/ipc_sync_channel.h +++ b/ipc/ipc_sync_channel.h @@ -91,9 +91,9 @@ class IPC_EXPORT SyncChannel : public ChannelProxy { const scoped_refptr<base::SingleThreadTaskRunner>& ipc_task_runner, base::WaitableEvent* shutdown_event); - ~SyncChannel() override; + virtual ~SyncChannel(); - bool Send(Message* message) override; + virtual bool Send(Message* message) override; // Sets the dispatch group for this channel, to only allow re-entrant dispatch // of messages to other channels in the same group. @@ -170,17 +170,17 @@ class IPC_EXPORT SyncChannel : public ChannelProxy { base::WaitableEventWatcher::EventCallback MakeWaitableEventCallback(); private: - ~SyncContext() override; + virtual ~SyncContext(); // ChannelProxy methods that we override. // Called on the listener thread. - void Clear() override; + virtual void Clear() override; // Called on the IPC thread. - bool OnMessageReceived(const Message& msg) override; - void OnChannelError() override; - void OnChannelOpened() override; - void OnChannelClosed() override; + virtual bool OnMessageReceived(const Message& msg) override; + virtual void OnChannelError() override; + virtual void OnChannelOpened() override; + virtual void OnChannelClosed() override; // Cancels all pending Send calls. void CancelPendingSends(); diff --git a/ipc/ipc_sync_channel_unittest.cc b/ipc/ipc_sync_channel_unittest.cc index 9ad0e58..3560d5b 100644 --- a/ipc/ipc_sync_channel_unittest.cc +++ b/ipc/ipc_sync_channel_unittest.cc @@ -58,13 +58,13 @@ class Worker : public Listener, public Sender { is_shutdown_(false) { } - ~Worker() override { + virtual ~Worker() { // Shutdown() must be called before destruction. CHECK(is_shutdown_); } void AddRef() { } void Release() { } - bool Send(Message* msg) override { return channel_->Send(msg); } + virtual bool Send(Message* msg) override { return channel_->Send(msg); } void WaitForChannelCreation() { channel_created_->Wait(); } void CloseChannel() { DCHECK(base::MessageLoop::current() == ListenerThread()->message_loop()); @@ -200,7 +200,7 @@ class Worker : public Listener, public Sender { listener_event->Signal(); } - bool OnMessageReceived(const Message& message) override { + virtual bool OnMessageReceived(const Message& message) override { IPC_BEGIN_MESSAGE_MAP(Worker, message) IPC_MESSAGE_HANDLER_DELAY_REPLY(SyncChannelTestMsg_Double, OnDoubleDelay) IPC_MESSAGE_HANDLER_DELAY_REPLY(SyncChannelTestMsg_AnswerToLife, @@ -274,7 +274,7 @@ class SimpleServer : public Worker { explicit SimpleServer(bool pump_during_send) : Worker(Channel::MODE_SERVER, "simpler_server"), pump_during_send_(pump_during_send) { } - void Run() override { + virtual void Run() override { SendAnswerToLife(pump_during_send_, true); Done(); } @@ -286,7 +286,7 @@ class SimpleClient : public Worker { public: SimpleClient() : Worker(Channel::MODE_CLIENT, "simple_client") { } - void OnAnswer(int* answer) override { + virtual void OnAnswer(int* answer) override { *answer = 42; Done(); } @@ -316,12 +316,12 @@ class TwoStepServer : public Worker { : Worker(Channel::MODE_SERVER, "simpler_server"), create_pipe_now_(create_pipe_now) { } - void Run() override { + virtual void Run() override { SendAnswerToLife(false, true); Done(); } - SyncChannel* CreateChannel() override { + virtual SyncChannel* CreateChannel() override { SyncChannel* channel = SyncChannel::Create(channel_name(), mode(), this, ipc_thread().message_loop_proxy().get(), @@ -339,12 +339,12 @@ class TwoStepClient : public Worker { : Worker(Channel::MODE_CLIENT, "simple_client"), create_pipe_now_(create_pipe_now) { } - void OnAnswer(int* answer) override { + virtual void OnAnswer(int* answer) override { *answer = 42; Done(); } - SyncChannel* CreateChannel() override { + virtual SyncChannel* CreateChannel() override { SyncChannel* channel = SyncChannel::Create(channel_name(), mode(), this, ipc_thread().message_loop_proxy().get(), @@ -378,7 +378,7 @@ class DelayClient : public Worker { public: DelayClient() : Worker(Channel::MODE_CLIENT, "delay_client") { } - void OnAnswerDelay(Message* reply_msg) override { + virtual void OnAnswerDelay(Message* reply_msg) override { SyncChannelTestMsg_AnswerToLife::WriteReplyParams(reply_msg, 42); Send(reply_msg); Done(); @@ -406,7 +406,7 @@ class NoHangServer : public Worker { : Worker(Channel::MODE_SERVER, "no_hang_server"), got_first_reply_(got_first_reply), pump_during_send_(pump_during_send) { } - void Run() override { + virtual void Run() override { SendAnswerToLife(pump_during_send_, true); got_first_reply_->Signal(); @@ -424,7 +424,7 @@ class NoHangClient : public Worker { : Worker(Channel::MODE_CLIENT, "no_hang_client"), got_first_reply_(got_first_reply) { } - void OnAnswerDelay(Message* reply_msg) override { + virtual void OnAnswerDelay(Message* reply_msg) override { // Use the DELAY_REPLY macro so that we can force the reply to be sent // before this function returns (when the channel will be reset). SyncChannelTestMsg_AnswerToLife::WriteReplyParams(reply_msg, 42); @@ -459,7 +459,7 @@ class UnblockServer : public Worker { : Worker(Channel::MODE_SERVER, "unblock_server"), pump_during_send_(pump_during_send), delete_during_send_(delete_during_send) { } - void Run() override { + virtual void Run() override { if (delete_during_send_) { // Use custom code since race conditions mean the answer may or may not be // available. @@ -474,7 +474,7 @@ class UnblockServer : public Worker { Done(); } - void OnDoubleDelay(int in, Message* reply_msg) override { + virtual void OnDoubleDelay(int in, Message* reply_msg) override { SyncChannelTestMsg_Double::WriteReplyParams(reply_msg, in * 2); Send(reply_msg); if (delete_during_send_) @@ -491,7 +491,7 @@ class UnblockClient : public Worker { : Worker(Channel::MODE_CLIENT, "unblock_client"), pump_during_send_(pump_during_send) { } - void OnAnswer(int* answer) override { + virtual void OnAnswer(int* answer) override { SendDouble(pump_during_send_, true); *answer = 42; Done(); @@ -533,12 +533,12 @@ class RecursiveServer : public Worker { : Worker(Channel::MODE_SERVER, "recursive_server"), expected_send_result_(expected_send_result), pump_first_(pump_first), pump_second_(pump_second) {} - void Run() override { + virtual void Run() override { SendDouble(pump_first_, expected_send_result_); Done(); } - void OnDouble(int in, int* out) override { + virtual void OnDouble(int in, int* out) override { *out = in * 2; SendAnswerToLife(pump_second_, expected_send_result_); } @@ -552,7 +552,7 @@ class RecursiveClient : public Worker { : Worker(Channel::MODE_CLIENT, "recursive_client"), pump_during_send_(pump_during_send), close_channel_(close_channel) {} - void OnDoubleDelay(int in, Message* reply_msg) override { + virtual void OnDoubleDelay(int in, Message* reply_msg) override { SendDouble(pump_during_send_, !close_channel_); if (close_channel_) { delete reply_msg; @@ -563,7 +563,7 @@ class RecursiveClient : public Worker { Done(); } - void OnAnswerDelay(Message* reply_msg) override { + virtual void OnAnswerDelay(Message* reply_msg) override { if (close_channel_) { delete reply_msg; CloseChannel(); @@ -629,7 +629,7 @@ class MultipleServer1 : public Worker { : Worker("test_channel1", Channel::MODE_SERVER), pump_during_send_(pump_during_send) { } - void Run() override { + virtual void Run() override { SendDouble(pump_during_send_, true); Done(); } @@ -645,7 +645,7 @@ class MultipleClient1 : public Worker { client1_msg_received_(client1_msg_received), client1_can_reply_(client1_can_reply) { } - void OnDouble(int in, int* out) override { + virtual void OnDouble(int in, int* out) override { client1_msg_received_->Signal(); *out = in * 2; client1_can_reply_->Wait(); @@ -660,7 +660,7 @@ class MultipleServer2 : public Worker { public: MultipleServer2() : Worker("test_channel2", Channel::MODE_SERVER) { } - void OnAnswer(int* result) override { + virtual void OnAnswer(int* result) override { *result = 42; Done(); } @@ -676,7 +676,7 @@ class MultipleClient2 : public Worker { client1_can_reply_(client1_can_reply), pump_during_send_(pump_during_send) { } - void Run() override { + virtual void Run() override { client1_msg_received_->Wait(); SendAnswerToLife(pump_during_send_, true); client1_can_reply_->Signal(); @@ -746,7 +746,7 @@ class QueuedReplyServer : public Worker { Worker::OverrideThread(listener_thread); } - void OnNestedTestMsg(Message* reply_msg) override { + virtual void OnNestedTestMsg(Message* reply_msg) override { VLOG(1) << __FUNCTION__ << " Sending reply: " << reply_text_; SyncChannelNestedTestMsg_String::WriteReplyParams(reply_msg, reply_text_); Send(reply_msg); @@ -775,7 +775,7 @@ class QueuedReplyClient : public Worker { Worker::OverrideThread(listener_thread); } - void Run() override { + virtual void Run() override { std::string response; SyncMessage* msg = new SyncChannelNestedTestMsg_String(&response); if (pump_during_send_) @@ -848,7 +848,7 @@ class ChattyClient : public Worker { ChattyClient() : Worker(Channel::MODE_CLIENT, "chatty_client") { } - void OnAnswer(int* answer) override { + virtual void OnAnswer(int* answer) override { // The PostMessage limit is 10k. Send 20% more than that. const int kMessageLimit = 10000; const int kMessagesToSend = kMessageLimit * 120 / 100; @@ -895,7 +895,7 @@ class DoneEventRaceServer : public Worker { DoneEventRaceServer() : Worker(Channel::MODE_SERVER, "done_event_race_server") { } - void Run() override { + virtual void Run() override { base::MessageLoop::current()->PostTask(FROM_HERE, base::Bind(&NestedCallback, this)); base::MessageLoop::current()->PostDelayedTask( @@ -934,7 +934,7 @@ class TestSyncMessageFilter : public SyncMessageFilter { message_loop_(message_loop) { } - void OnFilterAdded(Sender* sender) override { + virtual void OnFilterAdded(Sender* sender) override { SyncMessageFilter::OnFilterAdded(sender); message_loop_->PostTask( FROM_HERE, @@ -951,7 +951,7 @@ class TestSyncMessageFilter : public SyncMessageFilter { } private: - ~TestSyncMessageFilter() override {} + virtual ~TestSyncMessageFilter() {} Worker* worker_; scoped_refptr<base::MessageLoopProxy> message_loop_; @@ -969,7 +969,9 @@ class SyncMessageFilterServer : public Worker { thread_.message_loop_proxy()); } - void Run() override { channel()->AddFilter(filter_.get()); } + virtual void Run() override { + channel()->AddFilter(filter_.get()); + } base::Thread thread_; scoped_refptr<TestSyncMessageFilter> filter_; @@ -996,12 +998,12 @@ class ServerSendAfterClose : public Worker { } private: - void Run() override { + virtual void Run() override { CloseChannel(); Done(); } - bool Send(Message* msg) override { + virtual bool Send(Message* msg) override { send_result_ = Worker::Send(msg); Done(); return send_result_; @@ -1063,7 +1065,7 @@ class RestrictedDispatchServer : public Worker { base::Thread* ListenerThread() { return Worker::ListenerThread(); } private: - bool OnMessageReceived(const Message& message) override { + virtual bool OnMessageReceived(const Message& message) override { IPC_BEGIN_MESSAGE_MAP(RestrictedDispatchServer, message) IPC_MESSAGE_HANDLER(SyncChannelTestMsg_NoArgs, OnNoArgs) IPC_MESSAGE_HANDLER(SyncChannelTestMsg_PingTTL, OnPingTTL) @@ -1096,7 +1098,7 @@ class NonRestrictedDispatchServer : public Worker { } private: - bool OnMessageReceived(const Message& message) override { + virtual bool OnMessageReceived(const Message& message) override { IPC_BEGIN_MESSAGE_MAP(NonRestrictedDispatchServer, message) IPC_MESSAGE_HANDLER(SyncChannelTestMsg_NoArgs, OnNoArgs) IPC_MESSAGE_HANDLER(SyncChannelTestMsg_Done, Done) @@ -1121,7 +1123,7 @@ class RestrictedDispatchClient : public Worker { success_(success), sent_ping_event_(sent_ping_event) {} - void Run() override { + virtual void Run() override { // Incoming messages from our channel should only be dispatched when we // send a message on that same channel. channel()->SetRestrictDispatchChannelGroup(1); @@ -1185,7 +1187,7 @@ class RestrictedDispatchClient : public Worker { } private: - bool OnMessageReceived(const Message& message) override { + virtual bool OnMessageReceived(const Message& message) override { IPC_BEGIN_MESSAGE_MAP(RestrictedDispatchClient, message) IPC_MESSAGE_HANDLER(SyncChannelTestMsg_Ping, OnPing) IPC_MESSAGE_HANDLER_DELAY_REPLY(SyncChannelTestMsg_PingTTL, OnPingTTL) @@ -1279,7 +1281,7 @@ class RestrictedDispatchDeadlockServer : public Worker { SendMessageToClient(); } - void Run() override { + virtual void Run() override { channel()->SetRestrictDispatchChannelGroup(1); server_ready_event_->Signal(); } @@ -1287,7 +1289,7 @@ class RestrictedDispatchDeadlockServer : public Worker { base::Thread* ListenerThread() { return Worker::ListenerThread(); } private: - bool OnMessageReceived(const Message& message) override { + virtual bool OnMessageReceived(const Message& message) override { IPC_BEGIN_MESSAGE_MAP(RestrictedDispatchDeadlockServer, message) IPC_MESSAGE_HANDLER(SyncChannelTestMsg_NoArgs, OnNoArgs) IPC_MESSAGE_HANDLER(SyncChannelTestMsg_Done, Done) @@ -1327,7 +1329,9 @@ class RestrictedDispatchDeadlockClient2 : public Worker { received_noarg_reply_(false), done_issued_(false) {} - void Run() override { server_ready_event_->Wait(); } + virtual void Run() override { + server_ready_event_->Wait(); + } void OnDoClient2Task() { events_[3]->Wait(); @@ -1343,7 +1347,7 @@ class RestrictedDispatchDeadlockClient2 : public Worker { base::Thread* ListenerThread() { return Worker::ListenerThread(); } private: - bool OnMessageReceived(const Message& message) override { + virtual bool OnMessageReceived(const Message& message) override { IPC_BEGIN_MESSAGE_MAP(RestrictedDispatchDeadlockClient2, message) IPC_MESSAGE_HANDLER(SyncChannelTestMsg_NoArgs, OnNoArgs) IPC_END_MESSAGE_MAP() @@ -1386,7 +1390,7 @@ class RestrictedDispatchDeadlockClient1 : public Worker { received_noarg_reply_(false), done_issued_(false) {} - void Run() override { + virtual void Run() override { server_ready_event_->Wait(); server_->ListenerThread()->message_loop()->PostTask( FROM_HERE, @@ -1406,7 +1410,7 @@ class RestrictedDispatchDeadlockClient1 : public Worker { } private: - bool OnMessageReceived(const Message& message) override { + virtual bool OnMessageReceived(const Message& message) override { IPC_BEGIN_MESSAGE_MAP(RestrictedDispatchDeadlockClient1, message) IPC_MESSAGE_HANDLER(SyncChannelTestMsg_NoArgs, OnNoArgs) IPC_END_MESSAGE_MAP() @@ -1519,7 +1523,7 @@ class RestrictedDispatchPipeWorker : public Worker { Done(); } - void Run() override { + virtual void Run() override { channel()->SetRestrictDispatchChannelGroup(group_); if (is_first()) event1_->Signal(); @@ -1552,7 +1556,7 @@ class RestrictedDispatchPipeWorker : public Worker { bool is_first() { return !!success_; } private: - bool OnMessageReceived(const Message& message) override { + virtual bool OnMessageReceived(const Message& message) override { IPC_BEGIN_MESSAGE_MAP(RestrictedDispatchPipeWorker, message) IPC_MESSAGE_HANDLER(SyncChannelTestMsg_PingTTL, OnPingTTL) IPC_MESSAGE_HANDLER(SyncChannelTestMsg_Done, OnDone) @@ -1603,7 +1607,7 @@ class ReentrantReplyServer1 : public Worker { : Worker("reentrant_reply1", Channel::MODE_SERVER), server_ready_(server_ready) { } - void Run() override { + virtual void Run() override { server2_channel_ = SyncChannel::Create("reentrant_reply2", IPC::Channel::MODE_CLIENT, @@ -1619,7 +1623,7 @@ class ReentrantReplyServer1 : public Worker { } private: - bool OnMessageReceived(const Message& message) override { + virtual bool OnMessageReceived(const Message& message) override { IPC_BEGIN_MESSAGE_MAP(ReentrantReplyServer1, message) IPC_MESSAGE_HANDLER(SyncChannelTestMsg_Reentrant2, OnReentrant2) IPC_REPLY_HANDLER(OnReply) @@ -1649,7 +1653,7 @@ class ReentrantReplyServer2 : public Worker { reply_(NULL) { } private: - bool OnMessageReceived(const Message& message) override { + virtual bool OnMessageReceived(const Message& message) override { IPC_BEGIN_MESSAGE_MAP(ReentrantReplyServer2, message) IPC_MESSAGE_HANDLER_DELAY_REPLY( SyncChannelTestMsg_Reentrant1, OnReentrant1) @@ -1681,7 +1685,7 @@ class ReentrantReplyClient : public Worker { : Worker("reentrant_reply1", Channel::MODE_CLIENT), server_ready_(server_ready) { } - void Run() override { + virtual void Run() override { server_ready_->Wait(); Send(new SyncChannelTestMsg_Reentrant2()); Done(); @@ -1714,7 +1718,7 @@ class VerifiedServer : public Worker { Worker::OverrideThread(listener_thread); } - void OnNestedTestMsg(Message* reply_msg) override { + virtual void OnNestedTestMsg(Message* reply_msg) override { VLOG(1) << __FUNCTION__ << " Sending reply: " << reply_text_; SyncChannelNestedTestMsg_String::WriteReplyParams(reply_msg, reply_text_); Send(reply_msg); @@ -1736,7 +1740,7 @@ class VerifiedClient : public Worker { Worker::OverrideThread(listener_thread); } - void Run() override { + virtual void Run() override { std::string response; SyncMessage* msg = new SyncChannelNestedTestMsg_String(&response); bool result = Send(msg); diff --git a/ipc/ipc_sync_message.h b/ipc/ipc_sync_message.h index 2b00f03..a741591 100644 --- a/ipc/ipc_sync_message.h +++ b/ipc/ipc_sync_message.h @@ -25,7 +25,7 @@ class IPC_EXPORT SyncMessage : public Message { public: SyncMessage(int32 routing_id, uint32 type, PriorityValue priority, MessageReplyDeserializer* deserializer); - ~SyncMessage() override; + virtual ~SyncMessage(); // Call this to get a deserializer for the output parameters. // Note that this can only be called once, and the caller is responsible diff --git a/ipc/ipc_sync_message_filter.h b/ipc/ipc_sync_message_filter.h index 49c3ca0..015cbf8 100644 --- a/ipc/ipc_sync_message_filter.h +++ b/ipc/ipc_sync_message_filter.h @@ -31,16 +31,16 @@ class IPC_EXPORT SyncMessageFilter : public MessageFilter, public Sender { explicit SyncMessageFilter(base::WaitableEvent* shutdown_event); // MessageSender implementation. - bool Send(Message* message) override; + virtual bool Send(Message* message) override; // MessageFilter implementation. - void OnFilterAdded(Sender* sender) override; - void OnChannelError() override; - void OnChannelClosing() override; - bool OnMessageReceived(const Message& message) override; + virtual void OnFilterAdded(Sender* sender) override; + virtual void OnChannelError() override; + virtual void OnChannelClosing() override; + virtual bool OnMessageReceived(const Message& message) override; protected: - ~SyncMessageFilter() override; + virtual ~SyncMessageFilter(); private: void SendOnIOThread(Message* message); diff --git a/ipc/ipc_test_channel_listener.h b/ipc/ipc_test_channel_listener.h index ae5288d..228cbf7 100644 --- a/ipc/ipc_test_channel_listener.h +++ b/ipc/ipc_test_channel_listener.h @@ -20,10 +20,10 @@ class TestChannelListener : public Listener { static void SendOneMessage(Sender* sender, const char* text); TestChannelListener() : sender_(NULL), messages_left_(50) {} - ~TestChannelListener() override {} + virtual ~TestChannelListener() {} - bool OnMessageReceived(const Message& message) override; - void OnChannelError() override; + virtual bool OnMessageReceived(const Message& message) override; + virtual void OnChannelError() override; void Init(Sender* s) { sender_ = s; diff --git a/ipc/ipc_test_sink.h b/ipc/ipc_test_sink.h index 75e582d..13386f1 100644 --- a/ipc/ipc_test_sink.h +++ b/ipc/ipc_test_sink.h @@ -73,19 +73,19 @@ class Message; class TestSink : public Channel { public: TestSink(); - ~TestSink() override; + virtual ~TestSink(); // Interface in IPC::Channel. This copies the message to the sink and then // deletes it. - bool Send(IPC::Message* message) override; - bool Connect() override WARN_UNUSED_RESULT; - void Close() override; - base::ProcessId GetPeerPID() const override; - base::ProcessId GetSelfPID() const override; + virtual bool Send(IPC::Message* message) override; + virtual bool Connect() override WARN_UNUSED_RESULT; + virtual void Close() override; + virtual base::ProcessId GetPeerPID() const override; + virtual base::ProcessId GetSelfPID() const override; #if defined(OS_POSIX) && !defined(OS_NACL) - int GetClientFileDescriptor() const override; - base::ScopedFD TakeClientFileDescriptor() override; + virtual int GetClientFileDescriptor() const override; + virtual base::ScopedFD TakeClientFileDescriptor() override; #endif // defined(OS_POSIX) && !defined(OS_NACL) // Used by the source of the messages to send the message to the sink. This diff --git a/ipc/mojo/ipc_channel_mojo.cc b/ipc/mojo/ipc_channel_mojo.cc index a93adf1..a5663411 100644 --- a/ipc/mojo/ipc_channel_mojo.cc +++ b/ipc/mojo/ipc_channel_mojo.cc @@ -27,9 +27,11 @@ class MojoChannelFactory : public ChannelFactory { Channel::Mode mode) : delegate_(delegate), channel_handle_(channel_handle), mode_(mode) {} - std::string GetName() const override { return channel_handle_.name; } + virtual std::string GetName() const override { + return channel_handle_.name; + } - scoped_ptr<Channel> BuildChannel(Listener* listener) override { + virtual scoped_ptr<Channel> BuildChannel(Listener* listener) override { return ChannelMojo::Create(delegate_, channel_handle_, mode_, listener); } diff --git a/ipc/mojo/ipc_channel_mojo.h b/ipc/mojo/ipc_channel_mojo.h index e5a4e33..b307fd4 100644 --- a/ipc/mojo/ipc_channel_mojo.h +++ b/ipc/mojo/ipc_channel_mojo.h @@ -87,21 +87,21 @@ class IPC_MOJO_EXPORT ChannelMojo : public Channel, static scoped_ptr<ChannelFactory> CreateClientFactory( const ChannelHandle& channel_handle); - ~ChannelMojo() override; + virtual ~ChannelMojo(); // ChannelMojoHost tells the client handle using this API. void OnClientLaunched(base::ProcessHandle handle); // Channel implementation - bool Connect() override; - void Close() override; - bool Send(Message* message) override; - base::ProcessId GetPeerPID() const override; - base::ProcessId GetSelfPID() const override; + virtual bool Connect() override; + virtual void Close() override; + virtual bool Send(Message* message) override; + virtual base::ProcessId GetPeerPID() const override; + virtual base::ProcessId GetSelfPID() const override; #if defined(OS_POSIX) && !defined(OS_NACL) - int GetClientFileDescriptor() const override; - base::ScopedFD TakeClientFileDescriptor() override; + virtual int GetClientFileDescriptor() const override; + virtual base::ScopedFD TakeClientFileDescriptor() override; // These access protected API of IPC::Message, which has ChannelMojo // as a friend class. @@ -114,8 +114,9 @@ class IPC_MOJO_EXPORT ChannelMojo : public Channel, #endif // defined(OS_POSIX) && !defined(OS_NACL) // MojoBootstrapDelegate implementation - void OnPipeAvailable(mojo::embedder::ScopedPlatformHandle handle) override; - void OnBootstrapError() override; + virtual void OnPipeAvailable( + mojo::embedder::ScopedPlatformHandle handle) override; + virtual void OnBootstrapError() override; // Called from MessagePipeReader implementations void OnMessageReceived(Message& message); diff --git a/ipc/mojo/ipc_channel_mojo_host.cc b/ipc/mojo/ipc_channel_mojo_host.cc index beb18ee..6f9075a 100644 --- a/ipc/mojo/ipc_channel_mojo_host.cc +++ b/ipc/mojo/ipc_channel_mojo_host.cc @@ -17,12 +17,12 @@ namespace IPC { class ChannelMojoHost::ChannelDelegate : public ChannelMojo::Delegate { public: explicit ChannelDelegate(scoped_refptr<base::TaskRunner> io_task_runner); - ~ChannelDelegate() override; + virtual ~ChannelDelegate(); // ChannelMojo::Delegate - base::WeakPtr<Delegate> ToWeakPtr() override; - void OnChannelCreated(base::WeakPtr<ChannelMojo> channel) override; - scoped_refptr<base::TaskRunner> GetIOTaskRunner() override; + virtual base::WeakPtr<Delegate> ToWeakPtr() override; + virtual void OnChannelCreated(base::WeakPtr<ChannelMojo> channel) override; + virtual scoped_refptr<base::TaskRunner> GetIOTaskRunner() override; // Returns an weak ptr of ChannelDelegate instead of Delegate base::WeakPtr<ChannelDelegate> GetWeakPtr(); diff --git a/ipc/mojo/ipc_channel_mojo_readers.h b/ipc/mojo/ipc_channel_mojo_readers.h index cadf453c..fae62ad 100644 --- a/ipc/mojo/ipc_channel_mojo_readers.h +++ b/ipc/mojo/ipc_channel_mojo_readers.h @@ -33,9 +33,9 @@ class MessageReader : public MessagePipeReader { bool Send(scoped_ptr<Message> message); // MessagePipeReader implementation - void OnMessageReceived() override; - void OnPipeClosed() override; - void OnPipeError(MojoResult error) override; + virtual void OnMessageReceived() override; + virtual void OnPipeClosed() override; + virtual void OnPipeError(MojoResult error) override; private: ChannelMojo* owner_; @@ -52,8 +52,8 @@ class ControlReader : public MessagePipeReader { virtual bool Connect(); // MessagePipeReader implementation - void OnPipeClosed() override; - void OnPipeError(MojoResult error) override; + virtual void OnPipeClosed() override; + virtual void OnPipeError(MojoResult error) override; protected: ChannelMojo* owner_; @@ -65,13 +65,13 @@ class ControlReader : public MessagePipeReader { class ServerControlReader : public ControlReader { public: ServerControlReader(mojo::ScopedMessagePipeHandle pipe, ChannelMojo* owner); - ~ServerControlReader() override; + virtual ~ServerControlReader(); // ControlReader override - bool Connect() override; + virtual bool Connect() override; // MessagePipeReader implementation - void OnMessageReceived() override; + virtual void OnMessageReceived() override; private: MojoResult SendHelloRequest(); @@ -88,7 +88,7 @@ class ClientControlReader : public ControlReader { ClientControlReader(mojo::ScopedMessagePipeHandle pipe, ChannelMojo* owner); // MessagePipeReader implementation - void OnMessageReceived() override; + virtual void OnMessageReceived() override; private: MojoResult RespondHelloRequest(MojoHandle message_channel); diff --git a/ipc/mojo/ipc_channel_mojo_unittest.cc b/ipc/mojo/ipc_channel_mojo_unittest.cc index 1697ff7..cefa29e 100644 --- a/ipc/mojo/ipc_channel_mojo_unittest.cc +++ b/ipc/mojo/ipc_channel_mojo_unittest.cc @@ -27,9 +27,9 @@ class ListenerThatExpectsOK : public IPC::Listener { ListenerThatExpectsOK() : received_ok_(false) {} - ~ListenerThatExpectsOK() override {} + virtual ~ListenerThatExpectsOK() {} - bool OnMessageReceived(const IPC::Message& message) override { + virtual bool OnMessageReceived(const IPC::Message& message) override { PickleIterator iter(message); std::string should_be_ok; EXPECT_TRUE(iter.ReadString(&should_be_ok)); @@ -39,7 +39,7 @@ class ListenerThatExpectsOK : public IPC::Listener { return true; } - void OnChannelError() override { + virtual void OnChannelError() override { // The connection should be healthy while the listener is waiting // message. An error can occur after that because the peer // process dies. @@ -79,7 +79,7 @@ class ChannelClient { class IPCChannelMojoTest : public IPCTestBase { protected: - scoped_ptr<IPC::ChannelFactory> CreateChannelFactory( + virtual scoped_ptr<IPC::ChannelFactory> CreateChannelFactory( const IPC::ChannelHandle& handle, base::TaskRunner* runner) override { host_.reset(new IPC::ChannelMojoHost(task_runner())); @@ -87,7 +87,7 @@ class IPCChannelMojoTest : public IPCTestBase { handle); } - bool DidStartClient() override { + virtual bool DidStartClient() override { bool ok = IPCTestBase::DidStartClient(); DCHECK(ok); host_->OnClientLaunched(client_process()); @@ -106,7 +106,7 @@ class TestChannelListenerWithExtraExpectations : is_connected_called_(false) { } - void OnChannelConnected(int32 peer_pid) override { + virtual void OnChannelConnected(int32 peer_pid) override { IPC::TestChannelListener::OnChannelConnected(peer_pid); EXPECT_TRUE(base::kNullProcessId != peer_pid); is_connected_called_ = true; @@ -165,13 +165,15 @@ class ListenerExpectingErrors : public IPC::Listener { : has_error_(false) { } - void OnChannelConnected(int32 peer_pid) override { + virtual void OnChannelConnected(int32 peer_pid) override { base::MessageLoop::current()->Quit(); } - bool OnMessageReceived(const IPC::Message& message) override { return true; } + virtual bool OnMessageReceived(const IPC::Message& message) override { + return true; + } - void OnChannelError() override { + virtual void OnChannelError() override { has_error_ = true; base::MessageLoop::current()->Quit(); } @@ -185,7 +187,7 @@ class ListenerExpectingErrors : public IPC::Listener { class IPCChannelMojoErrorTest : public IPCTestBase { protected: - scoped_ptr<IPC::ChannelFactory> CreateChannelFactory( + virtual scoped_ptr<IPC::ChannelFactory> CreateChannelFactory( const IPC::ChannelHandle& handle, base::TaskRunner* runner) override { host_.reset(new IPC::ChannelMojoHost(task_runner())); @@ -193,7 +195,7 @@ class IPCChannelMojoErrorTest : public IPCTestBase { handle); } - bool DidStartClient() override { + virtual bool DidStartClient() override { bool ok = IPCTestBase::DidStartClient(); DCHECK(ok); host_->OnClientLaunched(client_process()); @@ -209,9 +211,11 @@ class ListenerThatQuits : public IPC::Listener { ListenerThatQuits() { } - bool OnMessageReceived(const IPC::Message& message) override { return true; } + virtual bool OnMessageReceived(const IPC::Message& message) override { + return true; + } - void OnChannelConnected(int32 peer_pid) override { + virtual void OnChannelConnected(int32 peer_pid) override { base::MessageLoop::current()->Quit(); } }; @@ -320,9 +324,9 @@ class ListenerThatExpectsFile : public IPC::Listener { ListenerThatExpectsFile() : sender_(NULL) {} - ~ListenerThatExpectsFile() override {} + virtual ~ListenerThatExpectsFile() {} - bool OnMessageReceived(const IPC::Message& message) override { + virtual bool OnMessageReceived(const IPC::Message& message) override { PickleIterator iter(message); base::ScopedFD fd; @@ -336,7 +340,9 @@ class ListenerThatExpectsFile : public IPC::Listener { return true; } - void OnChannelError() override { NOTREACHED(); } + virtual void OnChannelError() override { + NOTREACHED(); + } static std::string GetSendingFileContent() { return "Hello"; diff --git a/ipc/mojo/ipc_mojo_bootstrap.cc b/ipc/mojo/ipc_mojo_bootstrap.cc index 7458265..7233de0 100644 --- a/ipc/mojo/ipc_mojo_bootstrap.cc +++ b/ipc/mojo/ipc_mojo_bootstrap.cc @@ -20,15 +20,15 @@ class MojoServerBootstrap : public MojoBootstrap { public: MojoServerBootstrap(); - void OnClientLaunched(base::ProcessHandle process) override; + virtual void OnClientLaunched(base::ProcessHandle process) override; private: void SendClientPipe(); void SendClientPipeIfReady(); // Listener implementations - bool OnMessageReceived(const Message& message) override; - void OnChannelConnected(int32 peer_pid) override; + virtual bool OnMessageReceived(const Message& message) override; + virtual void OnChannelConnected(int32 peer_pid) override; mojo::embedder::ScopedPlatformHandle server_pipe_; base::ProcessHandle client_process_; @@ -112,12 +112,12 @@ class MojoClientBootstrap : public MojoBootstrap { public: MojoClientBootstrap(); - void OnClientLaunched(base::ProcessHandle process) override; + virtual void OnClientLaunched(base::ProcessHandle process) override; private: // Listener implementations - bool OnMessageReceived(const Message& message) override; - void OnChannelConnected(int32 peer_pid) override; + virtual bool OnMessageReceived(const Message& message) override; + virtual void OnChannelConnected(int32 peer_pid) override; DISALLOW_COPY_AND_ASSIGN(MojoClientBootstrap); }; diff --git a/ipc/mojo/ipc_mojo_bootstrap.h b/ipc/mojo/ipc_mojo_bootstrap.h index 0d007dd..540becf 100644 --- a/ipc/mojo/ipc_mojo_bootstrap.h +++ b/ipc/mojo/ipc_mojo_bootstrap.h @@ -41,7 +41,7 @@ class IPC_MOJO_EXPORT MojoBootstrap : public Listener { Delegate* delegate); MojoBootstrap(); - ~MojoBootstrap() override; + virtual ~MojoBootstrap(); // Start the handshake over the underlying platform channel. bool Connect(); @@ -68,8 +68,8 @@ class IPC_MOJO_EXPORT MojoBootstrap : public Listener { void Init(scoped_ptr<Channel> channel, Delegate* delegate); // Listener implementations - void OnBadMessageReceived(const Message& message) override; - void OnChannelError() override; + virtual void OnBadMessageReceived(const Message& message) override; + virtual void OnChannelError() override; scoped_ptr<Channel> channel_; Delegate* delegate_; diff --git a/ipc/mojo/ipc_mojo_bootstrap_unittest.cc b/ipc/mojo/ipc_mojo_bootstrap_unittest.cc index a071d66..8bffd88 100644 --- a/ipc/mojo/ipc_mojo_bootstrap_unittest.cc +++ b/ipc/mojo/ipc_mojo_bootstrap_unittest.cc @@ -23,8 +23,9 @@ class TestingDelegate : public IPC::MojoBootstrap::Delegate { public: TestingDelegate() : passed_(false) {} - void OnPipeAvailable(mojo::embedder::ScopedPlatformHandle handle) override; - void OnBootstrapError() override; + virtual void OnPipeAvailable( + mojo::embedder::ScopedPlatformHandle handle) override; + virtual void OnBootstrapError() override; bool passed() const { return passed_; } diff --git a/ipc/mojo/ipc_mojo_perftest.cc b/ipc/mojo/ipc_mojo_perftest.cc index 29e7839..dca405e 100644 --- a/ipc/mojo/ipc_mojo_perftest.cc +++ b/ipc/mojo/ipc_mojo_perftest.cc @@ -29,7 +29,7 @@ public: MojoChannelPerfTest(); - scoped_ptr<IPC::ChannelFactory> CreateChannelFactory( + virtual scoped_ptr<IPC::ChannelFactory> CreateChannelFactory( const IPC::ChannelHandle& handle, base::TaskRunner* runner) override { host_.reset(new IPC::ChannelMojoHost(task_runner())); @@ -37,7 +37,7 @@ public: handle); } - bool DidStartClient() override { + virtual bool DidStartClient() override { bool ok = IPCTestBase::DidStartClient(); DCHECK(ok); host_->OnClientLaunched(client_process()); @@ -73,7 +73,8 @@ class MojoTestClient : public IPC::test::PingPongTestClient { MojoTestClient(); - scoped_ptr<IPC::Channel> CreateChannel(IPC::Listener* listener) override; + virtual scoped_ptr<IPC::Channel> CreateChannel( + IPC::Listener* listener) override; }; MojoTestClient::MojoTestClient() { diff --git a/ipc/sync_socket_unittest.cc b/ipc/sync_socket_unittest.cc index 77ae72d..040dcdc 100644 --- a/ipc/sync_socket_unittest.cc +++ b/ipc/sync_socket_unittest.cc @@ -58,7 +58,7 @@ class SyncSocketServerListener : public IPC::Listener { chan_ = chan; } - bool OnMessageReceived(const IPC::Message& msg) override { + virtual bool OnMessageReceived(const IPC::Message& msg) override { if (msg.routing_id() == MSG_ROUTING_CONTROL) { IPC_BEGIN_MESSAGE_MAP(SyncSocketServerListener, msg) IPC_MESSAGE_HANDLER(MsgClassSetHandle, OnMsgClassSetHandle) @@ -129,7 +129,7 @@ class SyncSocketClientListener : public IPC::Listener { chan_ = chan; } - bool OnMessageReceived(const IPC::Message& msg) override { + virtual bool OnMessageReceived(const IPC::Message& msg) override { if (msg.routing_id() == MSG_ROUTING_CONTROL) { IPC_BEGIN_MESSAGE_MAP(SyncSocketClientListener, msg) IPC_MESSAGE_HANDLER(MsgClassResponse, OnMsgClassResponse) diff --git a/ipc/unix_domain_socket_util_unittest.cc b/ipc/unix_domain_socket_util_unittest.cc index 90c2ada..a67c077 100644 --- a/ipc/unix_domain_socket_util_unittest.cc +++ b/ipc/unix_domain_socket_util_unittest.cc @@ -27,7 +27,9 @@ class SocketAcceptor : public base::MessageLoopForIO::Watcher { base::Bind(&SocketAcceptor::StartWatching, base::Unretained(this), fd)); } - ~SocketAcceptor() override { Close(); } + virtual ~SocketAcceptor() { + Close(); + } int server_fd() const { return server_fd_; } @@ -58,13 +60,13 @@ class SocketAcceptor : public base::MessageLoopForIO::Watcher { watcher->StopWatchingFileDescriptor(); delete watcher; } - void OnFileCanReadWithoutBlocking(int fd) override { + virtual void OnFileCanReadWithoutBlocking(int fd) override { ASSERT_EQ(-1, server_fd_); IPC::ServerAcceptConnection(fd, &server_fd_); watcher_->StopWatchingFileDescriptor(); accepted_event_.Signal(); } - void OnFileCanWriteWithoutBlocking(int fd) override {} + virtual void OnFileCanWriteWithoutBlocking(int fd) override {} int server_fd_; base::MessageLoopProxy* target_thread_; |