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

Unified Diff: components/web_cache/renderer/web_cache_render_process_observer.h

Issue 1706603004: Replace web_cache_messages.h with Mojo service. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed Anand'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/renderer/web_cache_render_process_observer.h
diff --git a/components/web_cache/renderer/web_cache_render_process_observer.h b/components/web_cache/renderer/web_cache_render_process_observer.h
index 714ef231f2bb0134f0d83b3e06e24b1a7fbca4b9..d6a6bf7b956a440b07be9b0fe07e8595f137cc87 100644
--- a/components/web_cache/renderer/web_cache_render_process_observer.h
+++ b/components/web_cache/renderer/web_cache_render_process_observer.h
@@ -10,33 +10,39 @@
#include "base/compiler_specific.h"
#include "base/macros.h"
+#include "components/web_cache/public/interfaces/web_cache_service.mojom.h"
#include "content/public/renderer/render_process_observer.h"
+#include "mojo/public/cpp/bindings/weak_binding_set.h"
namespace web_cache {
-// This class filters the incoming cache related control messages.
-class WebCacheRenderProcessObserver : public content::RenderProcessObserver {
+using mojom::WebCacheService;
+
+// This class implements the Mojo interface WebCacheService.
+class WebCacheRenderProcessObserver : public WebCacheService,
+ public content::RenderProcessObserver {
public:
WebCacheRenderProcessObserver();
~WebCacheRenderProcessObserver() override;
+ void BindRequest(mojo::InterfaceRequest<WebCacheService> web_cache_request);
+
// Needs to be called by RenderViews in case of navigations to execute
// any 'clear cache' commands that were delayed until the next navigation.
void ExecutePendingClearCache();
private:
// RenderProcessObserver implementation.
- bool OnControlMessageReceived(const IPC::Message& message) override;
void WebKitInitialized() override;
void OnRenderProcessShutdown() override;
- // Message handlers.
- void OnSetCacheCapacities(uint64_t min_dead_capacity,
- uint64_t max_dead_capacity,
- uint64_t capacity);
+ // WebCacheService methods:
+ void SetCacheCapacities(uint64_t min_dead_capacity,
+ uint64_t max_dead_capacity,
+ uint64_t capacity) override;
// If |on_navigation| is true, the clearing is delayed until the next
// navigation event.
- void OnClearCache(bool on_navigation);
+ void ClearCache(bool on_navigation) override;
// If true, the web cache shall be cleared before the next navigation event.
bool clear_cache_pending_;
@@ -45,6 +51,8 @@ class WebCacheRenderProcessObserver : public content::RenderProcessObserver {
size_t pending_cache_max_dead_capacity_;
size_t pending_cache_capacity_;
+ mojo::WeakBindingSet<WebCacheService> bindings_;
+
DISALLOW_COPY_AND_ASSIGN(WebCacheRenderProcessObserver);
};

Powered by Google App Engine
This is Rietveld 408576698