Changeset 102085 in webkit
- Timestamp:
- Dec 5, 2011, 6:55:47 PM (15 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 3 edited
-
ChangeLog (modified) (1 diff)
-
loader/CrossOriginPreflightResultCache.cpp (modified) (4 diffs)
-
loader/CrossOriginPreflightResultCache.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r102081 r102085 1 2011-12-05 Darin Adler <darin@apple.com> 2 3 Use HashMap<OwnPtr> in CrossOriginPreflightResultCache 4 https://bugs.webkit.org/show_bug.cgi?id=73785 5 6 Reviewed by Andreas Kling. 7 8 * loader/CrossOriginPreflightResultCache.cpp: 9 (WebCore::CrossOriginPreflightResultCache::appendEntry): Changed code to use set 10 instead of add, since it wants to replace existing entries. Also removed leakPtr 11 and removed the FIXME that documented the memory leak now fixed here. 12 (WebCore::CrossOriginPreflightResultCache::canSkipPreflight): Removed unneeded 13 std:: prefix here and also unneeded explicit delete call. 14 (WebCore::CrossOriginPreflightResultCache::empty): Removed unneeded deleteAllValues 15 call here. 16 17 * loader/CrossOriginPreflightResultCache.h: Make mapped value of the 18 CrossOriginPreflightResultHashMap be OwnPtr instead of raw pointer. 19 1 20 2011-12-05 Darin Adler <darin@apple.com> 2 21 -
trunk/Source/WebCore/loader/CrossOriginPreflightResultCache.cpp
r93886 r102085 160 160 { 161 161 ASSERT(isMainThread()); 162 CrossOriginPreflightResultCacheItem* resultPtr = preflightResult.leakPtr(); 163 pair<CrossOriginPreflightResultHashMap::iterator, bool> addResult = m_preflightHashMap.add(make_pair(origin, url), resultPtr); 164 if (!addResult.second) { 165 // FIXME: We need to delete the old value before replacing with the new one. 166 addResult.first->second = resultPtr; 167 } 162 m_preflightHashMap.set(make_pair(origin, url), preflightResult); 168 163 } 169 164 … … 171 166 { 172 167 ASSERT(isMainThread()); 173 CrossOriginPreflightResultHashMap::iterator cacheIt = m_preflightHashMap.find( std::make_pair(origin, url));168 CrossOriginPreflightResultHashMap::iterator cacheIt = m_preflightHashMap.find(make_pair(origin, url)); 174 169 if (cacheIt == m_preflightHashMap.end()) 175 170 return false; … … 178 173 return true; 179 174 180 delete cacheIt->second;181 175 m_preflightHashMap.remove(cacheIt); 182 176 return false; … … 186 180 { 187 181 ASSERT(isMainThread()); 188 deleteAllValues(m_preflightHashMap);189 182 m_preflightHashMap.clear(); 190 183 } -
trunk/Source/WebCore/loader/CrossOriginPreflightResultCache.h
r93886 r102085 79 79 CrossOriginPreflightResultCache() { } 80 80 81 typedef HashMap<std::pair<String, KURL>, CrossOriginPreflightResultCacheItem*> CrossOriginPreflightResultHashMap;81 typedef HashMap<std::pair<String, KURL>, OwnPtr<CrossOriginPreflightResultCacheItem> > CrossOriginPreflightResultHashMap; 82 82 83 83 CrossOriginPreflightResultHashMap m_preflightHashMap;
Note:
See TracChangeset
for help on using the changeset viewer.