Bug 171709

Summary: [INTL] Use struct instead of HashMap for resolveLocale operation
Product: WebKit Reporter: Andy VanWagoner <andy>
Component: JavaScriptCoreAssignee: Andy VanWagoner <andy>
Status: RESOLVED WONTFIX    
Severity: Normal CC: benjamin, buildbot, darin, jfbastien, keith_miller, mark.lam, msaboff, saam
Priority: P2    
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch
none
Patch darin: review+, darin: commit-queue-

Andy VanWagoner
Reported 2017-05-04 20:15:47 PDT
[INTL] Use struct instead of HashMap for resolveLocale operation
Attachments
Patch (25.52 KB, patch)
2017-05-05 17:43 PDT, Andy VanWagoner
no flags
Patch (25.62 KB, patch)
2017-05-26 19:45 PDT, Andy VanWagoner
darin: review+
darin: commit-queue-
Andy VanWagoner
Comment 1 2017-05-05 17:43:55 PDT
JF Bastien
Comment 2 2017-05-23 23:23:40 PDT
Comment on attachment 309249 [details] Patch Sorry for being slow, I've been away for a while. Could you rebase? Some of the file diffs won't expand.
Andy VanWagoner
Comment 3 2017-05-26 19:45:40 PDT
Darin Adler
Comment 4 2017-06-06 14:19:09 PDT
Comment on attachment 311404 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=311404&action=review > Source/JavaScriptCore/runtime/IntlObject.h:72 > + const String& getExtension(Extension); WebKit coding style prohibits the use of the word "get" in a function name like this one. We would name it just "extension". > Source/JavaScriptCore/runtime/IntlObject.h:73 > + void setExtension(Extension, String); Should take "const String&" instead of String to avoid reference count churn. > Source/JavaScriptCore/runtime/IntlObject.h:83 > +void resolveLocale(ExecState&, const HashSet<String>& availableLocales, const Vector<String>& requestedLocales, IntlResolvedLocale& options, const IntlResolvedLocale::Extension relevantExtensionKeys[], size_t relevantExtensionKeyCount, Vector<String> (*localeData)(const String&, const IntlResolvedLocale::Extension)); The const here in const IntlResolvedLocale::Extension is not helpful. The use of size_t for relevantExtensionKeyCount seems like overkill. We normally use unsigned for such things in WebKit. The use of in/out for options here, where options is the fourth of seven arguments, makes this pretty hard to read. I wonder if there's a way to make this more straightforward.
Andy VanWagoner
Comment 5 2017-07-18 17:14:26 PDT
Sorry for the long silence. I'll take another pass at making the resolveLocale function easier to understand.
Andy VanWagoner
Comment 6 2018-03-20 08:44:17 PDT
This is old and not necessary. If there's a good reason to refactor it later, we can create a new issue.
Note You need to log in before you can comment on or make changes to this bug.