| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 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 | 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 "jingle/glue/channel_socket_adapter.h" | 5 #include "jingle/glue/channel_socket_adapter.h" |
| 6 | 6 |
| 7 #include <limits> | 7 #include <limits> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 write_callback_ = callback; | 83 write_callback_ = callback; |
| 84 write_buffer_ = buffer; | 84 write_buffer_ = buffer; |
| 85 write_buffer_size_ = buffer_size; | 85 write_buffer_size_ = buffer_size; |
| 86 } | 86 } |
| 87 | 87 |
| 88 return result; | 88 return result; |
| 89 } | 89 } |
| 90 | 90 |
| 91 bool TransportChannelSocketAdapter::SetReceiveBufferSize(int32 size) { | 91 bool TransportChannelSocketAdapter::SetReceiveBufferSize(int32 size) { |
| 92 DCHECK_EQ(MessageLoop::current(), message_loop_); | 92 DCHECK_EQ(MessageLoop::current(), message_loop_); |
| 93 NOTIMPLEMENTED(); | 93 return channel_->SetOption(talk_base::Socket::OPT_RCVBUF, size) == 0; |
| 94 return false; | |
| 95 } | 94 } |
| 96 | 95 |
| 97 bool TransportChannelSocketAdapter::SetSendBufferSize(int32 size) { | 96 bool TransportChannelSocketAdapter::SetSendBufferSize(int32 size) { |
| 98 DCHECK_EQ(MessageLoop::current(), message_loop_); | 97 DCHECK_EQ(MessageLoop::current(), message_loop_); |
| 99 NOTIMPLEMENTED(); | 98 return channel_->SetOption(talk_base::Socket::OPT_SNDBUF, size) == 0; |
| 100 return false; | |
| 101 } | 99 } |
| 102 | 100 |
| 103 void TransportChannelSocketAdapter::Close(int error_code) { | 101 void TransportChannelSocketAdapter::Close(int error_code) { |
| 104 DCHECK_EQ(MessageLoop::current(), message_loop_); | 102 DCHECK_EQ(MessageLoop::current(), message_loop_); |
| 105 | 103 |
| 106 if (!channel_) // Already closed. | 104 if (!channel_) // Already closed. |
| 107 return; | 105 return; |
| 108 | 106 |
| 109 DCHECK(error_code != net::OK); | 107 DCHECK(error_code != net::OK); |
| 110 closed_error_code_ = error_code; | 108 closed_error_code_ = error_code; |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 174 } | 172 } |
| 175 | 173 |
| 176 void TransportChannelSocketAdapter::OnChannelDestroyed( | 174 void TransportChannelSocketAdapter::OnChannelDestroyed( |
| 177 cricket::TransportChannel* channel) { | 175 cricket::TransportChannel* channel) { |
| 178 DCHECK_EQ(MessageLoop::current(), message_loop_); | 176 DCHECK_EQ(MessageLoop::current(), message_loop_); |
| 179 DCHECK_EQ(channel, channel_); | 177 DCHECK_EQ(channel, channel_); |
| 180 Close(net::ERR_CONNECTION_ABORTED); | 178 Close(net::ERR_CONNECTION_ABORTED); |
| 181 } | 179 } |
| 182 | 180 |
| 183 } // namespace jingle_glue | 181 } // namespace jingle_glue |
| OLD | NEW |