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 #ifndef CONTENT_RENDERER_P2P_SOCKET_CLIENT_H_ | 5 #ifndef CONTENT_RENDERER_P2P_SOCKET_CLIENT_H_ |
6 #define CONTENT_RENDERER_P2P_SOCKET_CLIENT_H_ | 6 #define CONTENT_RENDERER_P2P_SOCKET_CLIENT_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
(...skipping 28 matching lines...) Expand all Loading... |
39 }; | 39 }; |
40 | 40 |
41 explicit P2PSocketClient(P2PSocketDispatcher* dispatcher); | 41 explicit P2PSocketClient(P2PSocketDispatcher* dispatcher); |
42 | 42 |
43 // Initialize socket of the specified |type| and connected to the | 43 // Initialize socket of the specified |type| and connected to the |
44 // specified |address|. |address| matters only when |type| is set to | 44 // specified |address|. |address| matters only when |type| is set to |
45 // P2P_SOCKET_TCP_CLIENT. | 45 // P2P_SOCKET_TCP_CLIENT. |
46 void Init(P2PSocketType type, | 46 void Init(P2PSocketType type, |
47 const net::IPEndPoint& local_address, | 47 const net::IPEndPoint& local_address, |
48 const net::IPEndPoint& remote_address, | 48 const net::IPEndPoint& remote_address, |
49 Delegate* delegate, | 49 Delegate* delegate); |
50 scoped_refptr<base::MessageLoopProxy> delegate_loop); | |
51 | 50 |
52 // Send the |data| to the |address|. | 51 // Send the |data| to the |address|. |
53 void Send(const net::IPEndPoint& address, const std::vector<char>& data); | 52 void Send(const net::IPEndPoint& address, const std::vector<char>& data); |
54 | 53 |
55 // Must be called before the socket is destroyed. The delegate may | 54 // Must be called before the socket is destroyed. The delegate may |
56 // not be called after |closed_task| is executed. | 55 // not be called after |closed_task| is executed. |
57 void Close(); | 56 void Close(); |
58 | 57 |
59 int socket_id() const { return socket_id_; } | 58 int socket_id() const { return socket_id_; } |
60 | 59 |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 scoped_refptr<base::MessageLoopProxy> ipc_message_loop_; | 101 scoped_refptr<base::MessageLoopProxy> ipc_message_loop_; |
103 scoped_refptr<base::MessageLoopProxy> delegate_message_loop_; | 102 scoped_refptr<base::MessageLoopProxy> delegate_message_loop_; |
104 int socket_id_; | 103 int socket_id_; |
105 Delegate* delegate_; | 104 Delegate* delegate_; |
106 State state_; | 105 State state_; |
107 | 106 |
108 DISALLOW_COPY_AND_ASSIGN(P2PSocketClient); | 107 DISALLOW_COPY_AND_ASSIGN(P2PSocketClient); |
109 }; | 108 }; |
110 | 109 |
111 #endif // CONTENT_RENDERER_P2P_SOCKET_CLIENT_H_ | 110 #endif // CONTENT_RENDERER_P2P_SOCKET_CLIENT_H_ |
OLD | NEW |