| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 "base/message_loop.h" | 5 #include "base/message_loop.h" |
| 6 #include "base/ref_counted.h" | 6 #include "base/ref_counted.h" |
| 7 #include "base/scoped_ptr.h" | 7 #include "base/scoped_ptr.h" |
| 8 #include "base/thread.h" | 8 #include "base/thread.h" |
| 9 #include "ipc/ipc_channel_proxy.h" | 9 #include "ipc/ipc_channel_proxy.h" |
| 10 #include "ipc/ipc_logging.h" | 10 #include "ipc/ipc_logging.h" |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 148 delete channel_; | 148 delete channel_; |
| 149 channel_ = NULL; | 149 channel_ = NULL; |
| 150 | 150 |
| 151 // Balance with the reference taken during startup. This may result in | 151 // Balance with the reference taken during startup. This may result in |
| 152 // self-destruction. | 152 // self-destruction. |
| 153 Release(); | 153 Release(); |
| 154 } | 154 } |
| 155 | 155 |
| 156 // Called on the IPC::Channel thread | 156 // Called on the IPC::Channel thread |
| 157 void ChannelProxy::Context::OnSendMessage(Message* message) { | 157 void ChannelProxy::Context::OnSendMessage(Message* message) { |
| 158 if (!channel_) { |
| 159 delete message; |
| 160 OnChannelClosed(); |
| 161 return; |
| 162 } |
| 158 if (!channel_->Send(message)) | 163 if (!channel_->Send(message)) |
| 159 OnChannelError(); | 164 OnChannelError(); |
| 160 } | 165 } |
| 161 | 166 |
| 162 // Called on the IPC::Channel thread | 167 // Called on the IPC::Channel thread |
| 163 void ChannelProxy::Context::OnAddFilter(MessageFilter* filter) { | 168 void ChannelProxy::Context::OnAddFilter(MessageFilter* filter) { |
| 164 filters_.push_back(filter); | 169 filters_.push_back(filter); |
| 165 | 170 |
| 166 // If the channel has already been created, then we need to send this message | 171 // If the channel has already been created, then we need to send this message |
| 167 // so that the filter gets access to the Channel. | 172 // so that the filter gets access to the Channel. |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 307 int ChannelProxy::GetClientFileDescriptor() const { | 312 int ChannelProxy::GetClientFileDescriptor() const { |
| 308 Channel *channel = context_.get()->channel_; | 313 Channel *channel = context_.get()->channel_; |
| 309 DCHECK(channel); // Channel must have been created first. | 314 DCHECK(channel); // Channel must have been created first. |
| 310 return channel->GetClientFileDescriptor(); | 315 return channel->GetClientFileDescriptor(); |
| 311 } | 316 } |
| 312 #endif | 317 #endif |
| 313 | 318 |
| 314 //----------------------------------------------------------------------------- | 319 //----------------------------------------------------------------------------- |
| 315 | 320 |
| 316 } // namespace IPC | 321 } // namespace IPC |
| OLD | NEW |