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/backend_impl.h" | 5 #include "net/disk_cache/backend_impl.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/file_path.h" | 9 #include "base/file_path.h" |
10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
(...skipping 468 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
479 | 479 |
480 eviction_.Init(this); | 480 eviction_.Init(this); |
481 | 481 |
482 // stats_ and rankings_ may end up calling back to us so we better be enabled. | 482 // stats_ and rankings_ may end up calling back to us so we better be enabled. |
483 disabled_ = false; | 483 disabled_ = false; |
484 if (!stats_.Init(this, &data_->header.stats)) | 484 if (!stats_.Init(this, &data_->header.stats)) |
485 return net::ERR_FAILED; | 485 return net::ERR_FAILED; |
486 | 486 |
487 disabled_ = !rankings_.Init(this, new_eviction_); | 487 disabled_ = !rankings_.Init(this, new_eviction_); |
488 | 488 |
489 if (!disabled_ && !(user_flags_ & kNoRandom) && base::RandInt(0, 99) < 2) | |
490 rankings_.SelfCheck(); // Ignore return value for now. | |
491 | |
492 #if defined(STRESS_CACHE_EXTENDED_VALIDATION) | 489 #if defined(STRESS_CACHE_EXTENDED_VALIDATION) |
493 trace_object_->EnableTracing(false); | 490 trace_object_->EnableTracing(false); |
494 int sc = SelfCheck(); | 491 int sc = SelfCheck(); |
495 if (sc < 0 && sc != ERR_NUM_ENTRIES_MISMATCH) | 492 if (sc < 0 && sc != ERR_NUM_ENTRIES_MISMATCH) |
496 NOTREACHED(); | 493 NOTREACHED(); |
497 trace_object_->EnableTracing(true); | 494 trace_object_->EnableTracing(true); |
498 #endif | 495 #endif |
499 | 496 |
500 if (previous_crash) { | 497 if (previous_crash) { |
501 ReportError(ERR_PREVIOUS_CRASH); | 498 ReportError(ERR_PREVIOUS_CRASH); |
(...skipping 1700 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2202 if (total_memory > kMaxBuffersSize || total_memory <= 0) | 2199 if (total_memory > kMaxBuffersSize || total_memory <= 0) |
2203 total_memory = kMaxBuffersSize; | 2200 total_memory = kMaxBuffersSize; |
2204 | 2201 |
2205 done = true; | 2202 done = true; |
2206 } | 2203 } |
2207 | 2204 |
2208 return static_cast<int>(total_memory); | 2205 return static_cast<int>(total_memory); |
2209 } | 2206 } |
2210 | 2207 |
2211 } // namespace disk_cache | 2208 } // namespace disk_cache |
OLD | NEW |