OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 #include "ipc/ipc_channel_win.h" | 5 #include "ipc/ipc_channel_win.h" |
6 | 6 |
7 #include <windows.h> | 7 #include <windows.h> |
8 #include <sddl.h> | 8 #include <sddl.h> |
9 #include <sstream> | 9 #include <sstream> |
10 | 10 |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 | 99 |
100 Channel::ChannelImpl::ChannelImpl(const IPC::ChannelHandle &channel_handle, | 100 Channel::ChannelImpl::ChannelImpl(const IPC::ChannelHandle &channel_handle, |
101 Mode mode, Listener* listener) | 101 Mode mode, Listener* listener) |
102 : ALLOW_THIS_IN_INITIALIZER_LIST(input_state_(this)), | 102 : ALLOW_THIS_IN_INITIALIZER_LIST(input_state_(this)), |
103 ALLOW_THIS_IN_INITIALIZER_LIST(output_state_(this)), | 103 ALLOW_THIS_IN_INITIALIZER_LIST(output_state_(this)), |
104 pipe_(INVALID_HANDLE_VALUE), | 104 pipe_(INVALID_HANDLE_VALUE), |
105 listener_(listener), | 105 listener_(listener), |
106 waiting_connect_(mode == MODE_SERVER), | 106 waiting_connect_(mode == MODE_SERVER), |
107 processing_incoming_(false), | 107 processing_incoming_(false), |
108 ALLOW_THIS_IN_INITIALIZER_LIST(factory_(this)) { | 108 ALLOW_THIS_IN_INITIALIZER_LIST(factory_(this)) { |
109 switch(mode) { | |
110 case MODE_NONE: | |
111 LOG(FATAL) << "Bad mode for " << channel_handle.name; | |
112 break; | |
113 case MODE_SERVER: | |
114 case MODE_CLIENT: | |
115 break; | |
116 case MODE_NAMED_SERVER: | |
117 mode = MODE_SERVER; | |
118 break; | |
119 case MODE_NAMED_CLIENT: | |
120 mode = MODE_CLIENT; | |
121 break; | |
122 // Intentionally no default case here so that the compiler | |
123 // will check that we handle all the cases in the enum. | |
124 } | |
125 if (!CreatePipe(channel_handle, mode)) { | 109 if (!CreatePipe(channel_handle, mode)) { |
126 // The pipe may have been closed already. | 110 // The pipe may have been closed already. |
127 LOG(WARNING) << "Unable to create pipe named \"" << channel_handle.name << | 111 LOG(WARNING) << "Unable to create pipe named \"" << channel_handle.name << |
128 "\" in " << (mode == 0 ? "server" : "client") << " mode."; | 112 "\" in " << (mode == 0 ? "server" : "client") << " mode."; |
129 } | 113 } |
130 } | 114 } |
131 | 115 |
132 Channel::ChannelImpl::~ChannelImpl() { | 116 Channel::ChannelImpl::~ChannelImpl() { |
133 Close(); | 117 Close(); |
134 } | 118 } |
(...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
504 | 488 |
505 void Channel::set_listener(Listener* listener) { | 489 void Channel::set_listener(Listener* listener) { |
506 channel_impl_->set_listener(listener); | 490 channel_impl_->set_listener(listener); |
507 } | 491 } |
508 | 492 |
509 bool Channel::Send(Message* message) { | 493 bool Channel::Send(Message* message) { |
510 return channel_impl_->Send(message); | 494 return channel_impl_->Send(message); |
511 } | 495 } |
512 | 496 |
513 } // namespace IPC | 497 } // namespace IPC |
OLD | NEW |