OLD | NEW |
(Empty) | |
| 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. |
| 4 |
| 5 #ifndef COMPONENTS_WEB_CACHE_RENDERER_WEB_CACHE_RENDER_PROCESS_OBSERVER_H_ |
| 6 #define COMPONENTS_WEB_CACHE_RENDERER_WEB_CACHE_RENDER_PROCESS_OBSERVER_H_ |
| 7 |
| 8 #include "base/compiler_specific.h" |
| 9 #include "base/macros.h" |
| 10 #include "content/public/renderer/render_process_observer.h" |
| 11 |
| 12 namespace web_cache { |
| 13 |
| 14 // This class filters the incoming cache related control messages. |
| 15 class WebCacheRenderProcessObserver : public content::RenderProcessObserver { |
| 16 public: |
| 17 WebCacheRenderProcessObserver(); |
| 18 virtual ~WebCacheRenderProcessObserver(); |
| 19 |
| 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(); |
| 23 |
| 24 private: |
| 25 // RenderProcessObserver implementation. |
| 26 virtual bool OnControlMessageReceived(const IPC::Message& message) OVERRIDE; |
| 27 virtual void WebKitInitialized() OVERRIDE; |
| 28 virtual void OnRenderProcessShutdown() OVERRIDE; |
| 29 |
| 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); |
| 37 |
| 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_; |
| 44 |
| 45 DISALLOW_COPY_AND_ASSIGN(WebCacheRenderProcessObserver); |
| 46 }; |
| 47 |
| 48 } // namespace web_cache |
| 49 |
| 50 #endif // COMPONENTS_WEB_CACHE_RENDERER_WEB_CACHE_RENDER_PROCESS_OBSERVER_H_ |
| 51 |
OLD | NEW |