Commit 96d0202c authored by zhongyi's avatar zhongyi Committed by Commit bot

Add methods in spdy/quic session to get stream id of pushed stream given the request url

BUG=232040

Review-Url: https://codereview.chromium.org/2351373003
Cr-Commit-Position: refs/heads/master@{#420574}
parent a695888f
...@@ -665,6 +665,16 @@ int QuicChromiumClientSession::GetNumSentClientHellos() const { ...@@ -665,6 +665,16 @@ int QuicChromiumClientSession::GetNumSentClientHellos() const {
return crypto_stream_->num_sent_client_hellos(); return crypto_stream_->num_sent_client_hellos();
} }
QuicStreamId QuicChromiumClientSession::GetStreamIdForPush(
const GURL& pushed_url) {
QuicClientPromisedInfo* promised_info =
QuicClientSessionBase::GetPromisedByUrl(pushed_url.spec());
if (!promised_info)
return 0;
return promised_info->id();
}
bool QuicChromiumClientSession::CanPool(const std::string& hostname, bool QuicChromiumClientSession::CanPool(const std::string& hostname,
PrivacyMode privacy_mode) const { PrivacyMode privacy_mode) const {
DCHECK(connection()->connected()); DCHECK(connection()->connected());
......
...@@ -237,6 +237,10 @@ class NET_EXPORT_PRIVATE QuicChromiumClientSession ...@@ -237,6 +237,10 @@ class NET_EXPORT_PRIVATE QuicChromiumClientSession
// than the number of round-trips needed for the handshake. // than the number of round-trips needed for the handshake.
int GetNumSentClientHellos() const; int GetNumSentClientHellos() const;
// Returns the stream id of the push stream if it is not claimed yet, or 0
// otherwise.
QuicStreamId GetStreamIdForPush(const GURL& pushed_url);
// Returns true if |hostname| may be pooled onto this session. If this // Returns true if |hostname| may be pooled onto this session. If this
// is a secure QUIC session, then |hostname| must match the certificate // is a secure QUIC session, then |hostname| must match the certificate
// presented during the handshake. // presented during the handshake.
......
...@@ -1696,10 +1696,6 @@ void SpdySession::LogAbandonedActiveStream(ActiveStreamMap::const_iterator it, ...@@ -1696,10 +1696,6 @@ void SpdySession::LogAbandonedActiveStream(ActiveStreamMap::const_iterator it,
DCHECK_GT(it->first, 0u); DCHECK_GT(it->first, 0u);
LogAbandonedStream(it->second.stream, status); LogAbandonedStream(it->second.stream, status);
++streams_abandoned_count_; ++streams_abandoned_count_;
if (it->second.stream->type() == SPDY_PUSH_STREAM &&
unclaimed_pushed_streams_.find(it->second.stream->url()) !=
unclaimed_pushed_streams_.end()) {
}
} }
SpdyStreamId SpdySession::GetNewStreamId() { SpdyStreamId SpdySession::GetNewStreamId() {
...@@ -1892,6 +1888,14 @@ void SpdySession::DeleteStream(std::unique_ptr<SpdyStream> stream, int status) { ...@@ -1892,6 +1888,14 @@ void SpdySession::DeleteStream(std::unique_ptr<SpdyStream> stream, int status) {
} }
} }
SpdyStreamId SpdySession::GetStreamIdForPush(const GURL& url) {
UnclaimedPushedStreamContainer::const_iterator unclaimed_it =
unclaimed_pushed_streams_.find(url);
if (unclaimed_it == unclaimed_pushed_streams_.end())
return 0;
return unclaimed_it->second.stream_id;
}
base::WeakPtr<SpdyStream> SpdySession::GetActivePushStream(const GURL& url) { base::WeakPtr<SpdyStream> SpdySession::GetActivePushStream(const GURL& url) {
UnclaimedPushedStreamContainer::const_iterator unclaimed_it = UnclaimedPushedStreamContainer::const_iterator unclaimed_it =
unclaimed_pushed_streams_.find(url); unclaimed_pushed_streams_.find(url);
......
...@@ -812,6 +812,10 @@ class NET_EXPORT SpdySession : public BufferedSpdyFramerVisitorInterface, ...@@ -812,6 +812,10 @@ class NET_EXPORT SpdySession : public BufferedSpdyFramerVisitorInterface,
// that |stream| may hold the last reference to the session. // that |stream| may hold the last reference to the session.
void DeleteStream(std::unique_ptr<SpdyStream> stream, int status); void DeleteStream(std::unique_ptr<SpdyStream> stream, int status);
// Returns the stream id of the push stream if it is not claimed yet, or 0
// otherwise.
SpdyStreamId GetStreamIdForPush(const GURL& url);
// Check if we have a pending pushed-stream for this url // Check if we have a pending pushed-stream for this url
// Returns the stream if found (and returns it from the pending // Returns the stream if found (and returns it from the pending
// list). Returns NULL otherwise. // list). Returns NULL otherwise.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment