OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_IMPL_H_ | 5 #ifndef CONTENT_RENDERER_P2P_SOCKET_CLIENT_IMPL_H_ |
6 #define CONTENT_RENDERER_P2P_SOCKET_CLIENT_IMPL_H_ | 6 #define CONTENT_RENDERER_P2P_SOCKET_CLIENT_IMPL_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" |
11 #include "content/common/p2p_socket_type.h" | 11 #include "content/common/p2p_socket_type.h" |
12 #include "content/renderer/p2p/socket_client.h" | 12 #include "content/renderer/p2p/socket_client.h" |
13 #include "net/base/ip_endpoint.h" | 13 #include "net/base/ip_endpoint.h" |
14 | 14 |
15 namespace base { | 15 namespace base { |
16 class MessageLoopProxy; | 16 class SingleThreadTaskRunner; |
17 class TimeTicks; | 17 class TimeTicks; |
18 } // namespace base | 18 } // namespace base |
19 | 19 |
20 namespace content { | 20 namespace content { |
21 | 21 |
22 class P2PSocketDispatcher; | 22 class P2PSocketDispatcher; |
23 | 23 |
24 // P2P socket that routes all calls over IPC. | 24 // P2P socket that routes all calls over IPC. |
25 // | 25 // |
26 // The object runs on two threads: IPC thread and delegate thread. The | 26 // The object runs on two threads: IPC thread and delegate thread. The |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 const net::IPEndPoint& local_address, | 103 const net::IPEndPoint& local_address, |
104 const P2PHostAndIPEndPoint& remote_address); | 104 const P2PHostAndIPEndPoint& remote_address); |
105 | 105 |
106 // Scheduled on the IPC thread to finish closing the connection. | 106 // Scheduled on the IPC thread to finish closing the connection. |
107 void DoClose(); | 107 void DoClose(); |
108 | 108 |
109 // Called by the dispatcher when it is destroyed. | 109 // Called by the dispatcher when it is destroyed. |
110 void Detach(); | 110 void Detach(); |
111 | 111 |
112 P2PSocketDispatcher* dispatcher_; | 112 P2PSocketDispatcher* dispatcher_; |
113 scoped_refptr<base::MessageLoopProxy> ipc_message_loop_; | 113 scoped_refptr<base::SingleThreadTaskRunner> ipc_task_runner_; |
114 scoped_refptr<base::MessageLoopProxy> delegate_message_loop_; | 114 scoped_refptr<base::MessageLoopProxy> delegate_message_loop_; |
115 int socket_id_; | 115 int socket_id_; |
116 P2PSocketClientDelegate* delegate_; | 116 P2PSocketClientDelegate* delegate_; |
117 State state_; | 117 State state_; |
118 | 118 |
119 // These two fields are used to identify packets for tracing. | 119 // These two fields are used to identify packets for tracing. |
120 uint32 random_socket_id_; | 120 uint32 random_socket_id_; |
121 uint32 next_packet_id_; | 121 uint32 next_packet_id_; |
122 | 122 |
123 DISALLOW_COPY_AND_ASSIGN(P2PSocketClientImpl); | 123 DISALLOW_COPY_AND_ASSIGN(P2PSocketClientImpl); |
124 }; | 124 }; |
125 | 125 |
126 } // namespace content | 126 } // namespace content |
127 | 127 |
128 #endif // CONTENT_RENDERER_P2P_SOCKET_CLIENT_IMPL_H_ | 128 #endif // CONTENT_RENDERER_P2P_SOCKET_CLIENT_IMPL_H_ |
OLD | NEW |