Changeset 252878 in webkit
- Timestamp:
- Nov 26, 2019 12:30:42 AM (4 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r252875 r252878 1 2019-11-26 youenn fablet <youenn@apple.com> 2 3 Queuing a task in EventLoop is not working with UserMediaRequest allow completion handler 4 Queuing a task in EventLoop is not working with completion handlers 5 https://bugs.webkit.org/show_bug.cgi?id=204565 6 <rdar://problem/57466280> 7 8 Reviewed by Ryosuke Niwa. 9 10 Do not capture the completion handler in lambda passed to the event queue. 11 Instead, keep it in UserMediqRequest and call it either when running the task or when destroying UserMediaRequest. 12 Covered by existing tests failing the debug assertion. 13 14 * Modules/mediastream/UserMediaRequest.cpp: 15 (WebCore::UserMediaRequest::~UserMediaRequest): 16 (WebCore::UserMediaRequest::allow): 17 * Modules/mediastream/UserMediaRequest.h: 18 1 19 2019-11-25 Yusuke Suzuki <ysuzuki@apple.com> 2 20 -
trunk/Source/WebCore/Modules/mediastream/UserMediaRequest.cpp
r252497 r252878 68 68 } 69 69 70 UserMediaRequest::~UserMediaRequest() = default; 70 UserMediaRequest::~UserMediaRequest() 71 { 72 if (m_allowCompletionHandler) 73 m_allowCompletionHandler(); 74 } 71 75 72 76 SecurityOrigin* UserMediaRequest::userMediaDocumentOrigin() const … … 231 235 { 232 236 RELEASE_LOG(MediaStream, "UserMediaRequest::allow %s %s", audioDevice ? audioDevice.persistentId().utf8().data() : "", videoDevice ? videoDevice.persistentId().utf8().data() : ""); 233 234 queueTaskKeepingObjectAlive(*this, TaskSource::UserInteraction, [this, audioDevice = WTFMove(audioDevice), videoDevice = WTFMove(videoDevice), deviceIdentifierHashSalt = WTFMove(deviceIdentifierHashSalt) , completionHandler = WTFMove(completionHandler)]() mutable {235 auto callback = [this, protector = makePendingActivity(*this) , completionHandler = WTFMove(completionHandler)](RefPtr<MediaStreamPrivate>&& privateStream) mutable {236 auto scopeExit = makeScopeExit([completionHandler = WTFMove( completionHandler)]() mutable {237 m_allowCompletionHandler = WTFMove(completionHandler); 238 queueTaskKeepingObjectAlive(*this, TaskSource::UserInteraction, [this, audioDevice = WTFMove(audioDevice), videoDevice = WTFMove(videoDevice), deviceIdentifierHashSalt = WTFMove(deviceIdentifierHashSalt)]() mutable { 239 auto callback = [this, protector = makePendingActivity(*this)](RefPtr<MediaStreamPrivate>&& privateStream) mutable { 240 auto scopeExit = makeScopeExit([completionHandler = WTFMove(m_allowCompletionHandler)]() mutable { 237 241 completionHandler(); 238 242 }); -
trunk/Source/WebCore/Modules/mediastream/UserMediaRequest.h
r251746 r252878 95 95 96 96 UniqueRef<DOMPromiseDeferred<IDLInterface<MediaStream>>> m_promise; 97 CompletionHandler<void()> m_allowCompletionHandler; 97 98 MediaStreamRequest m_request; 98 99 };
Note: See TracChangeset
for help on using the changeset viewer.