OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/file_path.h" | 7 #include "base/file_path.h" |
8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
10 #include "base/metrics/field_trial.h" | 10 #include "base/metrics/field_trial.h" |
(...skipping 454 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
465 } | 465 } |
466 | 466 |
467 num_refs_ = num_pending_io_ = max_refs_ = 0; | 467 num_refs_ = num_pending_io_ = max_refs_ = 0; |
468 entry_count_ = byte_count_ = 0; | 468 entry_count_ = byte_count_ = 0; |
469 | 469 |
470 if (!restarted_) { | 470 if (!restarted_) { |
471 buffer_bytes_ = 0; | 471 buffer_bytes_ = 0; |
472 trace_object_ = TraceObject::GetTraceObject(); | 472 trace_object_ = TraceObject::GetTraceObject(); |
473 // Create a recurrent timer of 30 secs. | 473 // Create a recurrent timer of 30 secs. |
474 int timer_delay = unit_test_ ? 1000 : 30000; | 474 int timer_delay = unit_test_ ? 1000 : 30000; |
475 timer_.Start(FROM_HERE, TimeDelta::FromMilliseconds(timer_delay), this, | 475 timer_.Start(TimeDelta::FromMilliseconds(timer_delay), this, |
476 &BackendImpl::OnStatsTimer); | 476 &BackendImpl::OnStatsTimer); |
477 } | 477 } |
478 | 478 |
479 init_ = true; | 479 init_ = true; |
480 | 480 |
481 if (data_->header.experiment != NO_EXPERIMENT && | 481 if (data_->header.experiment != NO_EXPERIMENT && |
482 cache_type_ != net::DISK_CACHE) { | 482 cache_type_ != net::DISK_CACHE) { |
483 // No experiment for other caches. | 483 // No experiment for other caches. |
484 return net::ERR_FAILED; | 484 return net::ERR_FAILED; |
485 } | 485 } |
(...skipping 1634 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2120 if (total_memory > kMaxBuffersSize || total_memory <= 0) | 2120 if (total_memory > kMaxBuffersSize || total_memory <= 0) |
2121 total_memory = kMaxBuffersSize; | 2121 total_memory = kMaxBuffersSize; |
2122 | 2122 |
2123 done = true; | 2123 done = true; |
2124 } | 2124 } |
2125 | 2125 |
2126 return static_cast<int>(total_memory); | 2126 return static_cast<int>(total_memory); |
2127 } | 2127 } |
2128 | 2128 |
2129 } // namespace disk_cache | 2129 } // namespace disk_cache |
OLD | NEW |