Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(72)

Side by Side Diff: net/quic/quic_client_promised_info.cc

Issue 2102253003: Make SpdyHeaderBlock non-copyable. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: iOS fix. Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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;
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 } 49 }
50 if (!SpdyUtils::UrlIsValid(headers)) { 50 if (!SpdyUtils::UrlIsValid(headers)) {
51 DVLOG(1) << "Promise for stream " << id_ << " has invalid URL " << url_; 51 DVLOG(1) << "Promise for stream " << id_ << " has invalid URL " << url_;
52 Reset(QUIC_INVALID_PROMISE_URL); 52 Reset(QUIC_INVALID_PROMISE_URL);
53 return; 53 return;
54 } 54 }
55 if (!session_->IsAuthorized(SpdyUtils::GetHostNameFromHeaderBlock(headers))) { 55 if (!session_->IsAuthorized(SpdyUtils::GetHostNameFromHeaderBlock(headers))) {
56 Reset(QUIC_UNAUTHORIZED_PROMISE_URL); 56 Reset(QUIC_UNAUTHORIZED_PROMISE_URL);
57 return; 57 return;
58 } 58 }
59 request_headers_.reset(new SpdyHeaderBlock(headers)); 59 request_headers_.reset(new SpdyHeaderBlock(headers.Clone()));
60 } 60 }
61 61
62 void QuicClientPromisedInfo::OnResponseHeaders(const SpdyHeaderBlock& headers) { 62 void QuicClientPromisedInfo::OnResponseHeaders(const SpdyHeaderBlock& headers) {
63 response_headers_.reset(new SpdyHeaderBlock(headers)); 63 response_headers_.reset(new SpdyHeaderBlock(headers.Clone()));
64 if (client_request_delegate_) { 64 if (client_request_delegate_) {
65 // We already have a client request waiting. 65 // We already have a client request waiting.
66 FinalValidation(); 66 FinalValidation();
67 } 67 }
68 } 68 }
69 69
70 void QuicClientPromisedInfo::Reset(QuicRstStreamErrorCode error_code) { 70 void QuicClientPromisedInfo::Reset(QuicRstStreamErrorCode error_code) {
71 QuicClientPushPromiseIndex::Delegate* delegate = client_request_delegate_; 71 QuicClientPushPromiseIndex::Delegate* delegate = client_request_delegate_;
72 session_->ResetPromised(id_, error_code); 72 session_->ResetPromised(id_, error_code);
73 session_->DeletePromised(this); 73 session_->DeletePromised(this);
(...skipping 26 matching lines...) Expand all
100 100
101 QuicAsyncStatus QuicClientPromisedInfo::HandleClientRequest( 101 QuicAsyncStatus QuicClientPromisedInfo::HandleClientRequest(
102 const SpdyHeaderBlock& request_headers, 102 const SpdyHeaderBlock& request_headers,
103 QuicClientPushPromiseIndex::Delegate* delegate) { 103 QuicClientPushPromiseIndex::Delegate* delegate) {
104 if (session_->IsClosedStream(id_)) { 104 if (session_->IsClosedStream(id_)) {
105 // There was a RST on the response stream. 105 // There was a RST on the response stream.
106 session_->DeletePromised(this); 106 session_->DeletePromised(this);
107 return QUIC_FAILURE; 107 return QUIC_FAILURE;
108 } 108 }
109 client_request_delegate_ = delegate; 109 client_request_delegate_ = delegate;
110 client_request_headers_.reset(new SpdyHeaderBlock(request_headers)); 110 client_request_headers_.reset(new SpdyHeaderBlock(request_headers.Clone()));
111 if (!response_headers_) { 111 if (!response_headers_) {
112 return QUIC_PENDING; 112 return QUIC_PENDING;
113 } 113 }
114 return FinalValidation(); 114 return FinalValidation();
115 } 115 }
116 116
117 void QuicClientPromisedInfo::Cancel() { 117 void QuicClientPromisedInfo::Cancel() {
118 // Don't fire OnRendezvousResult() for client initiated cancel. 118 // Don't fire OnRendezvousResult() for client initiated cancel.
119 client_request_delegate_ = nullptr; 119 client_request_delegate_ = nullptr;
120 Reset(QUIC_STREAM_CANCELLED); 120 Reset(QUIC_STREAM_CANCELLED);
121 } 121 }
122 122
123 } // namespace net 123 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/quic_chromium_client_stream_test.cc ('k') | net/quic/quic_client_promised_info_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698