Diff
Modified: trunk/Source/WTF/ChangeLog (204492 => 204493)
--- trunk/Source/WTF/ChangeLog 2016-08-16 02:06:45 UTC (rev 204492)
+++ trunk/Source/WTF/ChangeLog 2016-08-16 02:27:09 UTC (rev 204493)
@@ -1,3 +1,16 @@
+2016-08-15 Sam Weinig <[email protected]>
+
+ Speed up compile times by not including wtf/Variant.h so much
+ https://bugs.webkit.org/show_bug.cgi?id=160847
+
+ Reviewed by Alex Christensen and Saam Barati.
+
+ * wtf/Forward.h:
+ Add forward declaration of std::variant.
+
+ * wtf/StdLibExtras.h:
+ Remove references to std::variant. Move them to wtf/Variant.h
+
2016-08-15 Keith Miller <[email protected]>
Implement WASM Parser and B3 IR generator
Modified: trunk/Source/WTF/wtf/Forward.h (204492 => 204493)
--- trunk/Source/WTF/wtf/Forward.h 2016-08-16 02:06:45 UTC (rev 204492)
+++ trunk/Source/WTF/wtf/Forward.h 2016-08-16 02:27:09 UTC (rev 204493)
@@ -18,8 +18,7 @@
*
*/
-#ifndef WTF_Forward_h
-#define WTF_Forward_h
+#pragma once
#include <stddef.h>
@@ -54,6 +53,18 @@
}
+namespace std {
+namespace experimental {
+
+template<typename... T> class variant;
+
+}
+
+template<typename... Types>
+using variant = std::experimental::variant<Types...>;
+
+}
+
using WTF::AtomicString;
using WTF::AtomicStringImpl;
using WTF::BinarySemaphore;
@@ -78,5 +89,3 @@
using WTF::StringView;
using WTF::TextPosition;
using WTF::Vector;
-
-#endif // WTF_Forward_h
Modified: trunk/Source/WTF/wtf/StdLibExtras.h (204492 => 204493)
--- trunk/Source/WTF/wtf/StdLibExtras.h 2016-08-16 02:06:45 UTC (rev 204492)
+++ trunk/Source/WTF/wtf/StdLibExtras.h 2016-08-16 02:27:09 UTC (rev 204493)
@@ -32,7 +32,6 @@
#include <string.h>
#include <wtf/Assertions.h>
#include <wtf/CheckedArithmetic.h>
-#include <wtf/Variant.h>
// This was used to declare and define a static local variable (static T;) so that
// it was leaked so that its destructors were not called at exit.
@@ -403,18 +402,6 @@
return move(forward<T>(value));
}
-#if !COMPILER(CLANG) || WTF_CPP_STD_VER >= 14
-
-template<typename... Types>
-using variant = std::experimental::variant<Types...>;
-
-using std::experimental::get;
-using std::experimental::get_if;
-using std::experimental::holds_alternative;
-using std::experimental::visit;
-
-#endif
-
} // namespace std
#define WTFMove(value) std::move<WTF::CheckMoveParameter>(value)
Modified: trunk/Source/WebCore/ChangeLog (204492 => 204493)
--- trunk/Source/WebCore/ChangeLog 2016-08-16 02:06:45 UTC (rev 204492)
+++ trunk/Source/WebCore/ChangeLog 2016-08-16 02:27:09 UTC (rev 204493)
@@ -1,3 +1,34 @@
+2016-08-15 Sam Weinig <[email protected]>
+
+ Speed up compile times by not including wtf/Variant.h so much
+ https://bugs.webkit.org/show_bug.cgi?id=160847
+
+ Reviewed by Alex Christensen and Saam Barati.
+
+ "using std::experimental::variant" caused internal compiler errors in MSVC2015,
+ so we are just writing std::experimental where we use it for now.
+ We should move variant into the std::experimental namespace.
+
+ * bindings/js/JSNodeOrString.cpp:
+ (WebCore::toNodeOrStringVector):
+ * bindings/js/JSNodeOrString.h:
+ * dom/ContainerNode.cpp:
+ (WebCore::ContainerNode::childElementCount):
+ (WebCore::ContainerNode::append):
+ (WebCore::ContainerNode::prepend):
+ * dom/ContainerNode.h:
+ * dom/Node.cpp:
+ (WebCore::Node::appendChild):
+ (WebCore::nodeSetPreTransformedFromNodeOrStringVector):
+ (WebCore::firstFollowingSiblingNotInNodeSet):
+ (WebCore::Node::convertNodesOrStringsIntoNode):
+ (WebCore::Node::before):
+ (WebCore::Node::after):
+ (WebCore::Node::replaceWith):
+ * dom/Node.h:
+ (WebCore::Node::setStyleChange):
+ (WebCore::Node::customPseudoId):
+
2016-08-15 Daniel Bates <[email protected]>
ASSERTION FAILURE: [[videoLayer delegate] isKindOfClass:getUIViewClass()] in WebAVPlayerLayerView_videoView()
Modified: trunk/Source/WebCore/bindings/js/JSNodeOrString.cpp (204492 => 204493)
--- trunk/Source/WebCore/bindings/js/JSNodeOrString.cpp 2016-08-16 02:06:45 UTC (rev 204492)
+++ trunk/Source/WebCore/bindings/js/JSNodeOrString.cpp 2016-08-16 02:27:09 UTC (rev 204493)
@@ -33,11 +33,11 @@
namespace WebCore {
-Vector<std::variant<Ref<Node>, String>> toNodeOrStringVector(ExecState& state)
+Vector<std::experimental::variant<Ref<Node>, String>> toNodeOrStringVector(ExecState& state)
{
size_t argumentCount = state.argumentCount();
- Vector<std::variant<Ref<Node>, String>> result;
+ Vector<std::experimental::variant<Ref<Node>, String>> result;
result.reserveInitialCapacity(argumentCount);
for (size_t i = 0; i < argumentCount; ++i) {
Modified: trunk/Source/WebCore/bindings/js/JSNodeOrString.h (204492 => 204493)
--- trunk/Source/WebCore/bindings/js/JSNodeOrString.h 2016-08-16 02:06:45 UTC (rev 204492)
+++ trunk/Source/WebCore/bindings/js/JSNodeOrString.h 2016-08-16 02:27:09 UTC (rev 204493)
@@ -38,7 +38,7 @@
class Node;
-Vector<std::variant<Ref<Node>, String>> toNodeOrStringVector(JSC::ExecState&);
+Vector<std::experimental::variant<Ref<Node>, String>> toNodeOrStringVector(JSC::ExecState&);
} // namespace WebCore
Modified: trunk/Source/WebCore/dom/ContainerNode.cpp (204492 => 204493)
--- trunk/Source/WebCore/dom/ContainerNode.cpp 2016-08-16 02:06:45 UTC (rev 204492)
+++ trunk/Source/WebCore/dom/ContainerNode.cpp 2016-08-16 02:27:09 UTC (rev 204493)
@@ -60,6 +60,7 @@
#include "TemplateContentDocumentFragment.h"
#include <algorithm>
#include <wtf/CurrentTime.h>
+#include <wtf/Variant.h>
namespace WebCore {
@@ -876,7 +877,7 @@
return std::distance(children.begin(), children.end());
}
-void ContainerNode::append(Vector<std::variant<Ref<Node>, String>>&& nodeOrStringVector, ExceptionCode& ec)
+void ContainerNode::append(Vector<std::experimental::variant<Ref<Node>, String>>&& nodeOrStringVector, ExceptionCode& ec)
{
RefPtr<Node> node = convertNodesOrStringsIntoNode(WTFMove(nodeOrStringVector), ec);
if (ec || !node)
@@ -885,7 +886,7 @@
appendChild(*node, ec);
}
-void ContainerNode::prepend(Vector<std::variant<Ref<Node>, String>>&& nodeOrStringVector, ExceptionCode& ec)
+void ContainerNode::prepend(Vector<std::experimental::variant<Ref<Node>, String>>&& nodeOrStringVector, ExceptionCode& ec)
{
RefPtr<Node> node = convertNodesOrStringsIntoNode(WTFMove(nodeOrStringVector), ec);
if (ec || !node)
Modified: trunk/Source/WebCore/dom/ContainerNode.h (204492 => 204493)
--- trunk/Source/WebCore/dom/ContainerNode.h 2016-08-16 02:06:45 UTC (rev 204492)
+++ trunk/Source/WebCore/dom/ContainerNode.h 2016-08-16 02:27:09 UTC (rev 204493)
@@ -99,8 +99,8 @@
Element* firstElementChild() const;
Element* lastElementChild() const;
unsigned childElementCount() const;
- void append(Vector<std::variant<Ref<Node>, String>>&&, ExceptionCode&);
- void prepend(Vector<std::variant<Ref<Node>, String>>&&, ExceptionCode&);
+ void append(Vector<std::experimental::variant<Ref<Node>, String>>&&, ExceptionCode&);
+ void prepend(Vector<std::experimental::variant<Ref<Node>, String>>&&, ExceptionCode&);
bool ensurePreInsertionValidity(Node& newChild, Node* refChild, ExceptionCode&);
Modified: trunk/Source/WebCore/dom/Node.cpp (204492 => 204493)
--- trunk/Source/WebCore/dom/Node.cpp 2016-08-16 02:06:45 UTC (rev 204492)
+++ trunk/Source/WebCore/dom/Node.cpp 2016-08-16 02:27:09 UTC (rev 204493)
@@ -73,6 +73,7 @@
#include "XMLNames.h"
#include <wtf/RefCountedLeakCounter.h>
#include <wtf/SHA1.h>
+#include <wtf/Variant.h>
#include <wtf/text/CString.h>
#include <wtf/text/StringBuilder.h>
@@ -437,7 +438,7 @@
return downcast<ContainerNode>(*this).appendChild(newChild, ec);
}
-static HashSet<RefPtr<Node>> nodeSetPreTransformedFromNodeOrStringVector(const Vector<std::variant<Ref<Node>, String>>& vector)
+static HashSet<RefPtr<Node>> nodeSetPreTransformedFromNodeOrStringVector(const Vector<std::experimental::variant<Ref<Node>, String>>& vector)
{
HashSet<RefPtr<Node>> nodeSet;
@@ -447,7 +448,7 @@
);
for (const auto& variant : vector)
- std::visit(visitor, variant);
+ std::experimental::visit(visitor, variant);
return nodeSet;
}
@@ -470,7 +471,7 @@
return nullptr;
}
-RefPtr<Node> Node::convertNodesOrStringsIntoNode(Vector<std::variant<Ref<Node>, String>>&& nodeOrStringVector, ExceptionCode& ec)
+RefPtr<Node> Node::convertNodesOrStringsIntoNode(Vector<std::experimental::variant<Ref<Node>, String>>&& nodeOrStringVector, ExceptionCode& ec)
{
if (nodeOrStringVector.isEmpty())
return nullptr;
@@ -484,7 +485,7 @@
);
for (auto& variant : nodeOrStringVector)
- std::visit(visitor, variant);
+ std::experimental::visit(visitor, variant);
if (nodes.size() == 1)
return WTFMove(nodes.first());
@@ -497,7 +498,7 @@
return WTFMove(nodeToReturn);
}
-void Node::before(Vector<std::variant<Ref<Node>, String>>&& nodeOrStringVector, ExceptionCode& ec)
+void Node::before(Vector<std::experimental::variant<Ref<Node>, String>>&& nodeOrStringVector, ExceptionCode& ec)
{
RefPtr<ContainerNode> parent = parentNode();
if (!parent)
@@ -518,7 +519,7 @@
parent->insertBefore(*node, viablePreviousSibling.get(), ec);
}
-void Node::after(Vector<std::variant<Ref<Node>, String>>&& nodeOrStringVector, ExceptionCode& ec)
+void Node::after(Vector<std::experimental::variant<Ref<Node>, String>>&& nodeOrStringVector, ExceptionCode& ec)
{
RefPtr<ContainerNode> parent = parentNode();
if (!parent)
@@ -534,7 +535,7 @@
parent->insertBefore(*node, viableNextSibling.get(), ec);
}
-void Node::replaceWith(Vector<std::variant<Ref<Node>, String>>&& nodeOrStringVector, ExceptionCode& ec)
+void Node::replaceWith(Vector<std::experimental::variant<Ref<Node>, String>>&& nodeOrStringVector, ExceptionCode& ec)
{
RefPtr<ContainerNode> parent = parentNode();
if (!parent)
Modified: trunk/Source/WebCore/dom/Node.h (204492 => 204493)
--- trunk/Source/WebCore/dom/Node.h 2016-08-16 02:06:45 UTC (rev 204492)
+++ trunk/Source/WebCore/dom/Node.h 2016-08-16 02:27:09 UTC (rev 204493)
@@ -35,7 +35,6 @@
#include <wtf/ListHashSet.h>
#include <wtf/MainThread.h>
#include <wtf/TypeCasts.h>
-#include <wtf/Variant.h>
// This needs to be here because Document.h also depends on it.
#define DUMP_NODE_STATISTICS 0
@@ -208,9 +207,9 @@
Element* nextElementSibling() const;
// From the ChildNode - https://dom.spec.whatwg.org/#childnode
- void before(Vector<std::variant<Ref<Node>, String>>&&, ExceptionCode&);
- void after(Vector<std::variant<Ref<Node>, String>>&&, ExceptionCode&);
- void replaceWith(Vector<std::variant<Ref<Node>, String>>&&, ExceptionCode&);
+ void before(Vector<std::experimental::variant<Ref<Node>, String>>&&, ExceptionCode&);
+ void after(Vector<std::experimental::variant<Ref<Node>, String>>&&, ExceptionCode&);
+ void replaceWith(Vector<std::experimental::variant<Ref<Node>, String>>&&, ExceptionCode&);
WEBCORE_EXPORT void remove(ExceptionCode&);
// Other methods (not part of DOM)
@@ -661,7 +660,7 @@
void setStyleChange(StyleChangeType changeType) { m_nodeFlags = (m_nodeFlags & ~StyleChangeMask) | changeType; }
void updateAncestorsForStyleRecalc();
- RefPtr<Node> convertNodesOrStringsIntoNode(Vector<std::variant<Ref<Node>, String>>&&, ExceptionCode&);
+ RefPtr<Node> convertNodesOrStringsIntoNode(Vector<std::experimental::variant<Ref<Node>, String>>&&, ExceptionCode&);
private:
virtual PseudoId customPseudoId() const
Modified: trunk/Tools/ChangeLog (204492 => 204493)
--- trunk/Tools/ChangeLog 2016-08-16 02:06:45 UTC (rev 204492)
+++ trunk/Tools/ChangeLog 2016-08-16 02:27:09 UTC (rev 204493)
@@ -1,3 +1,14 @@
+2016-08-15 Sam Weinig <[email protected]>
+
+ Speed up compile times by not including wtf/Variant.h so much
+ https://bugs.webkit.org/show_bug.cgi?id=160847
+
+ Reviewed by Alex Christensen and Saam Barati.
+
+ * TestWebKitAPI/Tests/WTF/Variant.cpp:
+ (TestWebKitAPI::TEST):
+ Explicitly use std::experimental::variant.
+
2016-08-15 Simon Fraser <[email protected]>
Allow a port to run tests with a custom device setup
Modified: trunk/Tools/TestWebKitAPI/Tests/WTF/Variant.cpp (204492 => 204493)
--- trunk/Tools/TestWebKitAPI/Tests/WTF/Variant.cpp 2016-08-16 02:06:45 UTC (rev 204492)
+++ trunk/Tools/TestWebKitAPI/Tests/WTF/Variant.cpp 2016-08-16 02:27:09 UTC (rev 204493)
@@ -37,9 +37,9 @@
TEST(WTF_Variant, Initial)
{
- std::variant<int, double> v1;
+ std::experimental::variant<int, double> v1;
EXPECT_TRUE(v1.index() == 0);
- EXPECT_TRUE(std::get<int>(v1) == 0);
+ EXPECT_TRUE(std::experimental::get<int>(v1) == 0);
struct T {
T() : value(15) { }
@@ -46,28 +46,28 @@
int value;
};
- std::variant<T, int> v2;
+ std::experimental::variant<T, int> v2;
EXPECT_TRUE(v2.index() == 0);
- EXPECT_TRUE(std::get<T>(v2).value == 15);
+ EXPECT_TRUE(std::experimental::get<T>(v2).value == 15);
}
TEST(WTF_Variant, Basic)
{
- std::variant<int, double> variant = 1;
+ std::experimental::variant<int, double> variant = 1;
EXPECT_TRUE(variant.index() == 0);
- EXPECT_TRUE(std::get<int>(variant) == 1);
- EXPECT_TRUE(*std::get_if<int>(variant) == 1);
- EXPECT_TRUE(std::get_if<double>(variant) == nullptr);
- EXPECT_TRUE(std::holds_alternative<int>(variant));
- EXPECT_FALSE(std::holds_alternative<double>(variant));
+ EXPECT_TRUE(std::experimental::get<int>(variant) == 1);
+ EXPECT_TRUE(*std::experimental::get_if<int>(variant) == 1);
+ EXPECT_TRUE(std::experimental::get_if<double>(variant) == nullptr);
+ EXPECT_TRUE(std::experimental::holds_alternative<int>(variant));
+ EXPECT_FALSE(std::experimental::holds_alternative<double>(variant));
variant = 1.0;
EXPECT_TRUE(variant.index() == 1);
- EXPECT_TRUE(std::get<double>(variant) == 1);
- EXPECT_TRUE(*std::get_if<double>(variant) == 1.0);
- EXPECT_TRUE(std::get_if<int>(variant) == nullptr);
- EXPECT_TRUE(std::holds_alternative<double>(variant));
- EXPECT_FALSE(std::holds_alternative<int>(variant));
+ EXPECT_TRUE(std::experimental::get<double>(variant) == 1);
+ EXPECT_TRUE(*std::experimental::get_if<double>(variant) == 1.0);
+ EXPECT_TRUE(std::experimental::get_if<int>(variant) == nullptr);
+ EXPECT_TRUE(std::experimental::holds_alternative<double>(variant));
+ EXPECT_FALSE(std::experimental::holds_alternative<int>(variant));
}
TEST(WTF_Variant, BasicVisitor)
@@ -94,18 +94,18 @@
Type type = Type::None;
- std::variant<int, float, String> variant = 8;
- std::visit(Visitor(type), variant);
+ std::experimental::variant<int, float, String> variant = 8;
+ std::experimental::visit(Visitor(type), variant);
EXPECT_TRUE(Type::Int == type);
variant = 1.0f;
- std::visit(Visitor(type), variant);
+ std::experimental::visit(Visitor(type), variant);
EXPECT_TRUE(Type::Float == type);
variant = "hello";
- std::visit(Visitor(type), variant);
+ std::experimental::visit(Visitor(type), variant);
EXPECT_TRUE(Type::String == type);
}
@@ -126,18 +126,18 @@
[&](String) { type = Type::String; }
);
- std::variant<int, float, String> variant = 8;
- std::visit(visitor, variant);
+ std::experimental::variant<int, float, String> variant = 8;
+ std::experimental::visit(visitor, variant);
EXPECT_TRUE(Type::Int == type);
variant = 1.0f;
- std::visit(visitor, variant);
+ std::experimental::visit(visitor, variant);
EXPECT_TRUE(Type::Float == type);
variant = "hello";
- std::visit(visitor, variant);
+ std::experimental::visit(visitor, variant);
EXPECT_TRUE(Type::String == type);
}
@@ -147,7 +147,7 @@
{
auto uniquePtr = std::make_unique<ConstructorDestructorCounter>();
- std::variant<std::unique_ptr<ConstructorDestructorCounter>, int> v = WTFMove(uniquePtr);
+ std::experimental::variant<std::unique_ptr<ConstructorDestructorCounter>, int> v = WTFMove(uniquePtr);
EXPECT_EQ(1u, ConstructorDestructorCounter::constructionCount);
EXPECT_EQ(0u, ConstructorDestructorCounter::destructionCount);
@@ -162,7 +162,7 @@
{
RefLogger a("a");
RefPtr<RefLogger> ref(&a);
- std::variant<RefPtr<RefLogger>, int> v = ref;
+ std::experimental::variant<RefPtr<RefLogger>, int> v = ref;
}
ASSERT_STREQ("ref(a) ref(a) deref(a) deref(a) ", takeLogStr().c_str());
@@ -170,7 +170,7 @@
{
RefLogger a("a");
RefPtr<RefLogger> ref(&a);
- std::variant<RefPtr<RefLogger>, int> v = WTFMove(ref);
+ std::experimental::variant<RefPtr<RefLogger>, int> v = WTFMove(ref);
}
ASSERT_STREQ("ref(a) deref(a) ", takeLogStr().c_str());
@@ -181,7 +181,7 @@
{
RefLogger a("a");
Ref<RefLogger> ref(a);
- std::variant<Ref<RefLogger>, int> v = WTFMove(ref);
+ std::experimental::variant<Ref<RefLogger>, int> v = WTFMove(ref);
}
ASSERT_STREQ("ref(a) deref(a) ", takeLogStr().c_str());