Index: net/quic/chromium/quic_chromium_client_session.h |
diff --git a/net/quic/chromium/quic_chromium_client_session.h b/net/quic/chromium/quic_chromium_client_session.h |
index dbc6b7358667d0af35519f59fd033bcf3dbcdcb9..a4c07d1294c2a1ba827ff0c796c94a5765f81a10 100644 |
--- a/net/quic/chromium/quic_chromium_client_session.h |
+++ b/net/quic/chromium/quic_chromium_client_session.h |
@@ -78,24 +78,24 @@ class NET_EXPORT_PRIVATE QuicChromiumClientSession |
// A helper class used to manage a request to create a stream. |
class NET_EXPORT_PRIVATE StreamRequest { |
public: |
- StreamRequest(); |
+ // Cancels any pending stream creation request and resets |stream_| if |
+ // it has not yet been released. |
~StreamRequest(); |
// Starts a request to create a stream. If OK is returned, then |
- // |stream| will be updated with the newly created stream. If |
+ // |stream_| will be updated with the newly created stream. If |
// ERR_IO_PENDING is returned, then when the request is eventuallly |
// complete |callback| will be called. |
- int StartRequest(const base::WeakPtr<QuicChromiumClientSession>& session, |
- QuicChromiumClientStream** stream, |
- const CompletionCallback& callback); |
+ int StartRequest(const CompletionCallback& callback); |
- // Cancels any pending stream creation request. May be called |
- // repeatedly. |
- void CancelRequest(); |
+ // Releases |stream_| to the caller |
+ QuicChromiumClientStream* ReleaseStream(); |
private: |
friend class QuicChromiumClientSession; |
+ StreamRequest(const base::WeakPtr<QuicChromiumClientSession>& session); |
+ |
// Called by |session_| for an asynchronous request when the stream |
// request has finished successfully. |
void OnRequestCompleteSuccess(QuicChromiumClientStream* stream); |
@@ -107,7 +107,7 @@ class NET_EXPORT_PRIVATE QuicChromiumClientSession |
base::WeakPtr<QuicChromiumClientSession> session_; |
CompletionCallback callback_; |
- QuicChromiumClientStream** stream_; |
+ QuicChromiumClientStream* stream_; |
// For tracking how much time pending stream requests wait. |
base::TimeTicks pending_start_time_; |
@@ -147,6 +147,8 @@ class NET_EXPORT_PRIVATE QuicChromiumClientSession |
void AddObserver(Observer* observer); |
void RemoveObserver(Observer* observer); |
+ std::unique_ptr<StreamRequest> CreateStreamRequest(); |
+ |
// Attempts to create a new stream. If the stream can be |
// created immediately, returns OK. If the open stream limit |
// has been reached, returns ERR_IO_PENDING, and |request| |
@@ -154,8 +156,7 @@ class NET_EXPORT_PRIVATE QuicChromiumClientSession |
// be completed asynchronously. |
// TODO(rch): remove |stream| from this and use setter on |request| |
// and fix in spdy too. |
- int TryCreateStream(StreamRequest* request, |
- QuicChromiumClientStream** stream); |
+ int TryCreateStream(StreamRequest* request); |
// Cancels the pending stream creation request. |
void CancelRequest(StreamRequest* request); |