Removes some dead accessibility code.
[chromium-blink-merge.git] / ipc / ipc_sync_message_filter.h
blobc313460ebd5321231eb7af0a33b2830372ddc386
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef IPC_IPC_SYNC_MESSAGE_FILTER_H_
6 #define IPC_IPC_SYNC_MESSAGE_FILTER_H_
7 #pragma once
9 #include "base/basictypes.h"
10 #include "base/memory/ref_counted.h"
11 #include "base/synchronization/lock.h"
12 #include "ipc/ipc_channel_proxy.h"
13 #include "ipc/ipc_sync_message.h"
14 #include <set>
16 namespace base {
17 class WaitableEvent;
20 class MessageLoop;
22 namespace IPC {
24 class MessageReplyDeserializer;
26 // This MessageFilter allows sending synchronous IPC messages from a thread
27 // other than the listener thread associated with the SyncChannel. It does not
28 // support fancy features that SyncChannel does, such as handling recursion or
29 // receiving messages while waiting for a response. Note that this object can
30 // be used to send simultaneous synchronous messages from different threads.
31 class SyncMessageFilter : public ChannelProxy::MessageFilter,
32 public Message::Sender {
33 public:
34 explicit SyncMessageFilter(base::WaitableEvent* shutdown_event);
35 virtual ~SyncMessageFilter();
37 // Message::Sender implementation.
38 virtual bool Send(Message* message);
40 // ChannelProxy::MessageFilter implementation.
41 virtual void OnFilterAdded(Channel* channel);
42 virtual void OnChannelError();
43 virtual void OnChannelClosing();
44 virtual bool OnMessageReceived(const Message& message);
46 private:
47 void SendOnIOThread(Message* message);
48 // Signal all the pending sends as done, used in an error condition.
49 void SignalAllEvents();
51 // The channel to which this filter was added.
52 Channel* channel_;
54 MessageLoop* listener_loop_; // The process's main thread.
55 MessageLoop* io_loop_; // The message loop where the Channel lives.
57 typedef std::set<PendingSyncMsg*> PendingSyncMessages;
58 PendingSyncMessages pending_sync_messages_;
60 // Locks data members above.
61 base::Lock lock_;
63 base::WaitableEvent* shutdown_event_;
65 DISALLOW_COPY_AND_ASSIGN(SyncMessageFilter);
68 } // namespace IPC
70 #endif // IPC_IPC_SYNC_MESSAGE_FILTER_H_