Title: [161801] trunk/Source
- Revision
- 161801
- Author
- [email protected]
- Date
- 2014-01-11 22:30:10 -0800 (Sat, 11 Jan 2014)
Log Message
Use std::call_once instead of AtomicallyInitializedStatic when creating a HTTP header set
https://bugs.webkit.org/show_bug.cgi?id=126837
Reviewed by Sam Weinig.
Source/WebCore:
Use std::call_once when constructing the HTTPHeaderSet.
* loader/CrossOriginAccessControl.cpp:
(WebCore::isOnAccessControlResponseHeaderWhitelist):
Source/WTF:
* wtf/HashSet.h:
(WTF::HashSet::HashSet):
Add a HashSet constructor that takes an initializer list.
Modified Paths
Diff
Modified: trunk/Source/WTF/ChangeLog (161800 => 161801)
--- trunk/Source/WTF/ChangeLog 2014-01-12 05:59:44 UTC (rev 161800)
+++ trunk/Source/WTF/ChangeLog 2014-01-12 06:30:10 UTC (rev 161801)
@@ -1,3 +1,14 @@
+2014-01-11 Anders Carlsson <[email protected]>
+
+ Use std::call_once instead of AtomicallyInitializedStatic when creating a HTTP header set
+ https://bugs.webkit.org/show_bug.cgi?id=126837
+
+ Reviewed by Sam Weinig.
+
+ * wtf/HashSet.h:
+ (WTF::HashSet::HashSet):
+ Add a HashSet constructor that takes an initializer list.
+
2014-01-11 Sam Weinig <[email protected]>
Fix the EFL build.
Modified: trunk/Source/WTF/wtf/HashSet.h (161800 => 161801)
--- trunk/Source/WTF/wtf/HashSet.h 2014-01-12 05:59:44 UTC (rev 161800)
+++ trunk/Source/WTF/wtf/HashSet.h 2014-01-12 06:30:10 UTC (rev 161801)
@@ -21,6 +21,7 @@
#ifndef WTF_HashSet_h
#define WTF_HashSet_h
+#include <initializer_list>
#include <wtf/FastMalloc.h>
#include <wtf/HashTable.h>
@@ -49,6 +50,16 @@
typedef HashTableConstIteratorAdapter<HashTableType, ValueType> const_iterator;
typedef typename HashTableType::AddResult AddResult;
+ HashSet()
+ {
+ }
+
+ HashSet(std::initializer_list<ValueArg> initializerList)
+ {
+ for (const auto& value : initializerList)
+ add(value);
+ }
+
void swap(HashSet&);
int size() const;
Modified: trunk/Source/WebCore/ChangeLog (161800 => 161801)
--- trunk/Source/WebCore/ChangeLog 2014-01-12 05:59:44 UTC (rev 161800)
+++ trunk/Source/WebCore/ChangeLog 2014-01-12 06:30:10 UTC (rev 161801)
@@ -1,3 +1,15 @@
+2014-01-11 Anders Carlsson <[email protected]>
+
+ Use std::call_once instead of AtomicallyInitializedStatic when creating a HTTP header set
+ https://bugs.webkit.org/show_bug.cgi?id=126837
+
+ Reviewed by Sam Weinig.
+
+ Use std::call_once when constructing the HTTPHeaderSet.
+
+ * loader/CrossOriginAccessControl.cpp:
+ (WebCore::isOnAccessControlResponseHeaderWhitelist):
+
2014-01-11 David Kilzer <[email protected]>
[iOS] Do not link to ApplicationServices.framework for iOS
Modified: trunk/Source/WebCore/loader/CrossOriginAccessControl.cpp (161800 => 161801)
--- trunk/Source/WebCore/loader/CrossOriginAccessControl.cpp 2014-01-12 05:59:44 UTC (rev 161800)
+++ trunk/Source/WebCore/loader/CrossOriginAccessControl.cpp 2014-01-12 06:30:10 UTC (rev 161801)
@@ -31,7 +31,7 @@
#include "ResourceRequest.h"
#include "ResourceResponse.h"
#include "SecurityOrigin.h"
-#include <wtf/Threading.h>
+#include <mutex>
#include <wtf/text/AtomicString.h>
#include <wtf/text/StringBuilder.h>
@@ -76,24 +76,22 @@
return true;
}
-static PassOwnPtr<HTTPHeaderSet> createAllowedCrossOriginResponseHeadersSet()
-{
- OwnPtr<HTTPHeaderSet> headerSet = adoptPtr(new HashSet<String, CaseFoldingHash>);
-
- headerSet->add("cache-control");
- headerSet->add("content-language");
- headerSet->add("content-type");
- headerSet->add("expires");
- headerSet->add("last-modified");
- headerSet->add("pragma");
-
- return headerSet.release();
-}
-
bool isOnAccessControlResponseHeaderWhitelist(const String& name)
{
- AtomicallyInitializedStatic(HTTPHeaderSet*, allowedCrossOriginResponseHeaders = createAllowedCrossOriginResponseHeadersSet().leakPtr());
+ static std::once_flag onceFlag;
+ static HTTPHeaderSet* allowedCrossOriginResponseHeaders;
+ std::call_once(onceFlag, []{
+ allowedCrossOriginResponseHeaders = std::make_unique<HTTPHeaderSet, std::initializer_list<String>>({
+ "cache-control",
+ "content-language",
+ "content-type",
+ "expires",
+ "last-modified",
+ "pragma"
+ }).release();
+ });
+
return allowedCrossOriginResponseHeaders->contains(name);
}
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes