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

Unified Diff: Source/core/inspector/InspectorCSSAgent.cpp

Issue 68243006: Use HashCountedSet for fontStats in InspectorCSSAgent (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 7 years, 1 month 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 | « Source/core/inspector/InspectorCSSAgent.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/inspector/InspectorCSSAgent.cpp
diff --git a/Source/core/inspector/InspectorCSSAgent.cpp b/Source/core/inspector/InspectorCSSAgent.cpp
index 00440896a6e5b908c613472f133966c528213306..1a7003fc631998f137ec4692269e6670e5711a1c 100644
--- a/Source/core/inspector/InspectorCSSAgent.cpp
+++ b/Source/core/inspector/InspectorCSSAgent.cpp
@@ -1025,7 +1025,7 @@ void InspectorCSSAgent::getComputedStyleForNode(ErrorString* errorString, int no
style = inspectorStyle->buildArrayForComputedStyle();
}
-void InspectorCSSAgent::collectPlatformFontsForRenderer(RenderText* renderer, HashMap<String, int>* fontStats)
+void InspectorCSSAgent::collectPlatformFontsForRenderer(RenderText* renderer, HashCountedSet<String>* fontStats)
{
for (InlineTextBox* box = renderer->firstTextBox(); box; box = box->nextTextBox()) {
RenderStyle* style = renderer->style(box->isFirstLineStyle());
@@ -1038,8 +1038,7 @@ void InspectorCSSAgent::collectPlatformFontsForRenderer(RenderText* renderer, Ha
String familyName = glyphBuffer.fontDataAt(i)->platformData().fontFamilyName();
if (familyName.isNull())
familyName = "";
- int value = fontStats->contains(familyName) ? fontStats->get(familyName) : 0;
- fontStats->set(familyName, value + 1);
+ fontStats->add(familyName);
}
}
}
@@ -1065,7 +1064,7 @@ void InspectorCSSAgent::getPlatformFontsForNode(ErrorString* errorString, int no
}
}
- HashMap<String, int> fontStats;
+ HashCountedSet<String> fontStats;
for (size_t i = 0; i < textNodes.size(); ++i) {
RenderText* renderer = toRenderText(textNodes[i]->renderer());
collectPlatformFontsForRenderer(renderer, &fontStats);
@@ -1082,7 +1081,7 @@ void InspectorCSSAgent::getPlatformFontsForNode(ErrorString* errorString, int no
}
platformFonts = TypeBuilder::Array<TypeBuilder::CSS::PlatformFontUsage>::create();
- for (HashMap<String, int>::iterator it = fontStats.begin(), end = fontStats.end(); it != end; ++it) {
+ for (HashCountedSet<String>::iterator it = fontStats.begin(), end = fontStats.end(); it != end; ++it) {
RefPtr<TypeBuilder::CSS::PlatformFontUsage> platformFont = TypeBuilder::CSS::PlatformFontUsage::create()
.setFamilyName(it->key)
Inactive 2013/11/11 22:50:07 The values are read in this loop.
.setGlyphCount(it->value);
« no previous file with comments | « Source/core/inspector/InspectorCSSAgent.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698