| 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 #include <stdint.h> |
| 10 | 10 |
| 11 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
| 12 #include "base/macros.h" | 12 #include "base/macros.h" |
| 13 #include "components/web_cache/public/interfaces/web_cache.mojom.h" | 13 #include "components/web_cache/public/interfaces/web_cache.mojom.h" |
| 14 #include "content/public/renderer/render_process_observer.h" | |
| 15 #include "mojo/public/cpp/bindings/binding_set.h" | 14 #include "mojo/public/cpp/bindings/binding_set.h" |
| 16 | 15 |
| 17 namespace web_cache { | 16 namespace web_cache { |
| 18 | 17 |
| 19 // This class implements the Mojo interface mojom::WebCache. | 18 // This class implements the Mojo interface mojom::WebCache. |
| 20 class WebCacheRenderProcessObserver : public mojom::WebCache, | 19 class WebCacheRenderProcessObserver : public mojom::WebCache { |
| 21 public content::RenderProcessObserver { | |
| 22 public: | 20 public: |
| 23 WebCacheRenderProcessObserver(); | 21 WebCacheRenderProcessObserver(); |
| 24 ~WebCacheRenderProcessObserver() override; | 22 ~WebCacheRenderProcessObserver() override; |
| 25 | 23 |
| 26 void BindRequest(mojo::InterfaceRequest<mojom::WebCache> web_cache_request); | 24 void BindRequest(mojo::InterfaceRequest<mojom::WebCache> web_cache_request); |
| 27 | 25 |
| 28 // Needs to be called by RenderViews in case of navigations to execute | 26 // Needs to be called by RenderViews in case of navigations to execute |
| 29 // any 'clear cache' commands that were delayed until the next navigation. | 27 // any 'clear cache' commands that were delayed until the next navigation. |
| 30 void ExecutePendingClearCache(); | 28 void ExecutePendingClearCache(); |
| 31 | 29 |
| 32 private: | 30 private: |
| 33 // RenderProcessObserver implementation. | |
| 34 void WebKitInitialized() override; | |
| 35 void OnRenderProcessShutdown() override; | |
| 36 | |
| 37 // mojom::WebCache methods: | 31 // mojom::WebCache methods: |
| 38 void SetCacheCapacities(uint64_t min_dead_capacity, | 32 void SetCacheCapacities(uint64_t min_dead_capacity, |
| 39 uint64_t max_dead_capacity, | 33 uint64_t max_dead_capacity, |
| 40 uint64_t capacity) override; | 34 uint64_t capacity) override; |
| 41 // If |on_navigation| is true, the clearing is delayed until the next | 35 // If |on_navigation| is true, the clearing is delayed until the next |
| 42 // navigation event. | 36 // navigation event. |
| 43 void ClearCache(bool on_navigation) override; | 37 void ClearCache(bool on_navigation) override; |
| 44 | 38 |
| 45 // If true, the web cache shall be cleared before the next navigation event. | 39 // If true, the web cache shall be cleared before the next navigation event. |
| 46 bool clear_cache_pending_; | 40 bool clear_cache_pending_; |
| 47 bool webkit_initialized_; | |
| 48 size_t pending_cache_min_dead_capacity_; | |
| 49 size_t pending_cache_max_dead_capacity_; | |
| 50 size_t pending_cache_capacity_; | |
| 51 | 41 |
| 52 mojo::BindingSet<mojom::WebCache> bindings_; | 42 mojo::BindingSet<mojom::WebCache> bindings_; |
| 53 | 43 |
| 54 DISALLOW_COPY_AND_ASSIGN(WebCacheRenderProcessObserver); | 44 DISALLOW_COPY_AND_ASSIGN(WebCacheRenderProcessObserver); |
| 55 }; | 45 }; |
| 56 | 46 |
| 57 } // namespace web_cache | 47 } // namespace web_cache |
| 58 | 48 |
| 59 #endif // COMPONENTS_WEB_CACHE_RENDERER_WEB_CACHE_RENDER_PROCESS_OBSERVER_H_ | 49 #endif // COMPONENTS_WEB_CACHE_RENDERER_WEB_CACHE_RENDER_PROCESS_OBSERVER_H_ |
| 60 | 50 |
| OLD | NEW |