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

Unified Diff: webkit/port/platform/graphics/chromium/FontUtilsChromiumWin.cpp

Issue 14410: Fix purify complaint about FontData structs being leaked. These are held in ... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 12 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webkit/port/platform/graphics/chromium/FontUtilsChromiumWin.cpp
===================================================================
--- webkit/port/platform/graphics/chromium/FontUtilsChromiumWin.cpp (revision 6957)
+++ webkit/port/platform/graphics/chromium/FontUtilsChromiumWin.cpp (working copy)
@@ -120,7 +120,7 @@
// well-within 1-sigma of each other so that the difference is not significant.
// On the other hand, some pages in intl2 seem to take longer to load with map
// in the 1st pass. Need to experiment further.
-typedef HashMap<String, FontData*> FontDataCache;
+typedef HashMap<String, FontData> FontDataCache;
} // namespace
@@ -277,15 +277,15 @@
// a font even if there's no font matching the name. Need to
// check it against what we actually want (as is done in
// FontCacheWin.cpp)
- derived = new FontData;
+ pair<FontDataCache::iterator, bool> entry = fontDataCache.add(fontKey, FontData());
+ derived = &entry.first->second;
derived->hfont = CreateFontIndirect(logfont);
// GetAscent may return kUndefinedAscent, but we still want to
// cache it so that we won't have to call CreateFontIndirect once
// more for HFONT next time.
derived->ascent = GetAscent(derived->hfont);
- fontDataCache.add(fontKey, derived);
} else {
- derived = iter->second;
+ derived = &iter->second;
// Last time, GetAscent failed so that only HFONT was
// cached. Try once more assuming that TryPreloadFont
// was called by a caller between calls.
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698