Source/WebCore/ChangeLog

 12015-07-28 Zan Dobersek <zdobersek@igalia.com>
 2
 3 restrictedKeyMap() in PerformanceUserTiming.cpp should return a const reference to the HashMap
 4 https://bugs.webkit.org/show_bug.cgi?id=147366
 5
 6 Reviewed by NOBODY (OOPS!).
 7
 8 Let restrictedKeyMap() return a const reference to the static HashMap object,
 9 avoiding copying the map on every retrieval.
 10
 11 The patch also modifies the code to use a type alias instead of typedefing
 12 the RestrictedKeyMap type, and replaces the deprecated static local definition
 13 macro with NeverDestroyed.
 14
 15 * page/PerformanceUserTiming.cpp:
 16
1172015-07-28 Chris Dumez <cdumez@apple.com>
218
319 Allow lax MIME type parsing for same-origin CSS in quirks mode.

Source/WebCore/page/PerformanceUserTiming.cpp

3131#include "Performance.h"
3232#include "PerformanceMark.h"
3333#include "PerformanceMeasure.h"
 34#include <wtf/NeverDestroyed.h>
3435#include <wtf/dtoa/utils.h>
3536#include <wtf/text/WTFString.h>
3637

@@namespace WebCore {
3839
3940namespace {
4041
41 typedef HashMap<String, NavigationTimingFunction> RestrictedKeyMap;
42 static RestrictedKeyMap restrictedKeyMap()
 42using RestrictedKeyMap = HashMap<String, NavigationTimingFunction>;
 43static const RestrictedKeyMap& restrictedKeyMap()
4344{
44  DEPRECATED_DEFINE_STATIC_LOCAL(RestrictedKeyMap, map, ());
45  if (map.isEmpty()) {
46  map.add("navigationStart", &PerformanceTiming::navigationStart);
47  map.add("unloadEventStart", &PerformanceTiming::unloadEventStart);
48  map.add("unloadEventEnd", &PerformanceTiming::unloadEventEnd);
49  map.add("redirectStart", &PerformanceTiming::redirectStart);
50  map.add("redirectEnd", &PerformanceTiming::redirectEnd);
51  map.add("fetchStart", &PerformanceTiming::fetchStart);
52  map.add("domainLookupStart", &PerformanceTiming::domainLookupStart);
53  map.add("domainLookupEnd", &PerformanceTiming::domainLookupEnd);
54  map.add("connectStart", &PerformanceTiming::connectStart);
55  map.add("connectEnd", &PerformanceTiming::connectEnd);
56  map.add("secureConnectionStart", &PerformanceTiming::secureConnectionStart);
57  map.add("requestStart", &PerformanceTiming::requestStart);
58  map.add("responseStart", &PerformanceTiming::responseStart);
59  map.add("responseEnd", &PerformanceTiming::responseEnd);
60  map.add("domLoading", &PerformanceTiming::domLoading);
61  map.add("domInteractive", &PerformanceTiming::domInteractive);
62  map.add("domContentLoadedEventStart", &PerformanceTiming::domContentLoadedEventStart);
63  map.add("domContentLoadedEventEnd", &PerformanceTiming::domContentLoadedEventEnd);
64  map.add("domComplete", &PerformanceTiming::domComplete);
65  map.add("loadEventStart", &PerformanceTiming::loadEventStart);
66  map.add("loadEventEnd", &PerformanceTiming::loadEventEnd);
67  }
 45 static NeverDestroyed<RestrictedKeyMap> map;
 46 if (map.get().isEmpty()) {
 47 map.get().add("navigationStart", &PerformanceTiming::navigationStart);
 48 map.get().add("unloadEventStart", &PerformanceTiming::unloadEventStart);
 49 map.get().add("unloadEventEnd", &PerformanceTiming::unloadEventEnd);
 50 map.get().add("redirectStart", &PerformanceTiming::redirectStart);
 51 map.get().add("redirectEnd", &PerformanceTiming::redirectEnd);
 52 map.get().add("fetchStart", &PerformanceTiming::fetchStart);
 53 map.get().add("domainLookupStart", &PerformanceTiming::domainLookupStart);
 54 map.get().add("domainLookupEnd", &PerformanceTiming::domainLookupEnd);
 55 map.get().add("connectStart", &PerformanceTiming::connectStart);
 56 map.get().add("connectEnd", &PerformanceTiming::connectEnd);
 57 map.get().add("secureConnectionStart", &PerformanceTiming::secureConnectionStart);
 58 map.get().add("requestStart", &PerformanceTiming::requestStart);
 59 map.get().add("responseStart", &PerformanceTiming::responseStart);
 60 map.get().add("responseEnd", &PerformanceTiming::responseEnd);
 61 map.get().add("domLoading", &PerformanceTiming::domLoading);
 62 map.get().add("domInteractive", &PerformanceTiming::domInteractive);
 63 map.get().add("domContentLoadedEventStart", &PerformanceTiming::domContentLoadedEventStart);
 64 map.get().add("domContentLoadedEventEnd", &PerformanceTiming::domContentLoadedEventEnd);
 65 map.get().add("domComplete", &PerformanceTiming::domComplete);
 66 map.get().add("loadEventStart", &PerformanceTiming::loadEventStart);
 67 map.get().add("loadEventEnd", &PerformanceTiming::loadEventEnd);
 68 };
 69
6870 return map;
6971}
7072