| 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 |
| 489 #if defined(STRESS_CACHE_EXTENDED_VALIDATION) | 492 #if defined(STRESS_CACHE_EXTENDED_VALIDATION) |
| 490 trace_object_->EnableTracing(false); | 493 trace_object_->EnableTracing(false); |
| 491 int sc = SelfCheck(); | 494 int sc = SelfCheck(); |
| 492 if (sc < 0 && sc != ERR_NUM_ENTRIES_MISMATCH) | 495 if (sc < 0 && sc != ERR_NUM_ENTRIES_MISMATCH) |
| 493 NOTREACHED(); | 496 NOTREACHED(); |
| 494 trace_object_->EnableTracing(true); | 497 trace_object_->EnableTracing(true); |
| 495 #endif | 498 #endif |
| 496 | 499 |
| 497 if (previous_crash) { | 500 if (previous_crash) { |
| 498 ReportError(ERR_PREVIOUS_CRASH); | 501 ReportError(ERR_PREVIOUS_CRASH); |
| (...skipping 1728 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2227 if (total_memory > kMaxBuffersSize || total_memory <= 0) | 2230 if (total_memory > kMaxBuffersSize || total_memory <= 0) |
| 2228 total_memory = kMaxBuffersSize; | 2231 total_memory = kMaxBuffersSize; |
| 2229 | 2232 |
| 2230 done = true; | 2233 done = true; |
| 2231 } | 2234 } |
| 2232 | 2235 |
| 2233 return static_cast<int>(total_memory); | 2236 return static_cast<int>(total_memory); |
| 2234 } | 2237 } |
| 2235 | 2238 |
| 2236 } // namespace disk_cache | 2239 } // namespace disk_cache |
| OLD | NEW |