| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/callback.h" | 9 #include "base/callback.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 129 | 129 |
| 130 if (!write_callback_.is_null()) { | 130 if (!write_callback_.is_null()) { |
| 131 net::CompletionCallback callback = write_callback_; | 131 net::CompletionCallback callback = write_callback_; |
| 132 write_callback_.Reset(); | 132 write_callback_.Reset(); |
| 133 write_buffer_ = NULL; | 133 write_buffer_ = NULL; |
| 134 callback.Run(error_code); | 134 callback.Run(error_code); |
| 135 } | 135 } |
| 136 } | 136 } |
| 137 | 137 |
| 138 void TransportChannelSocketAdapter::OnNewPacket( | 138 void TransportChannelSocketAdapter::OnNewPacket( |
| 139 cricket::TransportChannel* channel, const char* data, size_t data_size) { | 139 cricket::TransportChannel* channel, |
| 140 const char* data, |
| 141 size_t data_size, |
| 142 int flags) { |
| 140 DCHECK_EQ(MessageLoop::current(), message_loop_); | 143 DCHECK_EQ(MessageLoop::current(), message_loop_); |
| 141 DCHECK_EQ(channel, channel_); | 144 DCHECK_EQ(channel, channel_); |
| 142 if (!read_callback_.is_null()) { | 145 if (!read_callback_.is_null()) { |
| 143 DCHECK(read_buffer_); | 146 DCHECK(read_buffer_); |
| 144 CHECK_LT(data_size, static_cast<size_t>(std::numeric_limits<int>::max())); | 147 CHECK_LT(data_size, static_cast<size_t>(std::numeric_limits<int>::max())); |
| 145 | 148 |
| 146 if (read_buffer_size_ < static_cast<int>(data_size)) { | 149 if (read_buffer_size_ < static_cast<int>(data_size)) { |
| 147 LOG(WARNING) << "Data buffer is smaller than the received packet. " | 150 LOG(WARNING) << "Data buffer is smaller than the received packet. " |
| 148 << "Dropping the data that doesn't fit."; | 151 << "Dropping the data that doesn't fit."; |
| 149 data_size = read_buffer_size_; | 152 data_size = read_buffer_size_; |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 182 } | 185 } |
| 183 | 186 |
| 184 void TransportChannelSocketAdapter::OnChannelDestroyed( | 187 void TransportChannelSocketAdapter::OnChannelDestroyed( |
| 185 cricket::TransportChannel* channel) { | 188 cricket::TransportChannel* channel) { |
| 186 DCHECK_EQ(MessageLoop::current(), message_loop_); | 189 DCHECK_EQ(MessageLoop::current(), message_loop_); |
| 187 DCHECK_EQ(channel, channel_); | 190 DCHECK_EQ(channel, channel_); |
| 188 Close(net::ERR_CONNECTION_ABORTED); | 191 Close(net::ERR_CONNECTION_ABORTED); |
| 189 } | 192 } |
| 190 | 193 |
| 191 } // namespace jingle_glue | 194 } // namespace jingle_glue |
| OLD | NEW |