1 // Copyright 2024 The Chromium Authors 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #ifndef NET_HTTP_HTTP_STREAM_POOL_HANDLE_H_ 6 #define NET_HTTP_HTTP_STREAM_POOL_HANDLE_H_ 7 8 #include <memory> 9 10 #include "base/memory/raw_ptr.h" 11 #include "base/memory/weak_ptr.h" 12 #include "net/base/net_export.h" 13 #include "net/http/http_stream_pool.h" 14 #include "net/socket/stream_socket_handle.h" 15 16 namespace net { 17 18 class StreamSocket; 19 20 // A StreamSocketHandle that is associated with an HttpStreamPool::Group. 21 class NET_EXPORT_PRIVATE HttpStreamPoolHandle : public StreamSocketHandle { 22 public: 23 HttpStreamPoolHandle(base::WeakPtr<HttpStreamPool::Group> group, 24 std::unique_ptr<StreamSocket> socket, 25 int64_t generation); 26 27 HttpStreamPoolHandle(const HttpStreamPoolHandle&) = delete; 28 HttpStreamPoolHandle& operator=(const HttpStreamPoolHandle&) = delete; 29 30 ~HttpStreamPoolHandle() override; 31 32 // StreamSocketHandle implementation: 33 void Reset() override; 34 bool IsPoolStalled() const override; 35 36 private: 37 base::WeakPtr<HttpStreamPool::Group> group_; 38 const int64_t generation_; 39 }; 40 41 } // namespace net 42 43 #endif // NET_HTTP_HTTP_STREAM_POOL_HANDLE_H_ 44