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

Unified Diff: components/web_cache/browser/web_cache_manager.cc

Issue 1706603004: Replace web_cache_messages.h with Mojo service. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed Ken's comments Created 4 years, 10 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
Index: components/web_cache/browser/web_cache_manager.cc
diff --git a/components/web_cache/browser/web_cache_manager.cc b/components/web_cache/browser/web_cache_manager.cc
index 66076e904d6cb7361cc182a92573303b134ac28c..9176cc76a39f192e15a6e7b1877ac9f148a72205 100644
--- a/components/web_cache/browser/web_cache_manager.cc
+++ b/components/web_cache/browser/web_cache_manager.cc
@@ -19,10 +19,10 @@
#include "base/time/time.h"
#include "components/prefs/pref_registry_simple.h"
#include "components/prefs/pref_service.h"
-#include "components/web_cache/common/web_cache_messages.h"
#include "content/public/browser/notification_service.h"
#include "content/public/browser/notification_types.h"
#include "content/public/browser/render_process_host.h"
+#include "content/public/common/service_registry.h"
using base::Time;
using base::TimeDelta;
@@ -90,6 +90,14 @@ void WebCacheManager::Add(int renderer_id) {
memset(stats, 0, sizeof(*stats));
stats->access = Time::Now();
+ WebCacheServicePtr service;
+ content::RenderProcessHost* host =
+ content::RenderProcessHost::FromID(renderer_id);
+ DCHECK(host);
+ host->GetServiceRegistry()->ConnectToRemoteService(mojo::GetProxy(&service));
+
+ web_cache_services_[renderer_id] = std::move(service);
+
// Revise our allocation strategy to account for this new renderer.
ReviseAllocationStrategyLater();
}
@@ -100,6 +108,8 @@ void WebCacheManager::Remove(int renderer_id) {
inactive_renderers_.erase(renderer_id);
stats_.erase(renderer_id);
+ web_cache_services_.erase(renderer_id);
+
// Reallocate the resources used by this renderer
ReviseAllocationStrategyLater();
}
@@ -329,9 +339,11 @@ void WebCacheManager::EnactStrategy(const AllocationStrategy& strategy) {
max_dead_capacity);
}
- host->Send(new WebCacheMsg_SetCacheCapacities(min_dead_capacity,
- max_dead_capacity,
- capacity));
+ const WebCacheServicePtr& service =
+ web_cache_services_[allocation->first];
+ DCHECK(service.get());
Anand Mistry (off Chromium) 2016/02/18 12:33:57 I think you should be able to do: DCHECK(service);
leonhsl(Using Gerrit) 2016/02/19 08:37:41 Done.
+ service->SetCacheCapacities(min_dead_capacity, max_dead_capacity,
+ capacity);
}
++allocation;
}
@@ -350,8 +362,11 @@ void WebCacheManager::ClearRendererCache(
for (; iter != renderers.end(); ++iter) {
content::RenderProcessHost* host =
content::RenderProcessHost::FromID(*iter);
- if (host)
- host->Send(new WebCacheMsg_ClearCache(occasion == ON_NAVIGATION));
+ if (host) {
+ const WebCacheServicePtr& service = web_cache_services_[*iter];
+ DCHECK(service.get());
+ service->ClearCache(occasion == ON_NAVIGATION);
+ }
}
}

Powered by Google App Engine
This is Rietveld 408576698