OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/url_request/sdch_dictionary_fetcher.h" | 5 #include "net/url_request/sdch_dictionary_fetcher.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 #include <queue> | 8 #include <queue> |
9 #include <set> | 9 #include <set> |
10 | 10 |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
160 DCHECK_EQ(request, current_request_.get()); | 160 DCHECK_EQ(request, current_request_.get()); |
161 DCHECK_EQ(next_state_, STATE_SEND_REQUEST_PENDING); | 161 DCHECK_EQ(next_state_, STATE_SEND_REQUEST_PENDING); |
162 DCHECK(!in_loop_); | 162 DCHECK(!in_loop_); |
163 DCHECK_NE(ERR_IO_PENDING, net_error); | 163 DCHECK_NE(ERR_IO_PENDING, net_error); |
164 | 164 |
165 // Confirm that the response isn't a stale read from the cache (as | 165 // Confirm that the response isn't a stale read from the cache (as |
166 // may happen in the reload case). If the response was not retrieved over | 166 // may happen in the reload case). If the response was not retrieved over |
167 // HTTP, it is presumed to be fresh. | 167 // HTTP, it is presumed to be fresh. |
168 HttpResponseHeaders* response_headers = request->response_headers(); | 168 HttpResponseHeaders* response_headers = request->response_headers(); |
169 if (net_error == OK && response_headers) { | 169 if (net_error == OK && response_headers) { |
170 ValidationType validation_type = response_headers->RequiresValidation( | 170 bool requires_validation = response_headers->RequiresValidation( |
171 request->response_info().request_time, | 171 request->response_info().request_time, |
172 request->response_info().response_time, base::Time::Now()); | 172 request->response_info().response_time, base::Time::Now()); |
173 // TODO(rdsmith): Maybe handle VALIDATION_ASYNCHRONOUS by queueing | 173 if (requires_validation) |
174 // a non-reload request for the dictionary. | |
175 if (validation_type != VALIDATION_NONE) | |
176 net_error = ERR_FAILED; | 174 net_error = ERR_FAILED; |
177 } | 175 } |
178 | 176 |
179 DoLoop(net_error); | 177 DoLoop(net_error); |
180 } | 178 } |
181 | 179 |
182 void SdchDictionaryFetcher::OnReadCompleted(URLRequest* request, | 180 void SdchDictionaryFetcher::OnReadCompleted(URLRequest* request, |
183 int bytes_read) { | 181 int bytes_read) { |
184 DCHECK(CalledOnValidThread()); | 182 DCHECK(CalledOnValidThread()); |
185 DCHECK_EQ(request, current_request_.get()); | 183 DCHECK_EQ(request, current_request_.get()); |
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
370 current_request_->net_log(), | 368 current_request_->net_log(), |
371 current_request_->was_cached()); | 369 current_request_->was_cached()); |
372 } | 370 } |
373 | 371 |
374 ResetRequest(); | 372 ResetRequest(); |
375 next_state_ = STATE_SEND_REQUEST; | 373 next_state_ = STATE_SEND_REQUEST; |
376 return OK; | 374 return OK; |
377 } | 375 } |
378 | 376 |
379 } // namespace net | 377 } // namespace net |
OLD | NEW |