| 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 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 write_callback_.Reset(); | 133 write_callback_.Reset(); |
| 134 write_buffer_ = NULL; | 134 write_buffer_ = NULL; |
| 135 callback.Run(error_code); | 135 callback.Run(error_code); |
| 136 } | 136 } |
| 137 } | 137 } |
| 138 | 138 |
| 139 void TransportChannelSocketAdapter::OnNewPacket( | 139 void TransportChannelSocketAdapter::OnNewPacket( |
| 140 cricket::TransportChannel* channel, | 140 cricket::TransportChannel* channel, |
| 141 const char* data, | 141 const char* data, |
| 142 size_t data_size, | 142 size_t data_size, |
| 143 const talk_base::PacketTime& packet_time, |
| 143 int flags) { | 144 int flags) { |
| 144 DCHECK_EQ(base::MessageLoop::current(), message_loop_); | 145 DCHECK_EQ(base::MessageLoop::current(), message_loop_); |
| 145 DCHECK_EQ(channel, channel_); | 146 DCHECK_EQ(channel, channel_); |
| 146 if (!read_callback_.is_null()) { | 147 if (!read_callback_.is_null()) { |
| 147 DCHECK(read_buffer_.get()); | 148 DCHECK(read_buffer_.get()); |
| 148 CHECK_LT(data_size, static_cast<size_t>(std::numeric_limits<int>::max())); | 149 CHECK_LT(data_size, static_cast<size_t>(std::numeric_limits<int>::max())); |
| 149 | 150 |
| 150 if (read_buffer_size_ < static_cast<int>(data_size)) { | 151 if (read_buffer_size_ < static_cast<int>(data_size)) { |
| 151 LOG(WARNING) << "Data buffer is smaller than the received packet. " | 152 LOG(WARNING) << "Data buffer is smaller than the received packet. " |
| 152 << "Dropping the data that doesn't fit."; | 153 << "Dropping the data that doesn't fit."; |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 187 } | 188 } |
| 188 | 189 |
| 189 void TransportChannelSocketAdapter::OnChannelDestroyed( | 190 void TransportChannelSocketAdapter::OnChannelDestroyed( |
| 190 cricket::TransportChannel* channel) { | 191 cricket::TransportChannel* channel) { |
| 191 DCHECK_EQ(base::MessageLoop::current(), message_loop_); | 192 DCHECK_EQ(base::MessageLoop::current(), message_loop_); |
| 192 DCHECK_EQ(channel, channel_); | 193 DCHECK_EQ(channel, channel_); |
| 193 Close(net::ERR_CONNECTION_ABORTED); | 194 Close(net::ERR_CONNECTION_ABORTED); |
| 194 } | 195 } |
| 195 | 196 |
| 196 } // namespace jingle_glue | 197 } // namespace jingle_glue |
| OLD | NEW |