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

Side by Side Diff: Source/core/fetch/ResourceFetcher.cpp

Issue 179943002: MemoryCache: make sure that Resources are evicted only when they can be deleted (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebase Created 6 years, 9 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
« no previous file with comments | « Source/core/fetch/Resource.cpp ('k') | no next file » | no next file with comments »
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) 2002 Waldo Bastian (bastian@kde.org) 4 Copyright (C) 2002 Waldo Bastian (bastian@kde.org)
5 Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved. 5 Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved.
6 Copyright (C) 2009 Torch Mobile Inc. http://www.torchmobile.com/ 6 Copyright (C) 2009 Torch Mobile Inc. http://www.torchmobile.com/
7 7
8 This library is free software; you can redistribute it and/or 8 This library is free software; you can redistribute it and/or
9 modify it under the terms of the GNU Library General Public 9 modify it under the terms of the GNU Library General Public
10 License as published by the Free Software Foundation; either 10 License as published by the Free Software Foundation; either
(...skipping 1054 matching lines...) Expand 10 before | Expand all | Expand 10 after
1065 ASSERT_UNUSED(timer, timer == &m_garbageCollectDocumentResourcesTimer); 1065 ASSERT_UNUSED(timer, timer == &m_garbageCollectDocumentResourcesTimer);
1066 garbageCollectDocumentResources(); 1066 garbageCollectDocumentResources();
1067 } 1067 }
1068 1068
1069 void ResourceFetcher::garbageCollectDocumentResources() 1069 void ResourceFetcher::garbageCollectDocumentResources()
1070 { 1070 {
1071 typedef Vector<String, 10> StringVector; 1071 typedef Vector<String, 10> StringVector;
1072 StringVector resourcesToDelete; 1072 StringVector resourcesToDelete;
1073 1073
1074 for (DocumentResourceMap::iterator it = m_documentResources.begin(); it != m _documentResources.end(); ++it) { 1074 for (DocumentResourceMap::iterator it = m_documentResources.begin(); it != m _documentResources.end(); ++it) {
1075 if (it->value->hasOneHandle()) 1075 if (it->value->hasOneHandleApartFromCache())
1076 resourcesToDelete.append(it->key); 1076 resourcesToDelete.append(it->key);
1077 } 1077 }
1078 1078
1079 for (StringVector::const_iterator it = resourcesToDelete.begin(); it != reso urcesToDelete.end(); ++it) 1079 for (StringVector::const_iterator it = resourcesToDelete.begin(); it != reso urcesToDelete.end(); ++it)
1080 m_documentResources.remove(*it); 1080 m_documentResources.remove(*it);
1081 } 1081 }
1082 1082
1083 void ResourceFetcher::notifyLoadedFromMemoryCache(Resource* resource) 1083 void ResourceFetcher::notifyLoadedFromMemoryCache(Resource* resource)
1084 { 1084 {
1085 if (!frame() || !frame()->page() || resource->status() != Resource::Cached | | m_validatedURLs.contains(resource->url())) 1085 if (!frame() || !frame()->page() || resource->status() != Resource::Cached | | m_validatedURLs.contains(resource->url()))
(...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after
1395 case Revalidate: 1395 case Revalidate:
1396 ++m_revalidateCount; 1396 ++m_revalidateCount;
1397 return; 1397 return;
1398 case Use: 1398 case Use:
1399 ++m_useCount; 1399 ++m_useCount;
1400 return; 1400 return;
1401 } 1401 }
1402 } 1402 }
1403 1403
1404 } 1404 }
OLDNEW
« no previous file with comments | « Source/core/fetch/Resource.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698