OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 NET_BASE_CLIENT_SOCKET_HANDLE_H_ | 5 #ifndef NET_BASE_CLIENT_SOCKET_HANDLE_H_ |
6 #define NET_BASE_CLIENT_SOCKET_HANDLE_H_ | 6 #define NET_BASE_CLIENT_SOCKET_HANDLE_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/ref_counted.h" | 10 #include "base/ref_counted.h" |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 // | 55 // |
56 // NOTE: To prevent the socket from being kept alive, be sure to call its | 56 // NOTE: To prevent the socket from being kept alive, be sure to call its |
57 // Disconnect method. | 57 // Disconnect method. |
58 // | 58 // |
59 void Reset(); | 59 void Reset(); |
60 | 60 |
61 // Returns true when Init has completed successfully. | 61 // Returns true when Init has completed successfully. |
62 bool is_initialized() const { return socket_ != NULL; } | 62 bool is_initialized() const { return socket_ != NULL; } |
63 | 63 |
64 // These may only be used if is_initialized() is true. | 64 // These may only be used if is_initialized() is true. |
| 65 const std::string& group_name() const { return group_name_; } |
65 ClientSocket* socket() { return socket_->get(); } | 66 ClientSocket* socket() { return socket_->get(); } |
66 ClientSocket* release_socket() { return socket_->release(); } | 67 ClientSocket* release_socket() { return socket_->release(); } |
67 void set_socket(ClientSocket* s) { socket_->reset(s); } | 68 void set_socket(ClientSocket* s) { socket_->reset(s); } |
68 | 69 |
69 private: | 70 private: |
70 friend class ClientSocketPool; | 71 friend class ClientSocketPool; |
71 | 72 |
72 scoped_refptr<ClientSocketPool> pool_; | 73 scoped_refptr<ClientSocketPool> pool_; |
73 scoped_ptr<ClientSocket>* socket_; | 74 scoped_ptr<ClientSocket>* socket_; |
74 std::string group_name_; | 75 std::string group_name_; |
75 | 76 |
76 DISALLOW_COPY_AND_ASSIGN(ClientSocketHandle); | 77 DISALLOW_COPY_AND_ASSIGN(ClientSocketHandle); |
77 }; | 78 }; |
78 | 79 |
79 } // namespace net | 80 } // namespace net |
80 | 81 |
81 #endif // NET_BASE_CLIENT_SOCKET_HANDLE_H_ | 82 #endif // NET_BASE_CLIENT_SOCKET_HANDLE_H_ |
OLD | NEW |