RESOLVED FIXED 147366
[PerformanceTiming] Don't expose the restrictedKeyMap() HashMap
https://bugs.webkit.org/show_bug.cgi?id=147366
Summary [PerformanceTiming] Don't expose the restrictedKeyMap() HashMap
Zan Dobersek
Reported 2015-07-28 12:38:42 PDT
restrictedKeyMap() in PerformanceUserTiming.cpp should return a const reference to the HashMap
Attachments
Patch (5.11 KB, patch)
2015-07-28 12:43 PDT, Zan Dobersek
no flags
Patch (6.86 KB, patch)
2015-08-13 11:22 PDT, Zan Dobersek
no flags
Patch (6.66 KB, patch)
2016-01-03 06:49 PST, Zan Dobersek
no flags
Zan Dobersek
Comment 1 2015-07-28 12:43:17 PDT
Darin Adler
Comment 2 2015-08-09 18:04:23 PDT
Comment on attachment 257670 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=257670&action=review > Source/WebCore/page/PerformanceUserTiming.cpp:68 > + static NeverDestroyed<RestrictedKeyMap> map; > + if (map.get().isEmpty()) { > + map.get().add("navigationStart", &PerformanceTiming::navigationStart); > + map.get().add("unloadEventStart", &PerformanceTiming::unloadEventStart); > + map.get().add("unloadEventEnd", &PerformanceTiming::unloadEventEnd); > + map.get().add("redirectStart", &PerformanceTiming::redirectStart); > + map.get().add("redirectEnd", &PerformanceTiming::redirectEnd); > + map.get().add("fetchStart", &PerformanceTiming::fetchStart); > + map.get().add("domainLookupStart", &PerformanceTiming::domainLookupStart); > + map.get().add("domainLookupEnd", &PerformanceTiming::domainLookupEnd); > + map.get().add("connectStart", &PerformanceTiming::connectStart); > + map.get().add("connectEnd", &PerformanceTiming::connectEnd); > + map.get().add("secureConnectionStart", &PerformanceTiming::secureConnectionStart); > + map.get().add("requestStart", &PerformanceTiming::requestStart); > + map.get().add("responseStart", &PerformanceTiming::responseStart); > + map.get().add("responseEnd", &PerformanceTiming::responseEnd); > + map.get().add("domLoading", &PerformanceTiming::domLoading); > + map.get().add("domInteractive", &PerformanceTiming::domInteractive); > + map.get().add("domContentLoadedEventStart", &PerformanceTiming::domContentLoadedEventStart); > + map.get().add("domContentLoadedEventEnd", &PerformanceTiming::domContentLoadedEventEnd); > + map.get().add("domComplete", &PerformanceTiming::domComplete); > + map.get().add("loadEventStart", &PerformanceTiming::loadEventStart); > + map.get().add("loadEventEnd", &PerformanceTiming::loadEventEnd); > + }; This is not a good way to create the map. All the adds end up getting inlined. Instead we should use a loop to build the map. I think the best practice is to write a separate create function. UserTiming::findExistingMarkStartTime also has double hash lookup mistakes in it. I’m not even sure we should expose the map. I think that a function that takes a string and returns a possibly-null NavigationTimingFunction would be better.
Zan Dobersek
Comment 3 2015-08-13 11:22:46 PDT
WebKit Commit Bot
Comment 4 2015-08-13 11:25:49 PDT
Attachment 258904 [details] did not pass style-queue: ERROR: Source/WebCore/page/PerformanceUserTiming.cpp:46: Missing space before { [whitespace/braces] [5] ERROR: Source/WebCore/page/PerformanceUserTiming.cpp:47: Missing space before { [whitespace/braces] [5] ERROR: Source/WebCore/page/PerformanceUserTiming.cpp:48: Missing space before { [whitespace/braces] [5] ERROR: Source/WebCore/page/PerformanceUserTiming.cpp:49: Missing space before { [whitespace/braces] [5] ERROR: Source/WebCore/page/PerformanceUserTiming.cpp:50: Missing space before { [whitespace/braces] [5] ERROR: Source/WebCore/page/PerformanceUserTiming.cpp:51: Missing space before { [whitespace/braces] [5] ERROR: Source/WebCore/page/PerformanceUserTiming.cpp:52: Missing space before { [whitespace/braces] [5] ERROR: Source/WebCore/page/PerformanceUserTiming.cpp:53: Missing space before { [whitespace/braces] [5] ERROR: Source/WebCore/page/PerformanceUserTiming.cpp:54: Missing space before { [whitespace/braces] [5] ERROR: Source/WebCore/page/PerformanceUserTiming.cpp:55: Missing space before { [whitespace/braces] [5] ERROR: Source/WebCore/page/PerformanceUserTiming.cpp:56: Missing space before { [whitespace/braces] [5] ERROR: Source/WebCore/page/PerformanceUserTiming.cpp:57: Missing space before { [whitespace/braces] [5] ERROR: Source/WebCore/page/PerformanceUserTiming.cpp:58: Missing space before { [whitespace/braces] [5] ERROR: Source/WebCore/page/PerformanceUserTiming.cpp:59: Missing space before { [whitespace/braces] [5] ERROR: Source/WebCore/page/PerformanceUserTiming.cpp:60: Missing space before { [whitespace/braces] [5] ERROR: Source/WebCore/page/PerformanceUserTiming.cpp:61: Missing space before { [whitespace/braces] [5] ERROR: Source/WebCore/page/PerformanceUserTiming.cpp:62: Missing space before { [whitespace/braces] [5] ERROR: Source/WebCore/page/PerformanceUserTiming.cpp:63: Missing space before { [whitespace/braces] [5] ERROR: Source/WebCore/page/PerformanceUserTiming.cpp:64: Missing space before { [whitespace/braces] [5] ERROR: Source/WebCore/page/PerformanceUserTiming.cpp:65: Missing space before { [whitespace/braces] [5] ERROR: Source/WebCore/page/PerformanceUserTiming.cpp:66: Missing space before { [whitespace/braces] [5] Total errors found: 21 in 2 files If any of these errors are false positives, please file a bug against check-webkit-style.
Zan Dobersek
Comment 5 2016-01-03 06:49:55 PST
WebKit Commit Bot
Comment 6 2016-01-03 06:51:36 PST
Attachment 268136 [details] did not pass style-queue: ERROR: Source/WebCore/page/PerformanceUserTiming.cpp:46: Missing space before { [whitespace/braces] [5] ERROR: Source/WebCore/page/PerformanceUserTiming.cpp:47: Missing space before { [whitespace/braces] [5] ERROR: Source/WebCore/page/PerformanceUserTiming.cpp:48: Missing space before { [whitespace/braces] [5] ERROR: Source/WebCore/page/PerformanceUserTiming.cpp:49: Missing space before { [whitespace/braces] [5] ERROR: Source/WebCore/page/PerformanceUserTiming.cpp:50: Missing space before { [whitespace/braces] [5] ERROR: Source/WebCore/page/PerformanceUserTiming.cpp:51: Missing space before { [whitespace/braces] [5] ERROR: Source/WebCore/page/PerformanceUserTiming.cpp:52: Missing space before { [whitespace/braces] [5] ERROR: Source/WebCore/page/PerformanceUserTiming.cpp:53: Missing space before { [whitespace/braces] [5] ERROR: Source/WebCore/page/PerformanceUserTiming.cpp:54: Missing space before { [whitespace/braces] [5] ERROR: Source/WebCore/page/PerformanceUserTiming.cpp:55: Missing space before { [whitespace/braces] [5] ERROR: Source/WebCore/page/PerformanceUserTiming.cpp:56: Missing space before { [whitespace/braces] [5] ERROR: Source/WebCore/page/PerformanceUserTiming.cpp:57: Missing space before { [whitespace/braces] [5] ERROR: Source/WebCore/page/PerformanceUserTiming.cpp:58: Missing space before { [whitespace/braces] [5] ERROR: Source/WebCore/page/PerformanceUserTiming.cpp:59: Missing space before { [whitespace/braces] [5] ERROR: Source/WebCore/page/PerformanceUserTiming.cpp:60: Missing space before { [whitespace/braces] [5] ERROR: Source/WebCore/page/PerformanceUserTiming.cpp:61: Missing space before { [whitespace/braces] [5] ERROR: Source/WebCore/page/PerformanceUserTiming.cpp:62: Missing space before { [whitespace/braces] [5] ERROR: Source/WebCore/page/PerformanceUserTiming.cpp:63: Missing space before { [whitespace/braces] [5] ERROR: Source/WebCore/page/PerformanceUserTiming.cpp:64: Missing space before { [whitespace/braces] [5] ERROR: Source/WebCore/page/PerformanceUserTiming.cpp:65: Missing space before { [whitespace/braces] [5] ERROR: Source/WebCore/page/PerformanceUserTiming.cpp:66: Missing space before { [whitespace/braces] [5] Total errors found: 21 in 2 files If any of these errors are false positives, please file a bug against check-webkit-style.
Zan Dobersek
Comment 7 2016-01-04 23:46:32 PST
Comment on attachment 268136 [details] Patch Clearing flags on attachment: 268136 Committed r194578: <http://trac.webkit.org/changeset/194578>
Zan Dobersek
Comment 8 2016-01-04 23:46:39 PST
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.