| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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/simple/simple_index.h" | 5 #include "net/disk_cache/simple/simple_index.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <limits> | 8 #include <limits> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 423 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 434 init_method_ = load_result->init_method; | 434 init_method_ = load_result->init_method; |
| 435 | 435 |
| 436 // The actual IO is asynchronous, so calling WriteToDisk() shouldn't slow the | 436 // The actual IO is asynchronous, so calling WriteToDisk() shouldn't slow the |
| 437 // merge down much. | 437 // merge down much. |
| 438 if (load_result->flush_required) | 438 if (load_result->flush_required) |
| 439 WriteToDisk(INDEX_WRITE_REASON_STARTUP_MERGE); | 439 WriteToDisk(INDEX_WRITE_REASON_STARTUP_MERGE); |
| 440 | 440 |
| 441 SIMPLE_CACHE_UMA(CUSTOM_COUNTS, | 441 SIMPLE_CACHE_UMA(CUSTOM_COUNTS, |
| 442 "IndexInitializationWaiters", cache_type_, | 442 "IndexInitializationWaiters", cache_type_, |
| 443 to_run_when_initialized_.size(), 0, 100, 20); | 443 to_run_when_initialized_.size(), 0, 100, 20); |
| 444 SIMPLE_CACHE_UMA(CUSTOM_COUNTS, "IndexNumEntriesOnInit", cache_type_, |
| 445 entries_set_.size(), 0, 100000, 50); |
| 446 SIMPLE_CACHE_UMA( |
| 447 MEMORY_KB, "CacheSizeOnInit", cache_type_, |
| 448 static_cast<base::HistogramBase::Sample>(cache_size_ / kBytesInKb)); |
| 449 SIMPLE_CACHE_UMA( |
| 450 MEMORY_KB, "MaxCacheSizeOnInit", cache_type_, |
| 451 static_cast<base::HistogramBase::Sample>(max_size_ / kBytesInKb)); |
| 452 if (max_size_ > 0) { |
| 453 SIMPLE_CACHE_UMA(PERCENTAGE, "PercentFullOnInit", cache_type_, |
| 454 static_cast<base::HistogramBase::Sample>( |
| 455 (cache_size_ * 100) / max_size_)); |
| 456 } |
| 457 |
| 444 // Run all callbacks waiting for the index to come up. | 458 // Run all callbacks waiting for the index to come up. |
| 445 for (CallbackList::iterator it = to_run_when_initialized_.begin(), | 459 for (CallbackList::iterator it = to_run_when_initialized_.begin(), |
| 446 end = to_run_when_initialized_.end(); it != end; ++it) { | 460 end = to_run_when_initialized_.end(); it != end; ++it) { |
| 447 io_thread_->PostTask(FROM_HERE, base::Bind((*it), net::OK)); | 461 io_thread_->PostTask(FROM_HERE, base::Bind((*it), net::OK)); |
| 448 } | 462 } |
| 449 to_run_when_initialized_.clear(); | 463 to_run_when_initialized_.clear(); |
| 450 } | 464 } |
| 451 | 465 |
| 452 #if defined(OS_ANDROID) | 466 #if defined(OS_ANDROID) |
| 453 void SimpleIndex::OnApplicationStateChange( | 467 void SimpleIndex::OnApplicationStateChange( |
| (...skipping 30 matching lines...) Expand all Loading... |
| 484 start - last_write_to_disk_); | 498 start - last_write_to_disk_); |
| 485 } | 499 } |
| 486 } | 500 } |
| 487 last_write_to_disk_ = start; | 501 last_write_to_disk_ = start; |
| 488 | 502 |
| 489 index_file_->WriteToDisk(reason, entries_set_, cache_size_, start, | 503 index_file_->WriteToDisk(reason, entries_set_, cache_size_, start, |
| 490 app_on_background_, base::Closure()); | 504 app_on_background_, base::Closure()); |
| 491 } | 505 } |
| 492 | 506 |
| 493 } // namespace disk_cache | 507 } // namespace disk_cache |
| OLD | NEW |