Diff
Modified: trunk/Source/WebCore/ChangeLog (231287 => 231288)
--- trunk/Source/WebCore/ChangeLog 2018-05-03 00:49:20 UTC (rev 231287)
+++ trunk/Source/WebCore/ChangeLog 2018-05-03 00:50:19 UTC (rev 231288)
@@ -1,3 +1,43 @@
+2018-05-01 Yusuke Suzuki <[email protected]>
+
+ Use pointer instead of std::optional<std::reference_wrapper<>>
+ https://bugs.webkit.org/show_bug.cgi?id=185186
+
+ Reviewed by Alex Christensen.
+
+ std::optional<T&> is not accepted in C++17 spec. So we replaced it
+ with std::optional<std::reference_wrapper<T>>.
+
+ In this patch, we replace it with T*, which is well-aligned to
+ WebKit's convention.
+
+ * Modules/mediastream/RTCPeerConnection.cpp:
+ (WebCore::iceServersFromConfiguration):
+ (WebCore::RTCPeerConnection::initializeConfiguration):
+ (WebCore::RTCPeerConnection::setConfiguration):
+ * css/parser/CSSParser.cpp:
+ (WebCore::CSSParser::parseSystemColor):
+ * css/parser/CSSParser.h:
+ * dom/DatasetDOMStringMap.cpp:
+ (WebCore::DatasetDOMStringMap::item const):
+ (WebCore::DatasetDOMStringMap::namedItem const):
+ * dom/DatasetDOMStringMap.h:
+ * dom/Element.cpp:
+ (WebCore::Element::insertAdjacentHTML):
+ * dom/Element.h:
+ * html/canvas/CanvasStyle.cpp:
+ (WebCore::parseColor):
+ * inspector/DOMEditor.cpp:
+ * platform/network/curl/CurlFormDataStream.cpp:
+ (WebCore::CurlFormDataStream::getPostData):
+ * platform/network/curl/CurlFormDataStream.h:
+ * platform/network/curl/CurlRequest.cpp:
+ (WebCore::CurlRequest::setupPOST):
+ * testing/MockCDMFactory.cpp:
+ (WebCore::MockCDMFactory::keysForSessionWithID const):
+ (WebCore::MockCDMInstance::updateLicense):
+ * testing/MockCDMFactory.h:
+
2018-05-02 Keith Rollin <[email protected]>
Add facility for tracking times and results of page and resource loading
Modified: trunk/Source/WebCore/Modules/mediastream/RTCPeerConnection.cpp (231287 => 231288)
--- trunk/Source/WebCore/Modules/mediastream/RTCPeerConnection.cpp 2018-05-03 00:49:20 UTC (rev 231287)
+++ trunk/Source/WebCore/Modules/mediastream/RTCPeerConnection.cpp 2018-05-03 00:50:19 UTC (rev 231288)
@@ -301,12 +301,12 @@
}
// Implementation of https://w3c.github.io/webrtc-pc/#set-pc-configuration
-static inline ExceptionOr<Vector<MediaEndpointConfiguration::IceServerInfo>> iceServersFromConfiguration(RTCConfiguration& newConfiguration, std::optional<std::reference_wrapper<const RTCConfiguration>> existingConfiguration, bool isLocalDescriptionSet)
+static inline ExceptionOr<Vector<MediaEndpointConfiguration::IceServerInfo>> iceServersFromConfiguration(RTCConfiguration& newConfiguration, const RTCConfiguration* existingConfiguration, bool isLocalDescriptionSet)
{
- if (existingConfiguration && newConfiguration.bundlePolicy != existingConfiguration->get().bundlePolicy)
+ if (existingConfiguration && newConfiguration.bundlePolicy != existingConfiguration->bundlePolicy)
return Exception { InvalidModificationError, "IceTransportPolicy does not match existing policy" };
- if (existingConfiguration && newConfiguration.iceCandidatePoolSize != existingConfiguration->get().iceCandidatePoolSize && isLocalDescriptionSet)
+ if (existingConfiguration && newConfiguration.iceCandidatePoolSize != existingConfiguration->iceCandidatePoolSize && isLocalDescriptionSet)
return Exception { InvalidModificationError, "IceTransportPolicy pool size does not match existing pool size" };
Vector<MediaEndpointConfiguration::IceServerInfo> servers;
@@ -342,7 +342,7 @@
{
INFO_LOG(LOGIDENTIFIER);
- auto servers = iceServersFromConfiguration(configuration, std::nullopt, false);
+ auto servers = iceServersFromConfiguration(configuration, nullptr, false);
if (servers.hasException())
return servers.releaseException();
@@ -360,7 +360,7 @@
INFO_LOG(LOGIDENTIFIER);
- auto servers = iceServersFromConfiguration(configuration, std::cref(m_configuration), m_backend->isLocalDescriptionSet());
+ auto servers = iceServersFromConfiguration(configuration, &m_configuration, m_backend->isLocalDescriptionSet());
if (servers.hasException())
return servers.releaseException();
Modified: trunk/Source/WebCore/css/parser/CSSParser.cpp (231287 => 231288)
--- trunk/Source/WebCore/css/parser/CSSParser.cpp 2018-05-03 00:49:20 UTC (rev 231287)
+++ trunk/Source/WebCore/css/parser/CSSParser.cpp 2018-05-03 00:50:19 UTC (rev 231288)
@@ -178,7 +178,7 @@
return primitiveValue.color();
}
-Color CSSParser::parseSystemColor(const String& string, std::optional<std::reference_wrapper<const CSSParserContext>> context)
+Color CSSParser::parseSystemColor(const String& string, const CSSParserContext* context)
{
CSSValueID id = cssValueKeywordID(string);
if (!StyleColor::isSystemColor(id))
@@ -185,7 +185,7 @@
return Color();
OptionSet<StyleColor::Options> options;
- if (context && context->get().useSystemAppearance)
+ if (context && context->useSystemAppearance)
options |= StyleColor::Options::UseSystemAppearance;
return RenderTheme::singleton().systemColor(id, options);
}
Modified: trunk/Source/WebCore/css/parser/CSSParser.h (231287 => 231288)
--- trunk/Source/WebCore/css/parser/CSSParser.h 2018-05-03 00:49:20 UTC (rev 231287)
+++ trunk/Source/WebCore/css/parser/CSSParser.h 2018-05-03 00:50:19 UTC (rev 231288)
@@ -78,7 +78,7 @@
RefPtr<CSSValue> parseValueWithVariableReferences(CSSPropertyID, const CSSValue&, const CustomPropertyValueMap& customProperties, TextDirection, WritingMode);
static Color parseColor(const String&, bool strict = false);
- static Color parseSystemColor(const String&, std::optional<std::reference_wrapper<const CSSParserContext>>);
+ static Color parseSystemColor(const String&, const CSSParserContext*);
private:
ParseResult parseValue(MutableStyleProperties&, CSSPropertyID, const String&, bool important);
Modified: trunk/Source/WebCore/dom/DatasetDOMStringMap.cpp (231287 => 231288)
--- trunk/Source/WebCore/dom/DatasetDOMStringMap.cpp 2018-05-03 00:49:20 UTC (rev 231287)
+++ trunk/Source/WebCore/dom/DatasetDOMStringMap.cpp 2018-05-03 00:50:19 UTC (rev 231288)
@@ -188,7 +188,7 @@
return names;
}
-std::optional<std::reference_wrapper<const AtomicString>> DatasetDOMStringMap::item(const String& propertyName) const
+const AtomicString* DatasetDOMStringMap::item(const String& propertyName) const
{
if (m_element.hasAttributes()) {
AttributeIteratorAccessor attributeIteratorAccessor = m_element.attributesIterator();
@@ -198,23 +198,23 @@
// Building a new AtomicString in that case is overkill so we do a direct character comparison.
const Attribute& attribute = *attributeIteratorAccessor.begin();
if (propertyNameMatchesAttributeName(propertyName, attribute.localName()))
- return std::cref(attribute.value());
+ return &attribute.value();
} else {
AtomicString attributeName = convertPropertyNameToAttributeName(propertyName);
for (const Attribute& attribute : attributeIteratorAccessor) {
if (attribute.localName() == attributeName)
- return std::cref(attribute.value());
+ return &attribute.value();
}
}
}
- return std::nullopt;
+ return nullptr;
}
String DatasetDOMStringMap::namedItem(const AtomicString& name) const
{
- if (auto value = item(name))
- return value->get();
+ if (const auto* value = item(name))
+ return *value;
return String { };
}
Modified: trunk/Source/WebCore/dom/DatasetDOMStringMap.h (231287 => 231288)
--- trunk/Source/WebCore/dom/DatasetDOMStringMap.h 2018-05-03 00:49:20 UTC (rev 231287)
+++ trunk/Source/WebCore/dom/DatasetDOMStringMap.h 2018-05-03 00:50:19 UTC (rev 231288)
@@ -53,7 +53,7 @@
Element& element() { return m_element; }
private:
- std::optional<std::reference_wrapper<const AtomicString>> item(const String& name) const;
+ const AtomicString* item(const String& name) const;
Element& m_element;
};
Modified: trunk/Source/WebCore/dom/Element.cpp (231287 => 231288)
--- trunk/Source/WebCore/dom/Element.cpp 2018-05-03 00:49:20 UTC (rev 231287)
+++ trunk/Source/WebCore/dom/Element.cpp 2018-05-03 00:50:19 UTC (rev 231288)
@@ -3733,7 +3733,7 @@
}
// https://w3c.github.io/DOM-Parsing/#dom-element-insertadjacenthtml
-ExceptionOr<void> Element::insertAdjacentHTML(const String& where, const String& markup, std::optional<std::reference_wrapper<NodeVector>> addedNodes)
+ExceptionOr<void> Element::insertAdjacentHTML(const String& where, const String& markup, NodeVector* addedNodes)
{
// Steps 1 and 2.
auto contextElement = contextElementForInsertion(where, *this);
@@ -3747,7 +3747,7 @@
if (UNLIKELY(addedNodes)) {
// Must be called before insertAdjacent, as otherwise the children of fragment will be moved
// to their new parent and will be harder to keep track of.
- addedNodes->get() = collectChildNodes(fragment.returnValue());
+ *addedNodes = collectChildNodes(fragment.returnValue());
}
// Step 4.
@@ -3759,7 +3759,7 @@
ExceptionOr<void> Element::insertAdjacentHTML(const String& where, const String& markup)
{
- return insertAdjacentHTML(where, markup, std::nullopt);
+ return insertAdjacentHTML(where, markup, nullptr);
}
ExceptionOr<void> Element::insertAdjacentText(const String& where, const String& text)
Modified: trunk/Source/WebCore/dom/Element.h (231287 => 231288)
--- trunk/Source/WebCore/dom/Element.h 2018-05-03 00:49:20 UTC (rev 231287)
+++ trunk/Source/WebCore/dom/Element.h 2018-05-03 00:50:19 UTC (rev 231288)
@@ -314,7 +314,7 @@
WEBCORE_EXPORT void setTabIndex(int);
virtual RefPtr<Element> focusDelegate();
- ExceptionOr<void> insertAdjacentHTML(const String& where, const String& html, std::optional<std::reference_wrapper<NodeVector>> addedNodes);
+ ExceptionOr<void> insertAdjacentHTML(const String& where, const String& html, NodeVector* addedNodes);
WEBCORE_EXPORT ExceptionOr<Element*> insertAdjacentElement(const String& where, Element& newChild);
WEBCORE_EXPORT ExceptionOr<void> insertAdjacentHTML(const String& where, const String& html);
Modified: trunk/Source/WebCore/html/canvas/CanvasStyle.cpp (231287 => 231288)
--- trunk/Source/WebCore/html/canvas/CanvasStyle.cpp 2018-05-03 00:49:20 UTC (rev 231287)
+++ trunk/Source/WebCore/html/canvas/CanvasStyle.cpp 2018-05-03 00:50:19 UTC (rev 231288)
@@ -53,7 +53,7 @@
Color color = CSSParser::parseColor(colorString);
if (color.isValid())
return color;
- return CSSParser::parseSystemColor(colorString, std::nullopt);
+ return CSSParser::parseSystemColor(colorString, nullptr);
}
Color currentColor(HTMLCanvasElement* canvas)
Modified: trunk/Source/WebCore/inspector/DOMEditor.cpp (231287 => 231288)
--- trunk/Source/WebCore/inspector/DOMEditor.cpp 2018-05-03 00:49:20 UTC (rev 231287)
+++ trunk/Source/WebCore/inspector/DOMEditor.cpp 2018-05-03 00:50:19 UTC (rev 231288)
@@ -266,7 +266,7 @@
ExceptionOr<void> redo() final
{
- auto result = m_element->insertAdjacentHTML(m_position, m_html, std::ref(m_addedNodes));
+ auto result = m_element->insertAdjacentHTML(m_position, m_html, &m_addedNodes);
if (result.hasException())
return result.releaseException();
return { };
Modified: trunk/Source/WebCore/platform/network/curl/CurlFormDataStream.cpp (231287 => 231288)
--- trunk/Source/WebCore/platform/network/curl/CurlFormDataStream.cpp 2018-05-03 00:49:20 UTC (rev 231287)
+++ trunk/Source/WebCore/platform/network/curl/CurlFormDataStream.cpp 2018-05-03 00:50:19 UTC (rev 231288)
@@ -69,15 +69,15 @@
}
}
-std::optional<std::reference_wrapper<const Vector<char>>> CurlFormDataStream::getPostData()
+const Vector<char>* CurlFormDataStream::getPostData()
{
if (!m_formData)
- return std::nullopt;
+ return nullptr;
if (!m_postData)
m_postData = std::make_unique<Vector<char>>(m_formData->flatten());
- return std::cref(*m_postData);
+ return m_postData.get();
}
bool CurlFormDataStream::shouldUseChunkTransfer()
Modified: trunk/Source/WebCore/platform/network/curl/CurlFormDataStream.h (231287 => 231288)
--- trunk/Source/WebCore/platform/network/curl/CurlFormDataStream.h 2018-05-03 00:49:20 UTC (rev 231287)
+++ trunk/Source/WebCore/platform/network/curl/CurlFormDataStream.h 2018-05-03 00:50:19 UTC (rev 231288)
@@ -41,7 +41,7 @@
size_t elementSize() { return m_formData ? m_formData->elements().size() : 0; }
- std::optional<std::reference_wrapper<const Vector<char>>> getPostData();
+ const Vector<char>* getPostData();
bool shouldUseChunkTransfer();
unsigned long long totalSize();
Modified: trunk/Source/WebCore/platform/network/curl/CurlRequest.cpp (231287 => 231288)
--- trunk/Source/WebCore/platform/network/curl/CurlRequest.cpp 2018-05-03 00:49:20 UTC (rev 231287)
+++ trunk/Source/WebCore/platform/network/curl/CurlRequest.cpp 2018-05-03 00:50:19 UTC (rev 231288)
@@ -489,9 +489,9 @@
// Do not stream for simple POST data
if (elementSize == 1) {
- auto postData = m_formDataStream.getPostData();
- if (postData && postData->get().size())
- m_curlHandle->setPostFields(postData->get().data(), postData->get().size());
+ const auto* postData = m_formDataStream.getPostData();
+ if (postData && postData->size())
+ m_curlHandle->setPostFields(postData->data(), postData->size());
} else
setupSendData(false);
}
Modified: trunk/Source/WebCore/testing/MockCDMFactory.cpp (231287 => 231288)
--- trunk/Source/WebCore/testing/MockCDMFactory.cpp 2018-05-03 00:49:20 UTC (rev 231287)
+++ trunk/Source/WebCore/testing/MockCDMFactory.cpp 2018-05-03 00:50:19 UTC (rev 231288)
@@ -81,12 +81,12 @@
return WTFMove(it->value);
}
-std::optional<std::reference_wrapper<const Vector<Ref<SharedBuffer>>>> MockCDMFactory::keysForSessionWithID(const String& id) const
+const Vector<Ref<SharedBuffer>>* MockCDMFactory::keysForSessionWithID(const String& id) const
{
auto it = m_sessions.find(id);
if (it == m_sessions.end())
- return std::nullopt;
- return std::cref(it->value);
+ return nullptr;
+ return &it->value;
}
void MockCDMFactory::setSupportedDataTypes(Vector<String>&& types)
@@ -314,11 +314,11 @@
std::optional<KeyStatusVector> changedKeys;
if (responseVector.contains(String(ASCIILiteral("keys-changed")))) {
- std::optional<std::reference_wrapper<const Vector<Ref<SharedBuffer>>>> keys = factory->keysForSessionWithID(sessionID);
+ const auto* keys = factory->keysForSessionWithID(sessionID);
if (keys) {
KeyStatusVector keyStatusVector;
- keyStatusVector.reserveInitialCapacity(keys->get().size());
- for (auto& key : (*keys).get())
+ keyStatusVector.reserveInitialCapacity(keys->size());
+ for (auto& key : *keys)
keyStatusVector.uncheckedAppend({ key.copyRef(), KeyStatus::Usable });
changedKeys = WTFMove(keyStatusVector);
Modified: trunk/Source/WebCore/testing/MockCDMFactory.h (231287 => 231288)
--- trunk/Source/WebCore/testing/MockCDMFactory.h 2018-05-03 00:49:20 UTC (rev 231287)
+++ trunk/Source/WebCore/testing/MockCDMFactory.h 2018-05-03 00:50:19 UTC (rev 231288)
@@ -73,7 +73,7 @@
bool hasSessionWithID(const String& id) { return m_sessions.contains(id); }
void removeSessionWithID(const String& id) { m_sessions.remove(id); }
void addKeysToSessionWithID(const String& id, Vector<Ref<SharedBuffer>>&&);
- std::optional<std::reference_wrapper<const Vector<Ref<SharedBuffer>>>> keysForSessionWithID(const String& id) const;
+ const Vector<Ref<SharedBuffer>>* keysForSessionWithID(const String& id) const;
Vector<Ref<SharedBuffer>> removeKeysFromSessionWithID(const String& id);
private: