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"
14 // This class filters the incoming cache related control messages.
15 class WebCacheRenderProcessObserver
: public content::RenderProcessObserver
{
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();
25 // RenderProcessObserver implementation.
26 bool OnControlMessageReceived(const IPC::Message
& message
) override
;
27 void WebKitInitialized() override
;
28 void OnRenderProcessShutdown() override
;
31 void OnSetCacheCapacities(size_t min_dead_capacity
,
32 size_t max_dead_capacity
,
34 // If |on_navigation| is true, the clearing is delayed until the next
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_