| 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 } |
| 109 if (!CreatePipe(channel_handle, mode)) { | 125 if (!CreatePipe(channel_handle, mode)) { |
| 110 // The pipe may have been closed already. | 126 // The pipe may have been closed already. |
| 111 LOG(WARNING) << "Unable to create pipe named \"" << channel_handle.name << | 127 LOG(WARNING) << "Unable to create pipe named \"" << channel_handle.name << |
| 112 "\" in " << (mode == 0 ? "server" : "client") << " mode."; | 128 "\" in " << (mode == 0 ? "server" : "client") << " mode."; |
| 113 } | 129 } |
| 114 } | 130 } |
| 115 | 131 |
| 116 Channel::ChannelImpl::~ChannelImpl() { | 132 Channel::ChannelImpl::~ChannelImpl() { |
| 117 Close(); | 133 Close(); |
| 118 } | 134 } |
| (...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 488 | 504 |
| 489 void Channel::set_listener(Listener* listener) { | 505 void Channel::set_listener(Listener* listener) { |
| 490 channel_impl_->set_listener(listener); | 506 channel_impl_->set_listener(listener); |
| 491 } | 507 } |
| 492 | 508 |
| 493 bool Channel::Send(Message* message) { | 509 bool Channel::Send(Message* message) { |
| 494 return channel_impl_->Send(message); | 510 return channel_impl_->Send(message); |
| 495 } | 511 } |
| 496 | 512 |
| 497 } // namespace IPC | 513 } // namespace IPC |
| OLD | NEW |