| OLD | NEW |
| 1 // Copyright (c) 2016 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2016 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 #include "net/quic/quic_client_promised_info.h" | 5 #include "net/quic/quic_client_promised_info.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "net/quic/spdy_utils.h" | 8 #include "net/quic/spdy_utils.h" |
| 9 | 9 |
| 10 using net::SpdyHeaderBlock; | 10 using net::SpdyHeaderBlock; |
| 11 using net::kPushPromiseTimeoutSecs; | 11 using net::kPushPromiseTimeoutSecs; |
| 12 | 12 |
| 13 namespace net { | 13 namespace net { |
| 14 | 14 |
| 15 QuicClientPromisedInfo::QuicClientPromisedInfo(QuicClientSessionBase* session, | 15 QuicClientPromisedInfo::QuicClientPromisedInfo(QuicClientSessionBase* session, |
| 16 QuicStreamId id, | 16 QuicStreamId id, |
| 17 string url) | 17 string url) |
| 18 : session_(session), | 18 : session_(session), |
| 19 helper_(session->connection()->helper()), | 19 helper_(session->connection()->helper()), |
| 20 id_(id), | 20 id_(id), |
| 21 url_(url), | 21 url_(url), |
| 22 client_request_delegate_(nullptr) {} | 22 client_request_delegate_(nullptr) {} |
| 23 | 23 |
| 24 QuicClientPromisedInfo::~QuicClientPromisedInfo() {} | 24 QuicClientPromisedInfo::~QuicClientPromisedInfo() {} |
| 25 | 25 |
| 26 QuicTime QuicClientPromisedInfo::CleanupAlarm::OnAlarm() { | 26 void QuicClientPromisedInfo::CleanupAlarm::OnAlarm() { |
| 27 DVLOG(1) << "self GC alarm for stream " << promised_->id_; | 27 DVLOG(1) << "self GC alarm for stream " << promised_->id_; |
| 28 promised_->Reset(QUIC_STREAM_CANCELLED); | 28 promised_->Reset(QUIC_STREAM_CANCELLED); |
| 29 return QuicTime::Zero(); | |
| 30 } | 29 } |
| 31 | 30 |
| 32 void QuicClientPromisedInfo::Init() { | 31 void QuicClientPromisedInfo::Init() { |
| 33 cleanup_alarm_.reset( | 32 cleanup_alarm_.reset( |
| 34 helper_->CreateAlarm(new QuicClientPromisedInfo::CleanupAlarm(this))); | 33 helper_->CreateAlarm(new QuicClientPromisedInfo::CleanupAlarm(this))); |
| 35 cleanup_alarm_->Set(helper_->GetClock()->ApproximateNow().Add( | 34 cleanup_alarm_->Set(helper_->GetClock()->ApproximateNow().Add( |
| 36 QuicTime::Delta::FromSeconds(kPushPromiseTimeoutSecs))); | 35 QuicTime::Delta::FromSeconds(kPushPromiseTimeoutSecs))); |
| 37 } | 36 } |
| 38 | 37 |
| 39 void QuicClientPromisedInfo::OnPromiseHeaders(const SpdyHeaderBlock& headers) { | 38 void QuicClientPromisedInfo::OnPromiseHeaders(const SpdyHeaderBlock& headers) { |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 return FinalValidation(); | 113 return FinalValidation(); |
| 115 } | 114 } |
| 116 | 115 |
| 117 void QuicClientPromisedInfo::Cancel() { | 116 void QuicClientPromisedInfo::Cancel() { |
| 118 // Don't fire OnRendezvousResult() for client initiated cancel. | 117 // Don't fire OnRendezvousResult() for client initiated cancel. |
| 119 client_request_delegate_ = nullptr; | 118 client_request_delegate_ = nullptr; |
| 120 Reset(QUIC_STREAM_CANCELLED); | 119 Reset(QUIC_STREAM_CANCELLED); |
| 121 } | 120 } |
| 122 | 121 |
| 123 } // namespace net | 122 } // namespace net |
| OLD | NEW |