OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 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 "components/cronet/ios/cronet_bidirectional_stream.h" | 5 #include "components/cronet/ios/cronet_bidirectional_stream.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
183 // Get http status code from response headers. | 183 // Get http status code from response headers. |
184 int http_status_code = 0; | 184 int http_status_code = 0; |
185 const auto http_status_header = response_headers.find(":status"); | 185 const auto http_status_header = response_headers.find(":status"); |
186 if (http_status_header != response_headers.end()) | 186 if (http_status_header != response_headers.end()) |
187 base::StringToInt(http_status_header->second, &http_status_code); | 187 base::StringToInt(http_status_header->second, &http_status_code); |
188 const char* protocol = "unknown"; | 188 const char* protocol = "unknown"; |
189 switch (bidi_stream_->GetProtocol()) { | 189 switch (bidi_stream_->GetProtocol()) { |
190 case net::kProtoHTTP2: | 190 case net::kProtoHTTP2: |
191 protocol = "h2"; | 191 protocol = "h2"; |
192 break; | 192 break; |
193 case net::kProtoQUIC1SPDY3: | 193 case net::kProtoQUIC: |
194 protocol = "quic/1+spdy/3"; | 194 protocol = "quic/1+spdy/3"; |
195 break; | 195 break; |
196 default: | 196 default: |
197 break; | 197 break; |
198 } | 198 } |
199 delegate_->OnHeadersReceived(response_headers, protocol); | 199 delegate_->OnHeadersReceived(response_headers, protocol); |
200 } | 200 } |
201 | 201 |
202 void CronetBidirectionalStream::OnDataRead(int bytes_read) { | 202 void CronetBidirectionalStream::OnDataRead(int bytes_read) { |
203 DCHECK(environment_->IsOnNetworkThread()); | 203 DCHECK(environment_->IsOnNetworkThread()); |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
381 weak_factory_.InvalidateWeakPtrs(); | 381 weak_factory_.InvalidateWeakPtrs(); |
382 // Delete underlying |bidi_stream_| asynchronously as it may still be used. | 382 // Delete underlying |bidi_stream_| asynchronously as it may still be used. |
383 environment_->PostToNetworkThread( | 383 environment_->PostToNetworkThread( |
384 FROM_HERE, base::Bind(&base::DeletePointer<net::BidirectionalStream>, | 384 FROM_HERE, base::Bind(&base::DeletePointer<net::BidirectionalStream>, |
385 bidi_stream_.release())); | 385 bidi_stream_.release())); |
386 delegate_->OnSucceeded(); | 386 delegate_->OnSucceeded(); |
387 } | 387 } |
388 } | 388 } |
389 | 389 |
390 } // namespace cronet | 390 } // namespace cronet |
OLD | NEW |