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/socket_client.h" | 5 #include "content/renderer/p2p/socket_client.h" |
6 | 6 |
7 #include "base/message_loop_proxy.h" | 7 #include "base/message_loop_proxy.h" |
8 #include "content/common/p2p_messages.h" | 8 #include "content/common/p2p_messages.h" |
9 #include "content/renderer/p2p/socket_dispatcher.h" | 9 #include "content/renderer/p2p/socket_dispatcher.h" |
10 | 10 |
| 11 namespace content { |
| 12 |
11 P2PSocketClient::P2PSocketClient(P2PSocketDispatcher* dispatcher) | 13 P2PSocketClient::P2PSocketClient(P2PSocketDispatcher* dispatcher) |
12 : dispatcher_(dispatcher), | 14 : dispatcher_(dispatcher), |
13 ipc_message_loop_(dispatcher->message_loop()), | 15 ipc_message_loop_(dispatcher->message_loop()), |
14 delegate_message_loop_(base::MessageLoopProxy::current()), | 16 delegate_message_loop_(base::MessageLoopProxy::current()), |
15 socket_id_(0), delegate_(NULL), | 17 socket_id_(0), delegate_(NULL), |
16 state_(STATE_UNINITIALIZED) { | 18 state_(STATE_UNINITIALIZED) { |
17 } | 19 } |
18 | 20 |
19 P2PSocketClient::~P2PSocketClient() { | 21 P2PSocketClient::~P2PSocketClient() { |
20 DCHECK(state_ == STATE_CLOSED || state_ == STATE_UNINITIALIZED); | 22 DCHECK(state_ == STATE_CLOSED || state_ == STATE_UNINITIALIZED); |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 const std::vector<char>& data) { | 148 const std::vector<char>& data) { |
147 if (delegate_) | 149 if (delegate_) |
148 delegate_->OnDataReceived(address, data); | 150 delegate_->OnDataReceived(address, data); |
149 } | 151 } |
150 | 152 |
151 void P2PSocketClient::Detach() { | 153 void P2PSocketClient::Detach() { |
152 DCHECK(ipc_message_loop_->BelongsToCurrentThread()); | 154 DCHECK(ipc_message_loop_->BelongsToCurrentThread()); |
153 dispatcher_ = NULL; | 155 dispatcher_ = NULL; |
154 OnError(); | 156 OnError(); |
155 } | 157 } |
| 158 |
| 159 } // namespace content |
OLD | NEW |