Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(37)

Side by Side Diff: jingle/glue/channel_socket_adapter.cc

Issue 167893002: Roll webrtc to r5549. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 DCHECK(buffer); 69 DCHECK(buffer);
70 DCHECK(!callback.is_null()); 70 DCHECK(!callback.is_null());
71 CHECK(write_callback_.is_null()); 71 CHECK(write_callback_.is_null());
72 72
73 if (!channel_) { 73 if (!channel_) {
74 DCHECK(closed_error_code_ != net::OK); 74 DCHECK(closed_error_code_ != net::OK);
75 return closed_error_code_; 75 return closed_error_code_;
76 } 76 }
77 77
78 int result; 78 int result;
79 talk_base::PacketOptions options;
79 if (channel_->writable()) { 80 if (channel_->writable()) {
80 result = channel_->SendPacket(buffer->data(), buffer_size, 81 result = channel_->SendPacket(buffer->data(), buffer_size, options);
81 talk_base::DSCP_NO_CHANGE);
82 if (result < 0) { 82 if (result < 0) {
83 result = net::MapSystemError(channel_->GetError()); 83 result = net::MapSystemError(channel_->GetError());
84 84
85 // If the underlying socket returns IO pending where it shouldn't we 85 // If the underlying socket returns IO pending where it shouldn't we
86 // pretend the packet is dropped and return as succeeded because no 86 // pretend the packet is dropped and return as succeeded because no
87 // writeable callback will happen. 87 // writeable callback will happen.
88 if (result == net::ERR_IO_PENDING) 88 if (result == net::ERR_IO_PENDING)
89 result = net::OK; 89 result = net::OK;
90 } 90 }
91 } else { 91 } else {
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 LOG(WARNING) 165 LOG(WARNING)
166 << "Data was received without a callback. Dropping the packet."; 166 << "Data was received without a callback. Dropping the packet.";
167 } 167 }
168 } 168 }
169 169
170 void TransportChannelSocketAdapter::OnWritableState( 170 void TransportChannelSocketAdapter::OnWritableState(
171 cricket::TransportChannel* channel) { 171 cricket::TransportChannel* channel) {
172 DCHECK_EQ(base::MessageLoop::current(), message_loop_); 172 DCHECK_EQ(base::MessageLoop::current(), message_loop_);
173 // Try to send the packet if there is a pending write. 173 // Try to send the packet if there is a pending write.
174 if (!write_callback_.is_null()) { 174 if (!write_callback_.is_null()) {
175 talk_base::PacketOptions options;
175 int result = channel_->SendPacket(write_buffer_->data(), 176 int result = channel_->SendPacket(write_buffer_->data(),
176 write_buffer_size_, 177 write_buffer_size_,
177 talk_base::DSCP_NO_CHANGE); 178 options);
178 if (result < 0) 179 if (result < 0)
179 result = net::MapSystemError(channel_->GetError()); 180 result = net::MapSystemError(channel_->GetError());
180 181
181 if (result != net::ERR_IO_PENDING) { 182 if (result != net::ERR_IO_PENDING) {
182 net::CompletionCallback callback = write_callback_; 183 net::CompletionCallback callback = write_callback_;
183 write_callback_.Reset(); 184 write_callback_.Reset();
184 write_buffer_ = NULL; 185 write_buffer_ = NULL;
185 callback.Run(result); 186 callback.Run(result);
186 } 187 }
187 } 188 }
188 } 189 }
189 190
190 void TransportChannelSocketAdapter::OnChannelDestroyed( 191 void TransportChannelSocketAdapter::OnChannelDestroyed(
191 cricket::TransportChannel* channel) { 192 cricket::TransportChannel* channel) {
192 DCHECK_EQ(base::MessageLoop::current(), message_loop_); 193 DCHECK_EQ(base::MessageLoop::current(), message_loop_);
193 DCHECK_EQ(channel, channel_); 194 DCHECK_EQ(channel, channel_);
194 Close(net::ERR_CONNECTION_ABORTED); 195 Close(net::ERR_CONNECTION_ABORTED);
195 } 196 }
196 197
197 } // namespace jingle_glue 198 } // namespace jingle_glue
OLDNEW
« no previous file with comments | « content/renderer/p2p/ipc_socket_factory.cc ('k') | jingle/glue/channel_socket_adapter_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698