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 "content/renderer/p2p/host_address_request.h" | 5 #include "content/renderer/p2p/host_address_request.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/message_loop_proxy.h" | 8 #include "base/message_loop_proxy.h" |
9 #include "content/common/p2p_messages.h" | 9 #include "content/common/p2p_messages.h" |
10 #include "content/renderer/p2p/socket_dispatcher.h" | 10 #include "content/renderer/p2p/socket_dispatcher.h" |
11 | 11 |
12 P2PHostAddressRequest::P2PHostAddressRequest(P2PSocketDispatcher* dispatcher) | 12 P2PHostAddressRequest::P2PHostAddressRequest(P2PSocketDispatcher* dispatcher) |
13 : dispatcher_(dispatcher), | 13 : dispatcher_(dispatcher), |
14 ipc_message_loop_(dispatcher->message_loop()), | 14 ipc_message_loop_(dispatcher->message_loop()), |
15 delegate_message_loop_(base::MessageLoopProxy::CreateForCurrentThread()), | 15 delegate_message_loop_(base::MessageLoopProxy::current()), |
16 state_(STATE_CREATED), | 16 state_(STATE_CREATED), |
17 request_id_(0), | 17 request_id_(0), |
18 registered_(false) { | 18 registered_(false) { |
19 } | 19 } |
20 | 20 |
21 P2PHostAddressRequest::~P2PHostAddressRequest() { | 21 P2PHostAddressRequest::~P2PHostAddressRequest() { |
22 DCHECK(state_ == STATE_CREATED || state_ == STATE_FINISHED); | 22 DCHECK(state_ == STATE_CREATED || state_ == STATE_FINISHED); |
23 } | 23 } |
24 | 24 |
25 void P2PHostAddressRequest::Request(const std::string& host_name, | 25 void P2PHostAddressRequest::Request(const std::string& host_name, |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 } | 69 } |
70 | 70 |
71 void P2PHostAddressRequest::DeliverResponse( | 71 void P2PHostAddressRequest::DeliverResponse( |
72 const net::IPAddressNumber& address) { | 72 const net::IPAddressNumber& address) { |
73 DCHECK(delegate_message_loop_->BelongsToCurrentThread()); | 73 DCHECK(delegate_message_loop_->BelongsToCurrentThread()); |
74 if (state_ == STATE_SENT) { | 74 if (state_ == STATE_SENT) { |
75 done_callback_.Run(address); | 75 done_callback_.Run(address); |
76 state_ = STATE_FINISHED; | 76 state_ = STATE_FINISHED; |
77 } | 77 } |
78 } | 78 } |
OLD | NEW |