OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef IPC_MOJO_IPC_CHANNEL_MOJO_READERS_H_ | 5 #ifndef IPC_MOJO_IPC_CHANNEL_MOJO_READERS_H_ |
6 #define IPC_MOJO_IPC_CHANNEL_MOJO_READERS_H_ | 6 #define IPC_MOJO_IPC_CHANNEL_MOJO_READERS_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
(...skipping 15 matching lines...) Expand all Loading... |
26 namespace internal { | 26 namespace internal { |
27 | 27 |
28 // A MessagePipeReader implementation for IPC::Message communication. | 28 // A MessagePipeReader implementation for IPC::Message communication. |
29 class MessageReader : public MessagePipeReader { | 29 class MessageReader : public MessagePipeReader { |
30 public: | 30 public: |
31 MessageReader(mojo::ScopedMessagePipeHandle pipe, ChannelMojo* owner); | 31 MessageReader(mojo::ScopedMessagePipeHandle pipe, ChannelMojo* owner); |
32 | 32 |
33 bool Send(scoped_ptr<Message> message); | 33 bool Send(scoped_ptr<Message> message); |
34 | 34 |
35 // MessagePipeReader implementation | 35 // MessagePipeReader implementation |
36 virtual void OnMessageReceived() OVERRIDE; | 36 virtual void OnMessageReceived() override; |
37 virtual void OnPipeClosed() OVERRIDE; | 37 virtual void OnPipeClosed() override; |
38 virtual void OnPipeError(MojoResult error) OVERRIDE; | 38 virtual void OnPipeError(MojoResult error) override; |
39 | 39 |
40 private: | 40 private: |
41 ChannelMojo* owner_; | 41 ChannelMojo* owner_; |
42 | 42 |
43 DISALLOW_COPY_AND_ASSIGN(MessageReader); | 43 DISALLOW_COPY_AND_ASSIGN(MessageReader); |
44 }; | 44 }; |
45 | 45 |
46 // MessagePipeReader implementation for control messages. | 46 // MessagePipeReader implementation for control messages. |
47 // Actual message handling is implemented by sublcasses. | 47 // Actual message handling is implemented by sublcasses. |
48 class ControlReader : public MessagePipeReader { | 48 class ControlReader : public MessagePipeReader { |
49 public: | 49 public: |
50 ControlReader(mojo::ScopedMessagePipeHandle pipe, ChannelMojo* owner); | 50 ControlReader(mojo::ScopedMessagePipeHandle pipe, ChannelMojo* owner); |
51 | 51 |
52 virtual bool Connect(); | 52 virtual bool Connect(); |
53 | 53 |
54 // MessagePipeReader implementation | 54 // MessagePipeReader implementation |
55 virtual void OnPipeClosed() OVERRIDE; | 55 virtual void OnPipeClosed() override; |
56 virtual void OnPipeError(MojoResult error) OVERRIDE; | 56 virtual void OnPipeError(MojoResult error) override; |
57 | 57 |
58 protected: | 58 protected: |
59 ChannelMojo* owner_; | 59 ChannelMojo* owner_; |
60 | 60 |
61 DISALLOW_COPY_AND_ASSIGN(ControlReader); | 61 DISALLOW_COPY_AND_ASSIGN(ControlReader); |
62 }; | 62 }; |
63 | 63 |
64 // ControlReader for server-side ChannelMojo. | 64 // ControlReader for server-side ChannelMojo. |
65 class ServerControlReader : public ControlReader { | 65 class ServerControlReader : public ControlReader { |
66 public: | 66 public: |
67 ServerControlReader(mojo::ScopedMessagePipeHandle pipe, ChannelMojo* owner); | 67 ServerControlReader(mojo::ScopedMessagePipeHandle pipe, ChannelMojo* owner); |
68 virtual ~ServerControlReader(); | 68 virtual ~ServerControlReader(); |
69 | 69 |
70 // ControlReader override | 70 // ControlReader override |
71 virtual bool Connect() OVERRIDE; | 71 virtual bool Connect() override; |
72 | 72 |
73 // MessagePipeReader implementation | 73 // MessagePipeReader implementation |
74 virtual void OnMessageReceived() OVERRIDE; | 74 virtual void OnMessageReceived() override; |
75 | 75 |
76 private: | 76 private: |
77 MojoResult SendHelloRequest(); | 77 MojoResult SendHelloRequest(); |
78 MojoResult RespondHelloResponse(); | 78 MojoResult RespondHelloResponse(); |
79 | 79 |
80 mojo::ScopedMessagePipeHandle message_pipe_; | 80 mojo::ScopedMessagePipeHandle message_pipe_; |
81 | 81 |
82 DISALLOW_COPY_AND_ASSIGN(ServerControlReader); | 82 DISALLOW_COPY_AND_ASSIGN(ServerControlReader); |
83 }; | 83 }; |
84 | 84 |
85 // ControlReader for client-side ChannelMojo. | 85 // ControlReader for client-side ChannelMojo. |
86 class ClientControlReader : public ControlReader { | 86 class ClientControlReader : public ControlReader { |
87 public: | 87 public: |
88 ClientControlReader(mojo::ScopedMessagePipeHandle pipe, ChannelMojo* owner); | 88 ClientControlReader(mojo::ScopedMessagePipeHandle pipe, ChannelMojo* owner); |
89 | 89 |
90 // MessagePipeReader implementation | 90 // MessagePipeReader implementation |
91 virtual void OnMessageReceived() OVERRIDE; | 91 virtual void OnMessageReceived() override; |
92 | 92 |
93 private: | 93 private: |
94 MojoResult RespondHelloRequest(MojoHandle message_channel); | 94 MojoResult RespondHelloRequest(MojoHandle message_channel); |
95 | 95 |
96 DISALLOW_COPY_AND_ASSIGN(ClientControlReader); | 96 DISALLOW_COPY_AND_ASSIGN(ClientControlReader); |
97 }; | 97 }; |
98 | 98 |
99 } // namespace internal | 99 } // namespace internal |
100 } // namespace IPC | 100 } // namespace IPC |
101 | 101 |
102 #endif // IPC_MOJO_IPC_CHANNEL_MOJO_READERS_H_ | 102 #endif // IPC_MOJO_IPC_CHANNEL_MOJO_READERS_H_ |
OLD | NEW |