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

Side by Side Diff: Source/core/fetch/MemoryCache.h

Issue 424633002: Oilpan: Prepare to move Resource to Oilpan heap. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 4 months 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | Source/core/fetch/MemoryCache.cpp » ('j') | Source/core/fetch/Resource.cpp » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 Copyright (C) 1998 Lars Knoll (knoll@mpi-hd.mpg.de) 2 Copyright (C) 1998 Lars Knoll (knoll@mpi-hd.mpg.de)
3 Copyright (C) 2001 Dirk Mueller <mueller@kde.org> 3 Copyright (C) 2001 Dirk Mueller <mueller@kde.org>
4 Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. 4 Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
5 5
6 This library is free software; you can redistribute it and/or 6 This library is free software; you can redistribute it and/or
7 modify it under the terms of the GNU Library General Public 7 modify it under the terms of the GNU Library General Public
8 License as published by the Free Software Foundation; either 8 License as published by the Free Software Foundation; either
9 version 2 of the License, or (at your option) any later version. 9 version 2 of the License, or (at your option) any later version.
10 10
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 void evictResources(); 188 void evictResources();
189 189
190 void prune(Resource* justReleasedResource = 0); 190 void prune(Resource* justReleasedResource = 0);
191 191
192 // Called to adjust a resource's size, lru list position, and access count. 192 // Called to adjust a resource's size, lru list position, and access count.
193 void update(Resource*, size_t oldSize, size_t newSize, bool wasAccessed = fa lse); 193 void update(Resource*, size_t oldSize, size_t newSize, bool wasAccessed = fa lse);
194 void updateForAccess(Resource* resource) { update(resource, resource->size() , resource->size(), true); } 194 void updateForAccess(Resource* resource) { update(resource, resource->size() , resource->size(), true); }
195 void updateDecodedResource(Resource*, UpdateReason, MemoryCacheLiveResourceP riority = MemoryCacheLiveResourcePriorityUnknown); 195 void updateDecodedResource(Resource*, UpdateReason, MemoryCacheLiveResourceP riority = MemoryCacheLiveResourcePriorityUnknown);
196 196
197 void makeLive(Resource*); 197 void makeLive(Resource*);
198 void makeDead(Resource*); 198 void makeDead(Resource*);
haraken 2014/07/28 07:43:52 Just help me understand: Do we need to distinguish
tkent 2014/07/28 08:14:19 'Live' / 'Dead' in these functions mean 'has one o
199 199
200 // This should be called when a Resource object is created.
201 void registerLiveResource(Resource&);
202 // This should be called when a Resource object becomes unnecesarry.
203 void unregisterLiveResource(Resource&);
204
200 static void removeURLFromCache(ExecutionContext*, const KURL&); 205 static void removeURLFromCache(ExecutionContext*, const KURL&);
201 206
202 Statistics getStatistics(); 207 Statistics getStatistics();
203 208
204 size_t minDeadCapacity() const { return m_minDeadCapacity; } 209 size_t minDeadCapacity() const { return m_minDeadCapacity; }
205 size_t maxDeadCapacity() const { return m_maxDeadCapacity; } 210 size_t maxDeadCapacity() const { return m_maxDeadCapacity; }
206 size_t capacity() const { return m_capacity; } 211 size_t capacity() const { return m_capacity; }
207 size_t liveSize() const { return m_liveSize; } 212 size_t liveSize() const { return m_liveSize; }
208 size_t deadSize() const { return m_deadSize; } 213 size_t deadSize() const { return m_deadSize; }
209 214
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
267 272
268 // Lists just for live resources with decoded data. Access to this list is b ased off of painting the resource. 273 // Lists just for live resources with decoded data. Access to this list is b ased off of painting the resource.
269 // The lists are ordered by decode priority, with higher indices having high er priorities. 274 // The lists are ordered by decode priority, with higher indices having high er priorities.
270 MemoryCacheLRUList m_liveDecodedResources[MemoryCacheLiveResourcePriorityHig h + 1]; 275 MemoryCacheLRUList m_liveDecodedResources[MemoryCacheLiveResourcePriorityHig h + 1];
271 276
272 // A URL-based map of all resources that are in the cache (including the fre shest version of objects that are currently being 277 // A URL-based map of all resources that are in the cache (including the fre shest version of objects that are currently being
273 // referenced by a Web page). 278 // referenced by a Web page).
274 typedef WillBeHeapHashMap<String, OwnPtrWillBeMember<MemoryCacheEntry> > Res ourceMap; 279 typedef WillBeHeapHashMap<String, OwnPtrWillBeMember<MemoryCacheEntry> > Res ourceMap;
275 ResourceMap m_resources; 280 ResourceMap m_resources;
276 281
282 #if ENABLE(OILPAN)
283 // Unlike m_allResources, m_liveResources is a set of Resource objects which
284 // should not be deleted. m_allResources only contains on-cache Resource
285 // objects.
286 // FIXME: Can we remove manual lifetime management of Resource and this?
287 HeapHashSet<Member<Resource> > m_liveResources;
288 #endif
289
277 friend class MemoryCacheTest; 290 friend class MemoryCacheTest;
278 #ifdef MEMORY_CACHE_STATS 291 #ifdef MEMORY_CACHE_STATS
279 Timer<MemoryCache> m_statsTimer; 292 Timer<MemoryCache> m_statsTimer;
280 #endif 293 #endif
281 }; 294 };
282 295
283 // Returns the global cache. 296 // Returns the global cache.
284 MemoryCache* memoryCache(); 297 MemoryCache* memoryCache();
285 298
286 // Sets the global cache, used to swap in a test instance. Returns the old 299 // Sets the global cache, used to swap in a test instance. Returns the old
287 // MemoryCache object. 300 // MemoryCache object.
288 PassOwnPtrWillBeRawPtr<MemoryCache> replaceMemoryCacheForTesting(PassOwnPtrWillB eRawPtr<MemoryCache>); 301 PassOwnPtrWillBeRawPtr<MemoryCache> replaceMemoryCacheForTesting(PassOwnPtrWillB eRawPtr<MemoryCache>);
289 302
290 } 303 }
291 304
292 #endif 305 #endif
OLDNEW
« no previous file with comments | « no previous file | Source/core/fetch/MemoryCache.cpp » ('j') | Source/core/fetch/Resource.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698