| OLD | NEW |
| 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 "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
| 9 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "content/public/renderer/render_process_observer.h" | 10 #include "content/public/renderer/render_process_observer.h" |
| 11 | 11 |
| 12 namespace web_cache { | 12 namespace web_cache { |
| 13 | 13 |
| 14 // This class filters the incoming cache related control messages. | 14 // This class filters the incoming cache related control messages. |
| 15 class WebCacheRenderProcessObserver : public content::RenderProcessObserver { | 15 class WebCacheRenderProcessObserver : public content::RenderProcessObserver { |
| 16 public: | 16 public: |
| 17 WebCacheRenderProcessObserver(); | 17 WebCacheRenderProcessObserver(); |
| 18 virtual ~WebCacheRenderProcessObserver(); | 18 virtual ~WebCacheRenderProcessObserver(); |
| 19 | 19 |
| 20 // Needs to be called by RenderViews in case of navigations to execute | 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. | 21 // any 'clear cache' commands that were delayed until the next navigation. |
| 22 void ExecutePendingClearCache(); | 22 void ExecutePendingClearCache(); |
| 23 | 23 |
| 24 private: | 24 private: |
| 25 // RenderProcessObserver implementation. | 25 // RenderProcessObserver implementation. |
| 26 virtual bool OnControlMessageReceived(const IPC::Message& message) OVERRIDE; | 26 virtual bool OnControlMessageReceived(const IPC::Message& message) override; |
| 27 virtual void WebKitInitialized() OVERRIDE; | 27 virtual void WebKitInitialized() override; |
| 28 virtual void OnRenderProcessShutdown() OVERRIDE; | 28 virtual void OnRenderProcessShutdown() override; |
| 29 | 29 |
| 30 // Message handlers. | 30 // Message handlers. |
| 31 void OnSetCacheCapacities(size_t min_dead_capacity, | 31 void OnSetCacheCapacities(size_t min_dead_capacity, |
| 32 size_t max_dead_capacity, | 32 size_t max_dead_capacity, |
| 33 size_t capacity); | 33 size_t capacity); |
| 34 // If |on_navigation| is true, the clearing is delayed until the next | 34 // If |on_navigation| is true, the clearing is delayed until the next |
| 35 // navigation event. | 35 // navigation event. |
| 36 void OnClearCache(bool on_navigation); | 36 void OnClearCache(bool on_navigation); |
| 37 | 37 |
| 38 // If true, the web cache shall be cleared before the next navigation event. | 38 // If true, the web cache shall be cleared before the next navigation event. |
| 39 bool clear_cache_pending_; | 39 bool clear_cache_pending_; |
| 40 bool webkit_initialized_; | 40 bool webkit_initialized_; |
| 41 size_t pending_cache_min_dead_capacity_; | 41 size_t pending_cache_min_dead_capacity_; |
| 42 size_t pending_cache_max_dead_capacity_; | 42 size_t pending_cache_max_dead_capacity_; |
| 43 size_t pending_cache_capacity_; | 43 size_t pending_cache_capacity_; |
| 44 | 44 |
| 45 DISALLOW_COPY_AND_ASSIGN(WebCacheRenderProcessObserver); | 45 DISALLOW_COPY_AND_ASSIGN(WebCacheRenderProcessObserver); |
| 46 }; | 46 }; |
| 47 | 47 |
| 48 } // namespace web_cache | 48 } // namespace web_cache |
| 49 | 49 |
| 50 #endif // COMPONENTS_WEB_CACHE_RENDERER_WEB_CACHE_RENDER_PROCESS_OBSERVER_H_ | 50 #endif // COMPONENTS_WEB_CACHE_RENDERER_WEB_CACHE_RENDER_PROCESS_OBSERVER_H_ |
| 51 | 51 |
| OLD | NEW |