RESOLVED FIXED 206929
Make sure MediaRecorder.requestData returns data with the new writer backend
https://bugs.webkit.org/show_bug.cgi?id=206929
Summary Make sure MediaRecorder.requestData returns data with the new writer backend
youenn fablet
Reported 2020-01-29 07:15:36 PST
Make sure MediaRecorder.requestData returns data with the new writer backend
Attachments
Patch (6.35 KB, patch)
2020-01-29 07:20 PST, youenn fablet
no flags
Adding deprecation macros (6.49 KB, patch)
2020-06-15 02:29 PDT, youenn fablet
no flags
Patch for landing (6.67 KB, patch)
2020-06-16 01:02 PDT, youenn fablet
no flags
youenn fablet
Comment 1 2020-01-29 07:20:22 PST
youenn fablet
Comment 2 2020-06-15 02:02:37 PDT
*** Bug 212275 has been marked as a duplicate of this bug. ***
youenn fablet
Comment 3 2020-06-15 02:03:01 PDT
youenn fablet
Comment 4 2020-06-15 02:29:00 PDT
Created attachment 401889 [details] Adding deprecation macros
Darin Adler
Comment 5 2020-06-15 08:38:19 PDT
Comment on attachment 401889 [details] Adding deprecation macros View in context: https://bugs.webkit.org/attachment.cgi?id=401889&action=review > Source/WebCore/platform/mediarecorder/cocoa/MediaRecorderPrivateWriterCocoa.mm:489 > + ALLOW_DEPRECATED_DECLARATIONS_BEGIN > + [m_writer flush]; > + ALLOW_DEPRECATED_DECLARATIONS_END Do we have to write code using a deprecated function? What’s the long term strategy for the deprecation? Why can’t we take advantage of it now? > Source/WebCore/platform/mediarecorder/cocoa/MediaRecorderPrivateWriterCocoa.mm:496 > + RefPtr<SharedBuffer> buffer; > + if (weakThis) > + buffer = WTFMove(m_data); > + > + completionHandler(WTFMove(buffer)); How about this version? if (!weakThis) return completionHandler({ }); completionHandler(WTFMove(m_data)); Seems easier to read than the one with the local variable and double WTFMove? And has the same early exit here as above. I probably would have written it with nullptr and without using a "void return", but I figured we could stay consistent.
youenn fablet
Comment 6 2020-06-16 00:27:14 PDT
(In reply to Darin Adler from comment #5) > Comment on attachment 401889 [details] > Adding deprecation macros > > View in context: > https://bugs.webkit.org/attachment.cgi?id=401889&action=review > > > Source/WebCore/platform/mediarecorder/cocoa/MediaRecorderPrivateWriterCocoa.mm:489 > > + ALLOW_DEPRECATED_DECLARATIONS_BEGIN > > + [m_writer flush]; > > + ALLOW_DEPRECATED_DECLARATIONS_END > > Do we have to write code using a deprecated function? What’s the long term > strategy for the deprecation? Why can’t we take advantage of it now? The replacement method is not available yet everywhere. Plan is to switch at some point. > > Source/WebCore/platform/mediarecorder/cocoa/MediaRecorderPrivateWriterCocoa.mm:496 > > + RefPtr<SharedBuffer> buffer; > > + if (weakThis) > > + buffer = WTFMove(m_data); > > + > > + completionHandler(WTFMove(buffer)); > > How about this version? > > if (!weakThis) > return completionHandler({ }); > > completionHandler(WTFMove(m_data)); > > Seems easier to read than the one with the local variable and double > WTFMove? And has the same early exit here as above. I probably would have > written it with nullptr and without using a "void return", but I figured we > could stay consistent. I wrote the double move to ensure m_data gets cleared. I'll do the early return.
youenn fablet
Comment 7 2020-06-16 01:02:12 PDT
Created attachment 401986 [details] Patch for landing
youenn fablet
Comment 8 2020-06-16 01:03:30 PDT
Went with sd::exchange
EWS
Comment 9 2020-06-16 02:18:13 PDT
Committed r263084: <https://trac.webkit.org/changeset/263084> All reviewed patches have been landed. Closing bug and clearing flags on attachment 401986 [details].
Darin Adler
Comment 10 2020-06-16 09:25:10 PDT
Comment on attachment 401889 [details] Adding deprecation macros View in context: https://bugs.webkit.org/attachment.cgi?id=401889&action=review >>> Source/WebCore/platform/mediarecorder/cocoa/MediaRecorderPrivateWriterCocoa.mm:496 >>> + completionHandler(WTFMove(buffer)); >> >> How about this version? >> >> if (!weakThis) >> return completionHandler({ }); >> >> completionHandler(WTFMove(m_data)); >> >> Seems easier to read than the one with the local variable and double WTFMove? And has the same early exit here as above. I probably would have written it with nullptr and without using a "void return", but I figured we could stay consistent. > > I wrote the double move to ensure m_data gets cleared. > I'll do the early return. If you want to ensure m_data gets cleared, then we should write std::exchange(m_data, {}) instead of WTFMove(m_data).
youenn fablet
Comment 11 2020-06-16 10:02:57 PDT
(In reply to Darin Adler from comment #10) > Comment on attachment 401889 [details] > Adding deprecation macros > > View in context: > https://bugs.webkit.org/attachment.cgi?id=401889&action=review > > >>> Source/WebCore/platform/mediarecorder/cocoa/MediaRecorderPrivateWriterCocoa.mm:496 > >>> + completionHandler(WTFMove(buffer)); > >> > >> How about this version? > >> > >> if (!weakThis) > >> return completionHandler({ }); > >> > >> completionHandler(WTFMove(m_data)); > >> > >> Seems easier to read than the one with the local variable and double WTFMove? And has the same early exit here as above. I probably would have written it with nullptr and without using a "void return", but I figured we could stay consistent. > > > > I wrote the double move to ensure m_data gets cleared. > > I'll do the early return. > > If you want to ensure m_data gets cleared, then we should write > std::exchange(m_data, {}) instead of WTFMove(m_data). Yes, that is what I ended up landing.
Note You need to log in before you can comment on or make changes to this bug.