Roll src/third_party/WebKit 9f7fb92:f103b33 (svn 202621:202622)
[chromium-blink-merge.git] / components / web_cache / renderer / web_cache_render_process_observer.h
blob06ffc53319c53f59ca3f38cfe8c88a1f651a0b94
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
3 // found in the LICENSE file.
5 #ifndef COMPONENTS_WEB_CACHE_RENDERER_WEB_CACHE_RENDER_PROCESS_OBSERVER_H_
6 #define COMPONENTS_WEB_CACHE_RENDERER_WEB_CACHE_RENDER_PROCESS_OBSERVER_H_
8 #include "base/compiler_specific.h"
9 #include "base/macros.h"
10 #include "content/public/renderer/render_process_observer.h"
12 namespace web_cache {
14 // This class filters the incoming cache related control messages.
15 class WebCacheRenderProcessObserver : public content::RenderProcessObserver {
16 public:
17 WebCacheRenderProcessObserver();
18 ~WebCacheRenderProcessObserver() override;
20 // Needs to be called by RenderViews in case of navigations to execute
21 // any 'clear cache' commands that were delayed until the next navigation.
22 void ExecutePendingClearCache();
24 private:
25 // RenderProcessObserver implementation.
26 bool OnControlMessageReceived(const IPC::Message& message) override;
27 void WebKitInitialized() override;
28 void OnRenderProcessShutdown() override;
30 // Message handlers.
31 void OnSetCacheCapacities(size_t min_dead_capacity,
32 size_t max_dead_capacity,
33 size_t capacity);
34 // If |on_navigation| is true, the clearing is delayed until the next
35 // navigation event.
36 void OnClearCache(bool on_navigation);
38 // If true, the web cache shall be cleared before the next navigation event.
39 bool clear_cache_pending_;
40 bool webkit_initialized_;
41 size_t pending_cache_min_dead_capacity_;
42 size_t pending_cache_max_dead_capacity_;
43 size_t pending_cache_capacity_;
45 DISALLOW_COPY_AND_ASSIGN(WebCacheRenderProcessObserver);
48 } // namespace web_cache
50 #endif // COMPONENTS_WEB_CACHE_RENDERER_WEB_CACHE_RENDER_PROCESS_OBSERVER_H_