| 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_PUBLIC_RENDERER_P2P_SOCKET_CLIENT_H_ | 5 #ifndef CONTENT_PUBLIC_RENDERER_P2P_SOCKET_CLIENT_H_ |
| 6 #define CONTENT_PUBLIC_RENDERER_P2P_SOCKET_CLIENT_H_ | 6 #define CONTENT_PUBLIC_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" |
| 11 #include "content/common/content_export.h" |
| 11 #include "content/public/common/p2p_socket_type.h" | 12 #include "content/public/common/p2p_socket_type.h" |
| 12 #include "net/base/ip_endpoint.h" | 13 #include "net/base/ip_endpoint.h" |
| 13 | 14 |
| 14 namespace content { | 15 namespace content { |
| 15 | 16 |
| 16 class P2PSocketClientDelegate; | 17 class P2PSocketClientDelegate; |
| 17 | 18 |
| 18 // P2P socket that routes all calls over IPC. | 19 // P2P socket that routes all calls over IPC. |
| 19 // Note that while ref-counting is thread-safe, all methods must be | 20 // Note that while ref-counting is thread-safe, all methods must be |
| 20 // called on the same thread. | 21 // called on the same thread. |
| 21 class P2PSocketClient : public base::RefCountedThreadSafe<P2PSocketClient> { | 22 class CONTENT_EXPORT P2PSocketClient : |
| 23 public base::RefCountedThreadSafe<P2PSocketClient> { |
| 22 public: | 24 public: |
| 23 // Create a new P2PSocketClient() of the specified |type| and connected to | 25 // Create a new P2PSocketClient() of the specified |type| and connected to |
| 24 // the specified |address|. |address| matters only when |type| is set to | 26 // the specified |address|. |address| matters only when |type| is set to |
| 25 // P2P_SOCKET_TCP_CLIENT. The methods on the returned socket may only be | 27 // P2P_SOCKET_TCP_CLIENT. The methods on the returned socket may only be |
| 26 // called on the same thread that created it. | 28 // called on the same thread that created it. |
| 27 static scoped_refptr<P2PSocketClient> Create( | 29 static scoped_refptr<P2PSocketClient> Create( |
| 28 P2PSocketType type, | 30 P2PSocketType type, |
| 29 const net::IPEndPoint& local_address, | 31 const net::IPEndPoint& local_address, |
| 30 const net::IPEndPoint& remote_address, | 32 const net::IPEndPoint& remote_address, |
| 31 P2PSocketClientDelegate* delegate); | 33 P2PSocketClientDelegate* delegate); |
| (...skipping 19 matching lines...) Expand all Loading... |
| 51 protected: | 53 protected: |
| 52 virtual ~P2PSocketClient() {} | 54 virtual ~P2PSocketClient() {} |
| 53 | 55 |
| 54 private: | 56 private: |
| 55 // Calls destructor. | 57 // Calls destructor. |
| 56 friend class base::RefCountedThreadSafe<P2PSocketClient>; | 58 friend class base::RefCountedThreadSafe<P2PSocketClient>; |
| 57 }; | 59 }; |
| 58 } // namespace content | 60 } // namespace content |
| 59 | 61 |
| 60 #endif // CONTENT_PUBLIC_RENDERER_P2P_SOCKET_CLIENT_H_ | 62 #endif // CONTENT_PUBLIC_RENDERER_P2P_SOCKET_CLIENT_H_ |
| OLD | NEW |