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

Side by Side Diff: net/http/partial_data.cc

Issue 509783002: Http cache: Allow caching of byte ranges without strong validators. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/http/partial_data.h" 5 #include "net/http/partial_data.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/format_macros.h" 9 #include "base/format_macros.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after
273 } 273 }
274 274
275 if (headers->response_code() != 206) { 275 if (headers->response_code() != 206) {
276 DCHECK(byte_range_.IsValid()); 276 DCHECK(byte_range_.IsValid());
277 sparse_entry_ = false; 277 sparse_entry_ = false;
278 resource_size_ = entry->GetDataSize(kDataStream); 278 resource_size_ = entry->GetDataSize(kDataStream);
279 DVLOG(2) << "UpdateFromStoredHeaders size: " << resource_size_; 279 DVLOG(2) << "UpdateFromStoredHeaders size: " << resource_size_;
280 return true; 280 return true;
281 } 281 }
282 282
283 if (!headers->HasStrongValidators())
284 return false;
285
286 int64 length_value = headers->GetContentLength(); 283 int64 length_value = headers->GetContentLength();
287 if (length_value <= 0) 284 if (length_value <= 0)
288 return false; // We must have stored the resource length. 285 return false; // We must have stored the resource length.
289 286
290 resource_size_ = length_value; 287 resource_size_ = length_value;
291 288
292 // Make sure that this is really a sparse entry. 289 // Make sure that this is really a sparse entry.
293 return entry->CouldBeSparse(); 290 return entry->CouldBeSparse();
294 } 291 }
295 292
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
479 cached_min_len_ = result; 476 cached_min_len_ = result;
480 if (result >= 0) 477 if (result >= 0)
481 result = 1; // Return success, go ahead and validate the entry. 478 result = 1; // Return success, go ahead and validate the entry.
482 479
483 CompletionCallback cb = callback_; 480 CompletionCallback cb = callback_;
484 callback_.Reset(); 481 callback_.Reset();
485 cb.Run(result); 482 cb.Run(result);
486 } 483 }
487 484
488 } // namespace net 485 } // namespace net
OLDNEW
« net/http/http_cache_unittest.cc ('K') | « net/http/http_cache_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698