Title: [222107] trunk/Source/WebCore
- Revision
- 222107
- Author
- commit-qu...@webkit.org
- Date
- 2017-09-15 13:09:16 -0700 (Fri, 15 Sep 2017)
Log Message
Move code using Vector::map to WTF:map
https://bugs.webkit.org/show_bug.cgi?id=176860
Patch by Youenn Fablet <you...@apple.com> on 2017-09-15
Reviewed by Jer Noble.
No change of behavior.
* loader/FormSubmission.cpp:
(WebCore::FormSubmission::create): Moving to WTF::map.
* page/Settings.cpp:
(WebCore::Settings::setMediaContentTypesRequiringHardwareSupport): Using iterator split to not create a temporary vector.
* platform/ContentType.cpp:
(WebCore::ContentType::ContentType):
(WebCore::splitParameters):
(WebCore::ContentType::codecs const): Ditto.
(WebCore::ContentType::profiles const): Ditto.
(WebCore::stripHTMLWhiteSpace): Deleted.
* platform/ContentType.h:
(WebCore::ContentType::create): Deleted.
* platform/graphics/MediaPlayer.cpp:
(WebCore::MediaPlayer::load): Minor count churning change.
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (222106 => 222107)
--- trunk/Source/WebCore/ChangeLog 2017-09-15 20:06:46 UTC (rev 222106)
+++ trunk/Source/WebCore/ChangeLog 2017-09-15 20:09:16 UTC (rev 222107)
@@ -1,5 +1,29 @@
2017-09-15 Youenn Fablet <you...@apple.com>
+ Move code using Vector::map to WTF:map
+ https://bugs.webkit.org/show_bug.cgi?id=176860
+
+ Reviewed by Jer Noble.
+
+ No change of behavior.
+
+ * loader/FormSubmission.cpp:
+ (WebCore::FormSubmission::create): Moving to WTF::map.
+ * page/Settings.cpp:
+ (WebCore::Settings::setMediaContentTypesRequiringHardwareSupport): Using iterator split to not create a temporary vector.
+ * platform/ContentType.cpp:
+ (WebCore::ContentType::ContentType):
+ (WebCore::splitParameters):
+ (WebCore::ContentType::codecs const): Ditto.
+ (WebCore::ContentType::profiles const): Ditto.
+ (WebCore::stripHTMLWhiteSpace): Deleted.
+ * platform/ContentType.h:
+ (WebCore::ContentType::create): Deleted.
+ * platform/graphics/MediaPlayer.cpp:
+ (WebCore::MediaPlayer::load): Minor count churning change.
+
+2017-09-15 Youenn Fablet <you...@apple.com>
+
MediaPlayerPrivateMediaStreamAVFObjC::requestNotificationWhenReadyForVideoData should enqueue data if still useful
https://bugs.webkit.org/show_bug.cgi?id=177016
Modified: trunk/Source/WebCore/loader/FormSubmission.cpp (222106 => 222107)
--- trunk/Source/WebCore/loader/FormSubmission.cpp 2017-09-15 20:06:46 UTC (rev 222106)
+++ trunk/Source/WebCore/loader/FormSubmission.cpp 2017-09-15 20:09:16 UTC (rev 222107)
@@ -191,8 +191,8 @@
StringPairVector formValues;
bool containsPasswordData = false;
- auto protectedAssociatedElements = form.associatedElements().map([] (FormAssociatedElement* rawElement) -> Ref<FormAssociatedElement> {
- return *rawElement;
+ auto protectedAssociatedElements = WTF::map(form.associatedElements(), [] (auto* rawElement) {
+ return Ref<FormAssociatedElement>(*rawElement);
});
for (auto& control : protectedAssociatedElements) {
Modified: trunk/Source/WebCore/page/Settings.cpp (222106 => 222107)
--- trunk/Source/WebCore/page/Settings.cpp 2017-09-15 20:06:46 UTC (rev 222106)
+++ trunk/Source/WebCore/page/Settings.cpp 2017-09-15 20:09:16 UTC (rev 222107)
@@ -798,7 +798,9 @@
void Settings::setMediaContentTypesRequiringHardwareSupport(const String& contentTypes)
{
- m_mediaContentTypesRequiringHardwareSupport = contentTypes.split(":").map(ContentType::create);
+ m_mediaContentTypesRequiringHardwareSupport.shrink(0);
+ for (auto type : StringView(contentTypes).split(':'))
+ m_mediaContentTypesRequiringHardwareSupport.append(ContentType { type.toString() });
}
void Settings::setMediaContentTypesRequiringHardwareSupport(const Vector<ContentType>& contentTypes)
Modified: trunk/Source/WebCore/platform/ContentType.cpp (222106 => 222107)
--- trunk/Source/WebCore/platform/ContentType.cpp 2017-09-15 20:06:46 UTC (rev 222106)
+++ trunk/Source/WebCore/platform/ContentType.cpp 2017-09-15 20:09:16 UTC (rev 222107)
@@ -32,6 +32,11 @@
namespace WebCore {
+ContentType::ContentType(String&& contentType)
+ : m_type(WTFMove(contentType))
+{
+}
+
ContentType::ContentType(const String& contentType)
: m_type(contentType)
{
@@ -90,19 +95,22 @@
return strippedType;
}
-static String stripHTMLWhiteSpace(const String& string)
+static inline Vector<String> splitParameters(StringView parametersView)
{
- return string.stripWhiteSpace(isHTMLSpace);
+ Vector<String> result;
+ for (auto view : parametersView.split(','))
+ result.append(view.stripLeadingAndTrailingMatchedCharacters(isHTMLSpace<UChar>).toString());
+ return result;
}
Vector<String> ContentType::codecs() const
{
- return parameter(codecsParameter()).split(',').map(stripHTMLWhiteSpace);
+ return splitParameters(parameter(codecsParameter()));
}
Vector<String> ContentType::profiles() const
{
- return parameter(profilesParameter()).split(',').map(stripHTMLWhiteSpace);
+ return splitParameters(parameter(profilesParameter()));
}
} // namespace WebCore
Modified: trunk/Source/WebCore/platform/ContentType.h (222106 => 222107)
--- trunk/Source/WebCore/platform/ContentType.h 2017-09-15 20:06:46 UTC (rev 222106)
+++ trunk/Source/WebCore/platform/ContentType.h 2017-09-15 20:09:16 UTC (rev 222107)
@@ -33,7 +33,7 @@
class ContentType {
public:
- static ContentType create(const String& type) { return ContentType(type); }
+ explicit ContentType(String&& type);
explicit ContentType(const String& type);
ContentType() = default;
Modified: trunk/Source/WebCore/platform/graphics/MediaPlayer.cpp (222106 => 222107)
--- trunk/Source/WebCore/platform/graphics/MediaPlayer.cpp 2017-09-15 20:06:46 UTC (rev 222106)
+++ trunk/Source/WebCore/platform/graphics/MediaPlayer.cpp 2017-09-15 20:09:16 UTC (rev 222107)
@@ -425,7 +425,7 @@
String extension = lastPathComponent.substring(pos + 1);
String mediaType = MIMETypeRegistry::getMediaMIMETypeForExtension(extension);
if (!mediaType.isEmpty()) {
- m_contentType = ContentType(mediaType);
+ m_contentType = ContentType { WTFMove(mediaType) };
m_contentMIMETypeWasInferredFromExtension = true;
}
}
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes