Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(436)

Side by Side Diff: components/web_cache/renderer/web_cache_impl.cc

Issue 2435603002: [WeakMemoryCache] Remove dead/live distinction of Resource outside core/fetch (Closed)
Patch Set: Rebase Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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_impl.h" 5 #include "components/web_cache/renderer/web_cache_impl.h"
6 6
7 #include <limits> 7 #include <limits>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/numerics/safe_conversions.h" 10 #include "base/numerics/safe_conversions.h"
(...skipping 24 matching lines...) Expand all
35 break; 35 break;
36 case kNavigate_Pending: 36 case kNavigate_Pending:
37 break; 37 break;
38 case kClearCache_Pending: 38 case kClearCache_Pending:
39 blink::WebCache::clear(); 39 blink::WebCache::clear();
40 clear_cache_state_ = kInit; 40 clear_cache_state_ = kInit;
41 break; 41 break;
42 } 42 }
43 } 43 }
44 44
45 void WebCacheImpl::SetCacheCapacities(uint64_t min_dead_capacity, 45 void WebCacheImpl::SetCacheCapacity(uint64_t capacity64) {
46 uint64_t max_dead_capacity,
47 uint64_t capacity64) {
48 size_t min_dead_capacity2 = base::checked_cast<size_t>(min_dead_capacity);
49 size_t max_dead_capacity2 = base::checked_cast<size_t>(max_dead_capacity);
50 size_t capacity = base::checked_cast<size_t>(capacity64); 46 size_t capacity = base::checked_cast<size_t>(capacity64);
51 47
52 blink::WebCache::setCapacities(min_dead_capacity2, max_dead_capacity2, 48 blink::WebCache::setCapacity(capacity);
53 capacity);
54 } 49 }
55 50
56 void WebCacheImpl::ClearCache(bool on_navigation) { 51 void WebCacheImpl::ClearCache(bool on_navigation) {
57 if (!on_navigation) { 52 if (!on_navigation) {
58 blink::WebCache::clear(); 53 blink::WebCache::clear();
59 return; 54 return;
60 } 55 }
61 56
62 switch (clear_cache_state_) { 57 switch (clear_cache_state_) {
63 case kInit: 58 case kInit:
64 clear_cache_state_ = kClearCache_Pending; 59 clear_cache_state_ = kClearCache_Pending;
65 break; 60 break;
66 case kNavigate_Pending: 61 case kNavigate_Pending:
67 blink::WebCache::clear(); 62 blink::WebCache::clear();
68 clear_cache_state_ = kInit; 63 clear_cache_state_ = kInit;
69 break; 64 break;
70 case kClearCache_Pending: 65 case kClearCache_Pending:
71 break; 66 break;
72 } 67 }
73 } 68 }
74 69
75 } // namespace web_cache 70 } // namespace web_cache
OLDNEW
« no previous file with comments | « components/web_cache/renderer/web_cache_impl.h ('k') | third_party/WebKit/Source/web/WebCache.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698