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

Side by Side 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: 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef COMPONENTS_WEB_CACHE_RENDERER_WEB_CACHE_RENDER_PROCESS_OBSERVER_H_ 5 #ifndef COMPONENTS_WEB_CACHE_RENDERER_WEB_CACHE_RENDER_PROCESS_OBSERVER_H_
6 #define COMPONENTS_WEB_CACHE_RENDERER_WEB_CACHE_RENDER_PROCESS_OBSERVER_H_ 6 #define COMPONENTS_WEB_CACHE_RENDERER_WEB_CACHE_RENDER_PROCESS_OBSERVER_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 10
11 #include "base/compiler_specific.h" 11 #include "base/compiler_specific.h"
12 #include "base/macros.h" 12 #include "base/macros.h"
13 #include "components/web_cache/common/web_cache_service.mojom.h"
13 #include "content/public/renderer/render_process_observer.h" 14 #include "content/public/renderer/render_process_observer.h"
15 #include "mojo/public/cpp/bindings/weak_binding_set.h"
14 16
15 namespace web_cache { 17 namespace web_cache {
16 18
17 // This class filters the incoming cache related control messages. 19 // This class implements the Mojo interface WebCacheService.
18 class WebCacheRenderProcessObserver : public content::RenderProcessObserver { 20 class WebCacheRenderProcessObserver : public WebCacheService,
21 public content::RenderProcessObserver {
19 public: 22 public:
20 WebCacheRenderProcessObserver(); 23 WebCacheRenderProcessObserver();
21 ~WebCacheRenderProcessObserver() override; 24 ~WebCacheRenderProcessObserver() override;
22 25
26 void BindRequest(mojo::InterfaceRequest<WebCacheService> web_cache_request);
27
23 // Needs to be called by RenderViews in case of navigations to execute 28 // Needs to be called by RenderViews in case of navigations to execute
24 // any 'clear cache' commands that were delayed until the next navigation. 29 // any 'clear cache' commands that were delayed until the next navigation.
25 void ExecutePendingClearCache(); 30 void ExecutePendingClearCache();
26 31
27 private: 32 private:
28 // RenderProcessObserver implementation. 33 // RenderProcessObserver implementation.
29 bool OnControlMessageReceived(const IPC::Message& message) override;
30 void WebKitInitialized() override; 34 void WebKitInitialized() override;
31 void OnRenderProcessShutdown() override; 35 void OnRenderProcessShutdown() override;
32 36
33 // Message handlers. 37 // WebCacheService methods:
34 void OnSetCacheCapacities(uint64_t min_dead_capacity, 38 void SetCacheCapacities(uint64_t min_dead_capacity,
35 uint64_t max_dead_capacity, 39 uint64_t max_dead_capacity,
36 uint64_t capacity); 40 uint64_t capacity) override;
37 // If |on_navigation| is true, the clearing is delayed until the next 41 // If |on_navigation| is true, the clearing is delayed until the next
38 // navigation event. 42 // navigation event.
39 void OnClearCache(bool on_navigation); 43 void ClearCache(bool on_navigation) override;
40 44
41 // If true, the web cache shall be cleared before the next navigation event. 45 // If true, the web cache shall be cleared before the next navigation event.
42 bool clear_cache_pending_; 46 bool clear_cache_pending_;
43 bool webkit_initialized_; 47 bool webkit_initialized_;
44 size_t pending_cache_min_dead_capacity_; 48 size_t pending_cache_min_dead_capacity_;
45 size_t pending_cache_max_dead_capacity_; 49 size_t pending_cache_max_dead_capacity_;
46 size_t pending_cache_capacity_; 50 size_t pending_cache_capacity_;
47 51
52 mojo::WeakBindingSet<WebCacheService> bindings_;
53
48 DISALLOW_COPY_AND_ASSIGN(WebCacheRenderProcessObserver); 54 DISALLOW_COPY_AND_ASSIGN(WebCacheRenderProcessObserver);
49 }; 55 };
50 56
51 } // namespace web_cache 57 } // namespace web_cache
52 58
53 #endif // COMPONENTS_WEB_CACHE_RENDERER_WEB_CACHE_RENDER_PROCESS_OBSERVER_H_ 59 #endif // COMPONENTS_WEB_CACHE_RENDERER_WEB_CACHE_RENDER_PROCESS_OBSERVER_H_
54 60
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698