Modified: trunk/Source/WebCore/Modules/encryptedmedia/MediaKeySession.cpp (223152 => 223153)
--- trunk/Source/WebCore/Modules/encryptedmedia/MediaKeySession.cpp 2017-10-10 22:59:08 UTC (rev 223152)
+++ trunk/Source/WebCore/Modules/encryptedmedia/MediaKeySession.cpp 2017-10-10 22:59:39 UTC (rev 223153)
@@ -141,7 +141,7 @@
// 8. Let session type be this object's session type.
// 9. Let promise be a new promise.
// 10. Run the following steps in parallel:
- m_taskQueue.enqueueTask([this, weakThis = m_weakPtrFactory.createWeakPtr(*this), initData = SharedBuffer::create(initData.data(), initData.length()), initDataType, promise = WTFMove(promise)] () mutable {
+ m_taskQueue.enqueueTask([this, initData = SharedBuffer::create(initData.data(), initData.length()), initDataType, promise = WTFMove(promise)] () mutable {
// 10.1. If the init data is not valid for initDataType, reject promise with a newly created TypeError.
// 10.2. Let sanitized init data be a validated and sanitized version of init data.
RefPtr<SharedBuffer> sanitizedInitData = m_implementation->sanitizeInitData(initDataType, initData);
@@ -188,7 +188,7 @@
m_latestDecryptTime = 0;
}
- m_instance->requestLicense(m_sessionType, initDataType, WTFMove(initData), [this, weakThis, promise = WTFMove(promise)] (Ref<SharedBuffer>&& message, const String& sessionId, bool needsIndividualization, CDMInstance::SuccessValue succeeded) mutable {
+ m_instance->requestLicense(m_sessionType, initDataType, WTFMove(initData), [this, weakThis = m_weakPtrFactory.createWeakPtr(*this), promise = WTFMove(promise)] (Ref<SharedBuffer>&& message, const String& sessionId, bool needsIndividualization, CDMInstance::SuccessValue succeeded) mutable {
if (!weakThis)
return;
@@ -281,7 +281,7 @@
// 8.6. Let message type be null.
// 8.7. Let cdm be the CDM instance represented by this object's cdm instance value.
// 8.8. Use the cdm to execute the following steps:
- m_instance->loadSession(m_sessionType, *sanitizedSessionId, origin, [this, promise = WTFMove(promise), sanitizedSessionId = *sanitizedSessionId] (std::optional<CDMInstance::KeyStatusVector>&& knownKeys, std::optional<double>&& expiration, std::optional<CDMInstance::Message>&& message, CDMInstance::SuccessValue succeeded, CDMInstance::SessionLoadFailure failure) mutable {
+ m_instance->loadSession(m_sessionType, *sanitizedSessionId, origin, [this, weakThis = m_weakPtrFactory.createWeakPtr(*this), promise = WTFMove(promise), sanitizedSessionId = *sanitizedSessionId] (std::optional<CDMInstance::KeyStatusVector>&& knownKeys, std::optional<double>&& expiration, std::optional<CDMInstance::Message>&& message, CDMInstance::SuccessValue succeeded, CDMInstance::SessionLoadFailure failure) mutable {
// 8.8.1. If there is no data stored for the sanitized session ID in the origin, resolve promise with false and abort these steps.
// 8.8.2. If the stored session's session type is not the same as the current MediaKeySession session type, reject promise with a newly created TypeError.
// 8.8.3. Let session data be the data stored for the sanitized session ID in the origin. This must not include data from other origin(s) or that is not associated with an origin.
@@ -312,7 +312,7 @@
}
// 8.9. Queue a task to run the following steps:
- m_taskQueue.enqueueTask([this, knownKeys = WTFMove(knownKeys), expiration = WTFMove(expiration), message = WTFMove(message), sanitizedSessionId = sanitizedSessionId, succeeded, promise = WTFMove(promise)] () mutable {
+ m_taskQueue.enqueueTask([this, knownKeys = WTFMove(knownKeys), expiration = WTFMove(expiration), message = WTFMove(message), sanitizedSessionId, succeeded, promise = WTFMove(promise)] () mutable {
// 8.9.1. If any of the preceding steps failed, reject promise with a the appropriate error name.
if (succeeded == CDMInstance::SuccessValue::Failed) {
promise->reject(NotSupportedError);
@@ -367,7 +367,7 @@
// 4. Let response copy be a copy of the contents of the response parameter.
// 5. Let promise be a new promise.
// 6. Run the following steps in parallel:
- m_taskQueue.enqueueTask([this, weakThis = m_weakPtrFactory.createWeakPtr(*this), response = SharedBuffer::create(response.data(), response.length()), promise = WTFMove(promise)] () mutable {
+ m_taskQueue.enqueueTask([this, response = SharedBuffer::create(response.data(), response.length()), promise = WTFMove(promise)] () mutable {
// 6.1. Let sanitized response be a validated and/or sanitized version of response copy.
RefPtr<SharedBuffer> sanitizedResponse = m_implementation->sanitizeResponse(response);
@@ -382,7 +382,7 @@
// 6.5. Let session closed be false.
// 6.6. Let cdm be the CDM instance represented by this object's cdm instance value.
// 6.7. Use the cdm to execute the following steps:
- m_instance->updateLicense(m_sessionId, m_sessionType, *sanitizedResponse, [this, weakThis, promise = WTFMove(promise)](bool sessionWasClosed, std::optional<CDMInstance::KeyStatusVector>&& changedKeys, std::optional<double>&& changedExpiration, std::optional<CDMInstance::Message>&& message, CDMInstance::SuccessValue succeeded) mutable {
+ m_instance->updateLicense(m_sessionId, m_sessionType, *sanitizedResponse, [this, weakThis = m_weakPtrFactory.createWeakPtr(*this), promise = WTFMove(promise)] (bool sessionWasClosed, std::optional<CDMInstance::KeyStatusVector>&& changedKeys, std::optional<double>&& changedExpiration, std::optional<CDMInstance::Message>&& message, CDMInstance::SuccessValue succeeded) mutable {
if (!weakThis)
return;
@@ -491,10 +491,10 @@
// 4. Let promise be a new promise.
// 5. Run the following steps in parallel:
- m_taskQueue.enqueueTask([this, weakThis = m_weakPtrFactory.createWeakPtr(*this), promise = WTFMove(promise)] () mutable {
+ m_taskQueue.enqueueTask([this, promise = WTFMove(promise)] () mutable {
// 5.1. Let cdm be the CDM instance represented by session's cdm instance value.
// 5.2. Use cdm to close the key session associated with session.
- m_instance->closeSession(m_sessionId, [this, weakThis, promise = WTFMove(promise)] () mutable {
+ m_instance->closeSession(m_sessionId, [this, weakThis = m_weakPtrFactory.createWeakPtr(*this), promise = WTFMove(promise)] () mutable {
if (!weakThis)
return;
@@ -526,13 +526,13 @@
// 3. Let promise be a new promise.
// 4. Run the following steps in parallel:
- m_taskQueue.enqueueTask([this, weakThis = m_weakPtrFactory.createWeakPtr(*this), promise = WTFMove(promise)] () mutable {
+ m_taskQueue.enqueueTask([this, promise = WTFMove(promise)] () mutable {
// 4.1. Let cdm be the CDM instance represented by this object's cdm instance value.
// 4.2. Let message be null.
// 4.3. Let message type be null.
// 4.4. Use the cdm to execute the following steps:
- m_instance->removeSessionData(m_sessionId, m_sessionType, [this, weakThis, promise = WTFMove(promise)] (CDMInstance::KeyStatusVector&& keys, std::optional<Ref<SharedBuffer>>&& message, CDMInstance::SuccessValue succeeded) mutable {
+ m_instance->removeSessionData(m_sessionId, m_sessionType, [this, weakThis = m_weakPtrFactory.createWeakPtr(*this), promise = WTFMove(promise)] (CDMInstance::KeyStatusVector&& keys, std::optional<Ref<SharedBuffer>>&& message, CDMInstance::SuccessValue succeeded) mutable {
if (!weakThis)
return;
Modified: trunk/Source/WebCore/platform/encryptedmedia/clearkey/CDMClearKey.cpp (223152 => 223153)
--- trunk/Source/WebCore/platform/encryptedmedia/clearkey/CDMClearKey.cpp 2017-10-10 22:59:08 UTC (rev 223152)
+++ trunk/Source/WebCore/platform/encryptedmedia/clearkey/CDMClearKey.cpp 2017-10-10 22:59:39 UTC (rev 223153)
@@ -354,9 +354,9 @@
// Use a helper functor that schedules the callback dispatch, avoiding
// duplicated callOnMainThread() calls.
auto dispatchCallback =
- [this, weakThis = m_weakPtrFactory.createWeakPtr(*this), &callback](bool sessionWasClosed, std::optional<KeyStatusVector>&& changedKeys, SuccessValue succeeded) {
+ [this, &callback](bool sessionWasClosed, std::optional<KeyStatusVector>&& changedKeys, SuccessValue succeeded) {
callOnMainThread(
- [weakThis, callback = WTFMove(callback), sessionWasClosed, changedKeys = WTFMove(changedKeys), succeeded] () mutable {
+ [weakThis = m_weakPtrFactory.createWeakPtr(*this), callback = WTFMove(callback), sessionWasClosed, changedKeys = WTFMove(changedKeys), succeeded] () mutable {
if (!weakThis)
return;
@@ -458,9 +458,9 @@
{
// Use a helper functor that schedules the callback dispatch, avoiding duplicated callOnMainThread() calls.
auto dispatchCallback =
- [this, weakThis = m_weakPtrFactory.createWeakPtr(*this), &callback](std::optional<KeyStatusVector>&& existingKeys, SuccessValue success, SessionLoadFailure loadFailure) {
+ [this, &callback](std::optional<KeyStatusVector>&& existingKeys, SuccessValue success, SessionLoadFailure loadFailure) {
callOnMainThread(
- [weakThis, callback = WTFMove(callback), existingKeys = WTFMove(existingKeys), success, loadFailure]() mutable {
+ [weakThis = m_weakPtrFactory.createWeakPtr(*this), callback = WTFMove(callback), existingKeys = WTFMove(existingKeys), success, loadFailure]() mutable {
if (!weakThis)
return;
@@ -502,9 +502,9 @@
{
// Use a helper functor that schedules the callback dispatch, avoiding duplicated callOnMainThread() calls.
auto dispatchCallback =
- [this, weakThis = m_weakPtrFactory.createWeakPtr(*this), &callback](KeyStatusVector&& keyStatusVector, std::optional<Ref<SharedBuffer>>&& message, SuccessValue success) {
+ [this, &callback](KeyStatusVector&& keyStatusVector, std::optional<Ref<SharedBuffer>>&& message, SuccessValue success) {
callOnMainThread(
- [weakThis, callback = WTFMove(callback), keyStatusVector = WTFMove(keyStatusVector), message = WTFMove(message), success]() mutable {
+ [weakThis = m_weakPtrFactory.createWeakPtr(*this), callback = WTFMove(callback), keyStatusVector = WTFMove(keyStatusVector), message = WTFMove(message), success]() mutable {
if (!weakThis)
return;