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

Unified Diff: Source/core/fetch/FetchUtils.cpp

Issue 794223003: Cheaper thread-safe atomic initialization of static references. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Add type check for initial value Created 5 years, 11 months 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
Index: Source/core/fetch/FetchUtils.cpp
diff --git a/Source/core/fetch/FetchUtils.cpp b/Source/core/fetch/FetchUtils.cpp
index 8f9c4531eaa29e6ccd265b312fc1087eb34c8edf..5460f74fe6f0478acd9bf29eedccbb20991e1257 100644
--- a/Source/core/fetch/FetchUtils.cpp
+++ b/Source/core/fetch/FetchUtils.cpp
@@ -26,7 +26,7 @@ public:
|| name.startsWith(m_secHeaderPrefix, false);
}
- static const ForbiddenHeaderNames* get();
+ static const ForbiddenHeaderNames& get();
private:
ForbiddenHeaderNames();
@@ -63,9 +63,9 @@ ForbiddenHeaderNames::ForbiddenHeaderNames()
m_fixedNames.add("via");
}
-const ForbiddenHeaderNames* ForbiddenHeaderNames::get()
+const ForbiddenHeaderNames& ForbiddenHeaderNames::get()
{
- AtomicallyInitializedStatic(const ForbiddenHeaderNames*, instance = new ForbiddenHeaderNames);
+ AtomicallyInitializedStaticReference(const ForbiddenHeaderNames, instance, new ForbiddenHeaderNames);
return instance;
}
@@ -139,7 +139,7 @@ bool FetchUtils::isForbiddenHeaderName(const String& name)
// or starts with `Proxy-` or `Sec-` (including when it is just `Proxy-` or
// `Sec-`)."
- return ForbiddenHeaderNames::get()->has(name);
+ return ForbiddenHeaderNames::get().has(name);
}
bool FetchUtils::isForbiddenResponseHeaderName(const String& name)

Powered by Google App Engine
This is Rietveld 408576698