Chromium Code Reviews| OLD | NEW |
|---|---|
| 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/disk_cache/blockfile/backend_worker_v3.h" | 5 #include "net/disk_cache/blockfile/backend_worker_v3.h" |
| 6 | 6 |
|
mmenke
2015/12/07 16:15:22
#include <limits>
Avi (use Gerrit)
2015/12/07 16:42:33
Can't believe I missed this one.
| |
| 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/files/file_path.h" | 9 #include "base/files/file_path.h" |
| 10 #include "base/files/file_util.h" | 10 #include "base/files/file_util.h" |
| 11 #include "base/message_loop/message_loop.h" | 11 #include "base/message_loop/message_loop.h" |
| 12 #include "base/strings/string_util.h" | 12 #include "base/strings/string_util.h" |
| 13 #include "base/strings/stringprintf.h" | 13 #include "base/strings/stringprintf.h" |
| 14 #include "base/time/time.h" | 14 #include "base/time/time.h" |
| 15 #include "base/timer/timer.h" | 15 #include "base/timer/timer.h" |
| 16 #include "net/base/net_errors.h" | 16 #include "net/base/net_errors.h" |
| (...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 390 if (current_size < GetIndexSize(data_->header.table_len) || | 390 if (current_size < GetIndexSize(data_->header.table_len) || |
| 391 data_->header.table_len & (kBaseTableLen - 1)) { | 391 data_->header.table_len & (kBaseTableLen - 1)) { |
| 392 LOG(ERROR) << "Corrupt Index file"; | 392 LOG(ERROR) << "Corrupt Index file"; |
| 393 return false; | 393 return false; |
| 394 } | 394 } |
| 395 | 395 |
| 396 AdjustMaxCacheSize(data_->header.table_len); | 396 AdjustMaxCacheSize(data_->header.table_len); |
| 397 | 397 |
| 398 #if !defined(NET_BUILD_STRESS_CACHE) | 398 #if !defined(NET_BUILD_STRESS_CACHE) |
| 399 if (data_->header.num_bytes < 0 || | 399 if (data_->header.num_bytes < 0 || |
| 400 (max_size_ < kint32max - kDefaultCacheSize && | 400 (max_size_ < std::numeric_limits<int32_t>::max() - kDefaultCacheSize && |
| 401 data_->header.num_bytes > max_size_ + kDefaultCacheSize)) { | 401 data_->header.num_bytes > max_size_ + kDefaultCacheSize)) { |
| 402 LOG(ERROR) << "Invalid cache (current) size"; | 402 LOG(ERROR) << "Invalid cache (current) size"; |
| 403 return false; | 403 return false; |
| 404 } | 404 } |
| 405 #endif | 405 #endif |
| 406 | 406 |
| 407 if (data_->header.num_entries < 0) { | 407 if (data_->header.num_entries < 0) { |
| 408 LOG(ERROR) << "Invalid number of entries"; | 408 LOG(ERROR) << "Invalid number of entries"; |
| 409 return false; | 409 return false; |
| 410 } | 410 } |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 458 #endif // defined(V3_NOT_JUST_YET_READY). | 458 #endif // defined(V3_NOT_JUST_YET_READY). |
| 459 | 459 |
| 460 int BackendImplV3::Worker::Init(const CompletionCallback& callback) { | 460 int BackendImplV3::Worker::Init(const CompletionCallback& callback) { |
| 461 return net::ERR_FAILED; | 461 return net::ERR_FAILED; |
| 462 } | 462 } |
| 463 | 463 |
| 464 BackendImplV3::Worker::~Worker() { | 464 BackendImplV3::Worker::~Worker() { |
| 465 } | 465 } |
| 466 | 466 |
| 467 } // namespace disk_cache | 467 } // namespace disk_cache |
| OLD | NEW |