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

Side by Side Diff: content/renderer/p2p/socket_client.cc

Issue 45183002: Expose the p2p client in content/public (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: missed a file Created 7 years, 1 month 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) 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/bind.h" 7 #include "base/bind.h"
8 #include "base/message_loop/message_loop_proxy.h" 8 #include "base/message_loop/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"
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 if (state_ == STATE_OPEN || state_ == STATE_OPENING || 104 if (state_ == STATE_OPEN || state_ == STATE_OPENING ||
105 state_ == STATE_ERROR) { 105 state_ == STATE_ERROR) {
106 dispatcher_->SendP2PMessage(new P2PHostMsg_DestroySocket(socket_id_)); 106 dispatcher_->SendP2PMessage(new P2PHostMsg_DestroySocket(socket_id_));
107 } 107 }
108 dispatcher_->UnregisterClient(socket_id_); 108 dispatcher_->UnregisterClient(socket_id_);
109 } 109 }
110 110
111 state_ = STATE_CLOSED; 111 state_ = STATE_CLOSED;
112 } 112 }
113 113
114 int P2PSocketClient::socket_id() const {
115 return socket_id_;
116 }
117
114 void P2PSocketClient::set_delegate(Delegate* delegate) { 118 void P2PSocketClient::set_delegate(Delegate* delegate) {
115 DCHECK(delegate_message_loop_->BelongsToCurrentThread()); 119 DCHECK(delegate_message_loop_->BelongsToCurrentThread());
116 delegate_ = delegate; 120 delegate_ = delegate;
117 } 121 }
118 122
119 void P2PSocketClient::OnSocketCreated(const net::IPEndPoint& address) { 123 void P2PSocketClient::OnSocketCreated(const net::IPEndPoint& address) {
120 DCHECK(ipc_message_loop_->BelongsToCurrentThread()); 124 DCHECK(ipc_message_loop_->BelongsToCurrentThread());
121 DCHECK_EQ(state_, STATE_OPENING); 125 DCHECK_EQ(state_, STATE_OPENING);
122 state_ = STATE_OPEN; 126 state_ = STATE_OPEN;
123 127
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 delegate_->OnDataReceived(address, data); 207 delegate_->OnDataReceived(address, data);
204 } 208 }
205 209
206 void P2PSocketClient::Detach() { 210 void P2PSocketClient::Detach() {
207 DCHECK(ipc_message_loop_->BelongsToCurrentThread()); 211 DCHECK(ipc_message_loop_->BelongsToCurrentThread());
208 dispatcher_ = NULL; 212 dispatcher_ = NULL;
209 OnError(); 213 OnError();
210 } 214 }
211 215
212 } // namespace content 216 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698