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

Side by Side Diff: third_party/WebKit/Source/core/fetch/MemoryCache.cpp

Issue 2319483002: Turn off isLinkPreload() when used (Closed)
Patch Set: Turn off LinkPreload when resource is used + tests Created 4 years, 3 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
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) 2002 Waldo Bastian (bastian@kde.org) 4 Copyright (C) 2002 Waldo Bastian (bastian@kde.org)
5 Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. 5 Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
6 6
7 This library is free software; you can redistribute it and/or 7 This library is free software; you can redistribute it and/or
8 modify it under the terms of the GNU Library General Public 8 modify it under the terms of the GNU Library General Public
9 License as published by the Free Software Foundation; either 9 License as published by the Free Software Foundation; either
10 version 2 of the License, or (at your option) any later version. 10 version 2 of the License, or (at your option) any later version.
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after
297 MemoryCacheEntry* previous = current->m_previousInAllResourcesList; 297 MemoryCacheEntry* previous = current->m_previousInAllResourcesList;
298 298
299 // Decoded data may reference other resources. Skip |current| if 299 // Decoded data may reference other resources. Skip |current| if
300 // |current| somehow got kicked out of cache during 300 // |current| somehow got kicked out of cache during
301 // destroyDecodedData(). 301 // destroyDecodedData().
302 if (!resource || !contains(resource)) { 302 if (!resource || !contains(resource)) {
303 current = previous; 303 current = previous;
304 continue; 304 continue;
305 } 305 }
306 306
307 // TODO(yoav): Why do isPreloaded() resources get special treatment here?
307 if (!resource->isAlive() && !resource->isPreloaded() && resource->is Loaded()) { 308 if (!resource->isAlive() && !resource->isPreloaded() && resource->is Loaded()) {
308 // Destroy our decoded data. This will remove us from 309 // Destroy our decoded data. This will remove us from
309 // m_liveDecodedResources, and possibly move us to a different 310 // m_liveDecodedResources, and possibly move us to a different
310 // LRU list in m_allResources. 311 // LRU list in m_allResources.
311 resource->prune(); 312 resource->prune();
312 313
313 if (targetSize && m_deadSize <= targetSize) 314 if (targetSize && m_deadSize <= targetSize)
314 return; 315 return;
315 } 316 }
316 current = previous; 317 current = previous;
(...skipping 416 matching lines...) Expand 10 before | Expand all | Expand 10 after
733 bool MemoryCache::isInSameLRUListForTest(const Resource* x, const Resource* y) 734 bool MemoryCache::isInSameLRUListForTest(const Resource* x, const Resource* y)
734 { 735 {
735 MemoryCacheEntry* ex = getEntryForResource(x); 736 MemoryCacheEntry* ex = getEntryForResource(x);
736 MemoryCacheEntry* ey = getEntryForResource(y); 737 MemoryCacheEntry* ey = getEntryForResource(y);
737 ASSERT(ex); 738 ASSERT(ex);
738 ASSERT(ey); 739 ASSERT(ey);
739 return lruListFor(ex->m_accessCount, x->size()) == lruListFor(ey->m_accessCo unt, y->size()); 740 return lruListFor(ex->m_accessCount, x->size()) == lruListFor(ey->m_accessCo unt, y->size());
740 } 741 }
741 742
742 } // namespace blink 743 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698