Chromium Code Reviews| Index: components/safe_browsing_db/v4_database.cc |
| diff --git a/components/safe_browsing_db/v4_database.cc b/components/safe_browsing_db/v4_database.cc |
| index 4b43498c5abf4bd2139d42ca51ef8528738694ef..c4838361c5fad5a71be18ebb22b4c43965db1b42 100644 |
| --- a/components/safe_browsing_db/v4_database.cc |
| +++ b/components/safe_browsing_db/v4_database.cc |
| @@ -8,6 +8,7 @@ |
| #include "base/debug/leak_annotations.h" |
| #include "base/files/file_util.h" |
| #include "base/memory/ptr_util.h" |
| +#include "base/metrics/histogram_macros.h" |
| #include "base/threading/thread_task_runner_handle.h" |
| #include "components/safe_browsing_db/v4_database.h" |
| #include "content/public/browser/browser_thread.h" |
| @@ -16,6 +17,12 @@ using content::BrowserThread; |
| namespace safe_browsing { |
| +namespace { |
| + |
| +const char kV4DatabaseSizeMetric[] = "SafeBrowsing.V4Database.Size"; |
| + |
| +} // namespace |
| + |
| // static |
| V4StoreFactory* V4Database::factory_ = NULL; |
| @@ -214,6 +221,17 @@ void V4Database::VerifyChecksumOnTaskRunner( |
| FROM_HERE, base::Bind(db_ready_for_updates_callback, stores_to_reset)); |
| } |
| +void V4Database::RecordFileSizeHistograms() { |
| + int db_size = 0; |
|
Scott Hess - ex-Googler
2016/10/21 23:36:45
These ints should all be int64_t to match FileSize
vakh (use Gerrit instead)
2016/10/24 19:39:32
Done.
|
| + for (const auto& store_map_iter : *store_map_) { |
| + const int size = |
| + store_map_iter.second->RecordAndReturnFileSize(kV4DatabaseSizeMetric); |
| + db_size += size; |
| + } |
| + const int db_size_kilobytes = static_cast<int>(db_size / 1024); |
| + UMA_HISTOGRAM_COUNTS(kV4DatabaseSizeMetric, db_size_kilobytes); |
| +} |
| + |
| ListInfo::ListInfo(const bool fetch_updates, |
| const std::string& filename, |
| const ListIdentifier& list_id, |