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 |
| 7 #include <stdint.h> |
| 8 |
| 9 #include <limits> |
| 10 |
7 #include "base/bind.h" | 11 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 12 #include "base/bind_helpers.h" |
9 #include "base/files/file_path.h" | 13 #include "base/files/file_path.h" |
10 #include "base/files/file_util.h" | 14 #include "base/files/file_util.h" |
11 #include "base/message_loop/message_loop.h" | 15 #include "base/message_loop/message_loop.h" |
12 #include "base/strings/string_util.h" | 16 #include "base/strings/string_util.h" |
13 #include "base/strings/stringprintf.h" | 17 #include "base/strings/stringprintf.h" |
14 #include "base/time/time.h" | 18 #include "base/time/time.h" |
15 #include "base/timer/timer.h" | 19 #include "base/timer/timer.h" |
16 #include "net/base/net_errors.h" | 20 #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) || | 394 if (current_size < GetIndexSize(data_->header.table_len) || |
391 data_->header.table_len & (kBaseTableLen - 1)) { | 395 data_->header.table_len & (kBaseTableLen - 1)) { |
392 LOG(ERROR) << "Corrupt Index file"; | 396 LOG(ERROR) << "Corrupt Index file"; |
393 return false; | 397 return false; |
394 } | 398 } |
395 | 399 |
396 AdjustMaxCacheSize(data_->header.table_len); | 400 AdjustMaxCacheSize(data_->header.table_len); |
397 | 401 |
398 #if !defined(NET_BUILD_STRESS_CACHE) | 402 #if !defined(NET_BUILD_STRESS_CACHE) |
399 if (data_->header.num_bytes < 0 || | 403 if (data_->header.num_bytes < 0 || |
400 (max_size_ < kint32max - kDefaultCacheSize && | 404 (max_size_ < std::numeric_limits<int32_t>::max() - kDefaultCacheSize && |
401 data_->header.num_bytes > max_size_ + kDefaultCacheSize)) { | 405 data_->header.num_bytes > max_size_ + kDefaultCacheSize)) { |
402 LOG(ERROR) << "Invalid cache (current) size"; | 406 LOG(ERROR) << "Invalid cache (current) size"; |
403 return false; | 407 return false; |
404 } | 408 } |
405 #endif | 409 #endif |
406 | 410 |
407 if (data_->header.num_entries < 0) { | 411 if (data_->header.num_entries < 0) { |
408 LOG(ERROR) << "Invalid number of entries"; | 412 LOG(ERROR) << "Invalid number of entries"; |
409 return false; | 413 return false; |
410 } | 414 } |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
458 #endif // defined(V3_NOT_JUST_YET_READY). | 462 #endif // defined(V3_NOT_JUST_YET_READY). |
459 | 463 |
460 int BackendImplV3::Worker::Init(const CompletionCallback& callback) { | 464 int BackendImplV3::Worker::Init(const CompletionCallback& callback) { |
461 return net::ERR_FAILED; | 465 return net::ERR_FAILED; |
462 } | 466 } |
463 | 467 |
464 BackendImplV3::Worker::~Worker() { | 468 BackendImplV3::Worker::~Worker() { |
465 } | 469 } |
466 | 470 |
467 } // namespace disk_cache | 471 } // namespace disk_cache |
OLD | NEW |