Title: [218039] trunk/Source/WebCore
- Revision
- 218039
- Author
- [email protected]
- Date
- 2017-06-09 21:07:22 -0700 (Fri, 09 Jun 2017)
Log Message
Use WTF::Function instead of std::function in DataURLDecoder
https://bugs.webkit.org/show_bug.cgi?id=173194
Reviewed by Sam Weinig.
Use WTF::Function instead of std::function in DataURLDecoder to avoid copying.
* platform/network/DataURLDecoder.cpp:
(WebCore::DataURLDecoder::DecodeTask::DecodeTask):
(WebCore::DataURLDecoder::createDecodeTask):
* platform/network/DataURLDecoder.h:
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (218038 => 218039)
--- trunk/Source/WebCore/ChangeLog 2017-06-10 02:51:05 UTC (rev 218038)
+++ trunk/Source/WebCore/ChangeLog 2017-06-10 04:07:22 UTC (rev 218039)
@@ -1,3 +1,17 @@
+2017-06-09 Chris Dumez <[email protected]>
+
+ Use WTF::Function instead of std::function in DataURLDecoder
+ https://bugs.webkit.org/show_bug.cgi?id=173194
+
+ Reviewed by Sam Weinig.
+
+ Use WTF::Function instead of std::function in DataURLDecoder to avoid copying.
+
+ * platform/network/DataURLDecoder.cpp:
+ (WebCore::DataURLDecoder::DecodeTask::DecodeTask):
+ (WebCore::DataURLDecoder::createDecodeTask):
+ * platform/network/DataURLDecoder.h:
+
2017-06-09 Said Abou-Hallawa <[email protected]>
Image should clear its ImageObserver* when CachedImage releases the last reference to its RefCounted<ImageObserver>
Modified: trunk/Source/WebCore/platform/network/DataURLDecoder.cpp (218038 => 218039)
--- trunk/Source/WebCore/platform/network/DataURLDecoder.cpp 2017-06-10 02:51:05 UTC (rev 218038)
+++ trunk/Source/WebCore/platform/network/DataURLDecoder.cpp 2017-06-10 04:07:22 UTC (rev 218039)
@@ -47,6 +47,16 @@
struct DecodeTask {
WTF_MAKE_FAST_ALLOCATED;
public:
+ DecodeTask(const String& urlString, StringView&& encodedData, bool isBase64, const ScheduleContext& scheduleContext, DecodeCompletionHandler&& completionHandler, Result&& result)
+ : urlString(urlString.isolatedCopy())
+ , encodedData(WTFMove(encodedData))
+ , isBase64(isBase64)
+ , scheduleContext(scheduleContext)
+ , completionHandler(WTFMove(completionHandler))
+ , result(WTFMove(result))
+ {
+ }
+
const String urlString;
const StringView encodedData;
const bool isBase64;
@@ -134,14 +144,14 @@
bool isBase64 = header.endsWithIgnoringASCIICase(StringView(base64String));
auto mediaType = (isBase64 ? header.substring(0, header.length() - strlen(base64String)) : header).toString();
- return std::make_unique<DecodeTask>(DecodeTask {
- urlString.isolatedCopy(),
+ return std::make_unique<DecodeTask>(
+ urlString,
WTFMove(encodedData),
isBase64,
scheduleContext,
WTFMove(completionHandler),
parseMediaType(mediaType)
- });
+ );
}
static void decodeBase64(DecodeTask& task)
Modified: trunk/Source/WebCore/platform/network/DataURLDecoder.h (218038 => 218039)
--- trunk/Source/WebCore/platform/network/DataURLDecoder.h 2017-06-10 02:51:05 UTC (rev 218038)
+++ trunk/Source/WebCore/platform/network/DataURLDecoder.h 2017-06-10 04:07:22 UTC (rev 218039)
@@ -49,7 +49,7 @@
RefPtr<SharedBuffer> data;
};
-using DecodeCompletionHandler = std::function<void (std::optional<Result>)>;
+using DecodeCompletionHandler = Function<void (std::optional<Result>)>;
struct ScheduleContext {
#if HAVE(RUNLOOP_TIMER)
SchedulePairHashSet scheduledPairs;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes