| Index: net/spdy/spdy_session.cc
|
| diff --git a/net/spdy/spdy_session.cc b/net/spdy/spdy_session.cc
|
| index 272ff25972dff52851288398a25ae02799889aad..0a2892d4c1996f47caf433cd5c3563667b318847 100644
|
| --- a/net/spdy/spdy_session.cc
|
| +++ b/net/spdy/spdy_session.cc
|
| @@ -45,6 +45,7 @@
|
| #include "net/log/net_log_with_source.h"
|
| #include "net/proxy/proxy_server.h"
|
| #include "net/socket/ssl_client_socket.h"
|
| +#include "net/spdy/push_promise_helper.h"
|
| #include "net/spdy/spdy_buffer_producer.h"
|
| #include "net/spdy/spdy_frame_builder.h"
|
| #include "net/spdy/spdy_http_utils.h"
|
| @@ -295,6 +296,25 @@ class RequestEquals {
|
| // the server permits more, we will never exceed this limit.
|
| const size_t kMaxConcurrentStreamLimit = 256;
|
|
|
| +class SpdyPushPromiseHelper : public PushPromiseHelper {
|
| + public:
|
| + explicit SpdyPushPromiseHelper(base::WeakPtr<SpdySession> session,
|
| + const GURL& url)
|
| + : session_(session), request_url_(url) {}
|
| +
|
| + void Cancel() override {
|
| + if (session_) {
|
| + session_->CancelPush(request_url_);
|
| + }
|
| + }
|
| +
|
| + const GURL& GetURL() override { return request_url_; }
|
| +
|
| + private:
|
| + base::WeakPtr<SpdySession> session_;
|
| + const GURL request_url_;
|
| +};
|
| +
|
| } // namespace
|
|
|
| SpdyProtocolErrorDetails MapFramerErrorToProtocolError(
|
| @@ -780,6 +800,21 @@ int SpdySession::GetPushStream(const GURL& url,
|
| return OK;
|
| }
|
|
|
| +void SpdySession::CancelPush(const GURL& url) {
|
| + UnclaimedPushedStreamContainer::const_iterator unclaimed_it =
|
| + unclaimed_pushed_streams_.find(url);
|
| + if (unclaimed_it == unclaimed_pushed_streams_.end())
|
| + return;
|
| +
|
| + SpdyStreamId stream_id = unclaimed_it->second.stream_id;
|
| +
|
| + if (active_streams_.find(stream_id) == active_streams_.end()) {
|
| + ResetStream(stream_id, RST_STREAM_CANCEL,
|
| + "Cancelled push stream with url: " + url.spec());
|
| + }
|
| + unclaimed_pushed_streams_.erase(unclaimed_it);
|
| +}
|
| +
|
| // {,Try}CreateStream() can be called with |in_io_loop_| set if a stream is
|
| // being created in response to another being closed due to received data.
|
|
|
| @@ -2637,21 +2672,6 @@ bool SpdySession::TryCreatePushStream(SpdyStreamId stream_id,
|
| return true;
|
| }
|
|
|
| -void SpdySession::CancelPush(const GURL& url) {
|
| - UnclaimedPushedStreamContainer::const_iterator unclaimed_it =
|
| - unclaimed_pushed_streams_.find(url);
|
| - if (unclaimed_it == unclaimed_pushed_streams_.end())
|
| - return;
|
| -
|
| - SpdyStreamId stream_id = unclaimed_it->second.stream_id;
|
| -
|
| - if (active_streams_.find(stream_id) == active_streams_.end()) {
|
| - ResetStream(stream_id, RST_STREAM_CANCEL,
|
| - "Cancelled push stream with url: " + url.spec());
|
| - }
|
| - unclaimed_pushed_streams_.erase(unclaimed_it);
|
| -}
|
| -
|
| void SpdySession::OnPushPromise(SpdyStreamId stream_id,
|
| SpdyStreamId promised_stream_id,
|
| SpdyHeaderBlock headers) {
|
|
|