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 452 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
463 | 463 |
464 num_refs_ = num_pending_io_ = max_refs_ = 0; | 464 num_refs_ = num_pending_io_ = max_refs_ = 0; |
465 entry_count_ = byte_count_ = 0; | 465 entry_count_ = byte_count_ = 0; |
466 | 466 |
467 if (!restarted_) { | 467 if (!restarted_) { |
468 buffer_bytes_ = 0; | 468 buffer_bytes_ = 0; |
469 trace_object_ = TraceObject::GetTraceObject(); | 469 trace_object_ = TraceObject::GetTraceObject(); |
470 // Create a recurrent timer of 30 secs. | 470 // Create a recurrent timer of 30 secs. |
471 int timer_delay = unit_test_ ? 1000 : 30000; | 471 int timer_delay = unit_test_ ? 1000 : 30000; |
472 timer_.Start(TimeDelta::FromMilliseconds(timer_delay), this, | 472 timer_.Start(TimeDelta::FromMilliseconds(timer_delay), this, |
473 &BackendImpl::OnStatsTimer); | 473 &BackendImpl::OnStatsTimer, FROM_HERE); |
474 } | 474 } |
475 | 475 |
476 init_ = true; | 476 init_ = true; |
477 | 477 |
478 if (data_->header.experiment != NO_EXPERIMENT && | 478 if (data_->header.experiment != NO_EXPERIMENT && |
479 cache_type_ != net::DISK_CACHE) { | 479 cache_type_ != net::DISK_CACHE) { |
480 // No experiment for other caches. | 480 // No experiment for other caches. |
481 return net::ERR_FAILED; | 481 return net::ERR_FAILED; |
482 } | 482 } |
483 | 483 |
(...skipping 1631 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2115 if (total_memory > kMaxBuffersSize || total_memory <= 0) | 2115 if (total_memory > kMaxBuffersSize || total_memory <= 0) |
2116 total_memory = kMaxBuffersSize; | 2116 total_memory = kMaxBuffersSize; |
2117 | 2117 |
2118 done = true; | 2118 done = true; |
2119 } | 2119 } |
2120 | 2120 |
2121 return static_cast<int>(total_memory); | 2121 return static_cast<int>(total_memory); |
2122 } | 2122 } |
2123 | 2123 |
2124 } // namespace disk_cache | 2124 } // namespace disk_cache |
OLD | NEW |