[M85 Dev][EFL] Fix errors to generate ninja files
[platform/framework/web/chromium-efl.git] / chrome / browser / cache_stats_recorder.cc
1 // Copyright 2017 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "chrome/browser/cache_stats_recorder.h"
6
7 #include "components/web_cache/browser/web_cache_manager.h"
8 #include "content/public/browser/browser_thread.h"
9 #include "mojo/public/cpp/bindings/self_owned_associated_receiver.h"
10
11 CacheStatsRecorder::CacheStatsRecorder(int render_process_id)
12     : render_process_id_(render_process_id) {}
13
14 CacheStatsRecorder::~CacheStatsRecorder() = default;
15
16 // static
17 void CacheStatsRecorder::Create(
18     int render_process_id,
19     mojo::PendingAssociatedReceiver<chrome::mojom::CacheStatsRecorder>
20         receiver) {
21   mojo::MakeSelfOwnedAssociatedReceiver(
22       std::make_unique<CacheStatsRecorder>(render_process_id),
23       std::move(receiver));
24 }
25
26 void CacheStatsRecorder::RecordCacheStats(uint64_t capacity, uint64_t size) {
27   DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
28   web_cache::WebCacheManager::GetInstance()->ObserveStats(render_process_id_,
29                                                           capacity, size);
30 }