Index: chrome/browser/cache_stats_recorder.cc |
diff --git a/chrome/browser/cache_stats_recorder.cc b/chrome/browser/cache_stats_recorder.cc |
new file mode 100644 |
index 0000000000000000000000000000000000000000..84646f9d49cfed74f0f068e8552b35a9047f4c20 |
--- /dev/null |
+++ b/chrome/browser/cache_stats_recorder.cc |
@@ -0,0 +1,29 @@ |
+// Copyright 2017 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#include "chrome/browser/cache_stats_recorder.h" |
+ |
+#include "base/memory/ptr_util.h" |
+#include "components/web_cache/browser/web_cache_manager.h" |
+#include "mojo/public/cpp/bindings/strong_binding.h" |
+ |
+CacheStatsRecorder::CacheStatsRecorder(int render_process_id) |
+ : render_process_id_(render_process_id) {} |
+ |
+CacheStatsRecorder::~CacheStatsRecorder() = default; |
+ |
+// static |
+void CacheStatsRecorder::Create( |
+ int render_process_id, |
+ chrome::mojom::CacheStatsRecorderRequest request) { |
+ mojo::MakeStrongBinding( |
+ base::MakeUnique<CacheStatsRecorder>(render_process_id), |
+ std::move(request)); |
+} |
+ |
+void CacheStatsRecorder::RecordCacheStats(uint64_t capacity, uint64_t size) { |
+ DCHECK(thread_checker_.CalledOnValidThread()); |
+ web_cache::WebCacheManager::GetInstance()->ObserveStats(render_process_id_, |
sky
2017/02/03 16:31:44
Is there any concern that by the time this functio
|
+ capacity, size); |
+} |