| 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 #include "components/web_cache/renderer/web_cache_render_process_observer.h" | 5 #include "components/web_cache/renderer/web_cache_render_process_observer.h" |
| 6 | 6 |
| 7 #include <limits> | 7 #include <limits> |
| 8 | 8 |
| 9 #include "components/web_cache/common/web_cache_messages.h" | 9 #include "components/web_cache/common/web_cache_messages.h" |
| 10 #include "third_party/WebKit/public/web/WebCache.h" | 10 #include "third_party/WebKit/public/web/WebCache.h" |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 pending_cache_max_dead_capacity_, | 53 pending_cache_max_dead_capacity_, |
| 54 pending_cache_capacity_); | 54 pending_cache_capacity_); |
| 55 } | 55 } |
| 56 } | 56 } |
| 57 | 57 |
| 58 void WebCacheRenderProcessObserver::OnRenderProcessShutdown() { | 58 void WebCacheRenderProcessObserver::OnRenderProcessShutdown() { |
| 59 webkit_initialized_ = false; | 59 webkit_initialized_ = false; |
| 60 } | 60 } |
| 61 | 61 |
| 62 void WebCacheRenderProcessObserver::OnSetCacheCapacities( | 62 void WebCacheRenderProcessObserver::OnSetCacheCapacities( |
| 63 size_t min_dead_capacity, | 63 uint32_t min_dead_capacity, |
| 64 size_t max_dead_capacity, | 64 uint32_t max_dead_capacity, |
| 65 size_t capacity) { | 65 uint32_t capacity) { |
| 66 if (!webkit_initialized_) { | 66 if (!webkit_initialized_) { |
| 67 pending_cache_min_dead_capacity_ = min_dead_capacity; | 67 pending_cache_min_dead_capacity_ = min_dead_capacity; |
| 68 pending_cache_max_dead_capacity_ = max_dead_capacity; | 68 pending_cache_max_dead_capacity_ = max_dead_capacity; |
| 69 pending_cache_capacity_ = capacity; | 69 pending_cache_capacity_ = capacity; |
| 70 return; | 70 return; |
| 71 } | 71 } |
| 72 | 72 |
| 73 WebCache::setCapacities( | 73 WebCache::setCapacities( |
| 74 min_dead_capacity, max_dead_capacity, capacity); | 74 min_dead_capacity, max_dead_capacity, capacity); |
| 75 } | 75 } |
| 76 | 76 |
| 77 void WebCacheRenderProcessObserver::OnClearCache(bool on_navigation) { | 77 void WebCacheRenderProcessObserver::OnClearCache(bool on_navigation) { |
| 78 if (on_navigation || !webkit_initialized_) | 78 if (on_navigation || !webkit_initialized_) |
| 79 clear_cache_pending_ = true; | 79 clear_cache_pending_ = true; |
| 80 else | 80 else |
| 81 WebCache::clear(); | 81 WebCache::clear(); |
| 82 } | 82 } |
| 83 | 83 |
| 84 } // namespace web_cache | 84 } // namespace web_cache |
| OLD | NEW |