Chromium Code Reviews| 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..3a83436e00d4a8f616e4b1aa45806d25e1ccb165 |
| --- /dev/null |
| +++ b/chrome/browser/cache_stats_recorder.cc |
| @@ -0,0 +1,30 @@ |
| +// 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_associated_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::CacheStatsRecorderAssociatedRequest request) { |
| + mojo::MakeStrongAssociatedBinding( |
| + base::MakeUnique<CacheStatsRecorder>(render_process_id), |
| + std::move(request)); |
| +} |
| + |
| +void CacheStatsRecorder::RecordCacheStats(uint64_t capacity, uint64_t size) { |
| + DCHECK(thread_checker_.CalledOnValidThread()); |
| + // XXX(nigeltao): do we have to do this on the UI thread?? |
| + web_cache::WebCacheManager::GetInstance()->ObserveStats(render_process_id_, |
|
Ken Rockot(use gerrit already)
2017/03/13 17:19:58
IIUC this is clearly already happening on the IO t
|
| + capacity, size); |
| +} |