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