| 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 "content/renderer/p2p/ipc_socket_factory.h" | 5 #include "content/renderer/p2p/ipc_socket_factory.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <deque> | 8 #include <deque> |
| 9 | 9 |
| 10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| (...skipping 456 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 467 TraceSendThrottlingState(); | 467 TraceSendThrottlingState(); |
| 468 | 468 |
| 469 if (writable_signal_expected_ && send_bytes_available_ > 0) { | 469 if (writable_signal_expected_ && send_bytes_available_ > 0) { |
| 470 SignalReadyToSend(this); | 470 SignalReadyToSend(this); |
| 471 writable_signal_expected_ = false; | 471 writable_signal_expected_ = false; |
| 472 } | 472 } |
| 473 } | 473 } |
| 474 | 474 |
| 475 void IpcPacketSocket::OnError() { | 475 void IpcPacketSocket::OnError() { |
| 476 DCHECK_EQ(base::MessageLoop::current(), message_loop_); | 476 DCHECK_EQ(base::MessageLoop::current(), message_loop_); |
| 477 bool was_closed = (state_ == IS_ERROR || state_ == IS_CLOSED); |
| 477 state_ = IS_ERROR; | 478 state_ = IS_ERROR; |
| 478 error_ = ECONNABORTED; | 479 error_ = ECONNABORTED; |
| 480 if (!was_closed) { |
| 481 SignalClose(this, 0); |
| 482 } |
| 479 } | 483 } |
| 480 | 484 |
| 481 void IpcPacketSocket::OnDataReceived(const net::IPEndPoint& address, | 485 void IpcPacketSocket::OnDataReceived(const net::IPEndPoint& address, |
| 482 const std::vector<char>& data, | 486 const std::vector<char>& data, |
| 483 const base::TimeTicks& timestamp) { | 487 const base::TimeTicks& timestamp) { |
| 484 DCHECK_EQ(base::MessageLoop::current(), message_loop_); | 488 DCHECK_EQ(base::MessageLoop::current(), message_loop_); |
| 485 | 489 |
| 486 talk_base::SocketAddress address_lj; | 490 talk_base::SocketAddress address_lj; |
| 487 if (!jingle_glue::IPEndPointToSocketAddress(address, &address_lj)) { | 491 if (!jingle_glue::IPEndPointToSocketAddress(address, &address_lj)) { |
| 488 // We should always be able to convert address here because we | 492 // We should always be able to convert address here because we |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 628 } | 632 } |
| 629 | 633 |
| 630 talk_base::AsyncResolverInterface* | 634 talk_base::AsyncResolverInterface* |
| 631 IpcPacketSocketFactory::CreateAsyncResolver() { | 635 IpcPacketSocketFactory::CreateAsyncResolver() { |
| 632 scoped_ptr<AsyncAddressResolverImpl> resolver( | 636 scoped_ptr<AsyncAddressResolverImpl> resolver( |
| 633 new AsyncAddressResolverImpl(socket_dispatcher_)); | 637 new AsyncAddressResolverImpl(socket_dispatcher_)); |
| 634 return resolver.release(); | 638 return resolver.release(); |
| 635 } | 639 } |
| 636 | 640 |
| 637 } // namespace content | 641 } // namespace content |
| OLD | NEW |