Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(561)

Unified Diff: chrome/browser/cache_stats_recorder.cc

Issue 2643183002: Convert ChromeViewHostMsg_UpdatedCacheStats to use mojo. (Closed)
Patch Set: Convert ChromeViewHostMsg_UpdatedCacheStats to use mojo. Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/cache_stats_recorder.h ('k') | chrome/browser/chrome_content_browser_client.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..db28ff9e005494b17a565450b4fae73efaf9a7f4
--- /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 "content/public/browser/browser_thread.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_CURRENTLY_ON(content::BrowserThread::UI);
+ web_cache::WebCacheManager::GetInstance()->ObserveStats(render_process_id_,
+ capacity, size);
+}
« no previous file with comments | « chrome/browser/cache_stats_recorder.h ('k') | chrome/browser/chrome_content_browser_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698