| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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/stats.h" | 5 #include "net/disk_cache/stats.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/string_util.h" | 8 #include "base/string_util.h" |
| 9 #include "net/disk_cache/backend_impl.h" | 9 #include "net/disk_cache/backend_impl.h" |
| 10 | 10 |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 if (!CreateStats(backend, &address, &stats)) | 116 if (!CreateStats(backend, &address, &stats)) |
| 117 return false; | 117 return false; |
| 118 *storage_addr = address.value(); | 118 *storage_addr = address.value(); |
| 119 } | 119 } |
| 120 | 120 |
| 121 storage_addr_ = address.value(); | 121 storage_addr_ = address.value(); |
| 122 backend_ = backend; | 122 backend_ = backend; |
| 123 if (!size_histogram_.get()) { | 123 if (!size_histogram_.get()) { |
| 124 // Stats may be reused when the cache is re-created, but we want only one | 124 // Stats may be reused when the cache is re-created, but we want only one |
| 125 // histogram at any given time. | 125 // histogram at any given time. |
| 126 size_histogram_.reset(new StatsHistogram(L"DiskCache.SizeStats")); | 126 size_histogram_.reset(new StatsHistogram("DiskCache.SizeStats")); |
| 127 size_histogram_->Init(this); | 127 size_histogram_->Init(this); |
| 128 } | 128 } |
| 129 | 129 |
| 130 memcpy(data_sizes_, stats.data_sizes, sizeof(data_sizes_)); | 130 memcpy(data_sizes_, stats.data_sizes, sizeof(data_sizes_)); |
| 131 memcpy(counters_, stats.counters, sizeof(counters_)); | 131 memcpy(counters_, stats.counters, sizeof(counters_)); |
| 132 | 132 |
| 133 return true; | 133 return true; |
| 134 } | 134 } |
| 135 | 135 |
| 136 Stats::~Stats() { | 136 Stats::~Stats() { |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 260 } | 260 } |
| 261 | 261 |
| 262 for (int i = MIN_COUNTER + 1; i < MAX_COUNTER; i++) { | 262 for (int i = MIN_COUNTER + 1; i < MAX_COUNTER; i++) { |
| 263 item.first = kCounterNames[i]; | 263 item.first = kCounterNames[i]; |
| 264 item.second = StringPrintf("0x%I64x", counters_[i]); | 264 item.second = StringPrintf("0x%I64x", counters_[i]); |
| 265 items->push_back(item); | 265 items->push_back(item); |
| 266 } | 266 } |
| 267 } | 267 } |
| 268 | 268 |
| 269 } // namespace disk_cache | 269 } // namespace disk_cache |
| 270 | |
| OLD | NEW |