Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(806)

Unified Diff: third_party/WebKit/Source/modules/encryptedmedia/MediaKeySession.cpp

Issue 1964183004: Revert of Move DOMArrayBuffer, DOMArrayBufferViews and DataView to the heap. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/modules/encryptedmedia/MediaKeySession.cpp
diff --git a/third_party/WebKit/Source/modules/encryptedmedia/MediaKeySession.cpp b/third_party/WebKit/Source/modules/encryptedmedia/MediaKeySession.cpp
index 975a4429adb15685802b0bc88ec3198ebda64897..55cd354377b24372d7ce1b3f91be4664b868dafe 100644
--- a/third_party/WebKit/Source/modules/encryptedmedia/MediaKeySession.cpp
+++ b/third_party/WebKit/Source/modules/encryptedmedia/MediaKeySession.cpp
@@ -136,7 +136,7 @@
return m_result;
}
- DOMArrayBuffer* data() const
+ const PassRefPtr<DOMArrayBuffer> data() const
{
ASSERT(m_type == GenerateRequest || m_type == Update);
return m_data;
@@ -154,7 +154,7 @@
return m_stringData;
}
- static PendingAction* CreatePendingGenerateRequest(ContentDecryptionModuleResult* result, WebEncryptedMediaInitDataType initDataType, DOMArrayBuffer* initData)
+ static PendingAction* CreatePendingGenerateRequest(ContentDecryptionModuleResult* result, WebEncryptedMediaInitDataType initDataType, PassRefPtr<DOMArrayBuffer> initData)
{
ASSERT(result);
ASSERT(initData);
@@ -164,10 +164,10 @@
static PendingAction* CreatePendingLoadRequest(ContentDecryptionModuleResult* result, const String& sessionId)
{
ASSERT(result);
- return new PendingAction(Load, result, WebEncryptedMediaInitDataType::Unknown, nullptr, sessionId);
- }
-
- static PendingAction* CreatePendingUpdate(ContentDecryptionModuleResult* result, DOMArrayBuffer* data)
+ return new PendingAction(Load, result, WebEncryptedMediaInitDataType::Unknown, PassRefPtr<DOMArrayBuffer>(), sessionId);
+ }
+
+ static PendingAction* CreatePendingUpdate(ContentDecryptionModuleResult* result, PassRefPtr<DOMArrayBuffer> data)
{
ASSERT(result);
ASSERT(data);
@@ -177,13 +177,13 @@
static PendingAction* CreatePendingClose(ContentDecryptionModuleResult* result)
{
ASSERT(result);
- return new PendingAction(Close, result, WebEncryptedMediaInitDataType::Unknown, nullptr, String());
+ return new PendingAction(Close, result, WebEncryptedMediaInitDataType::Unknown, PassRefPtr<DOMArrayBuffer>(), String());
}
static PendingAction* CreatePendingRemove(ContentDecryptionModuleResult* result)
{
ASSERT(result);
- return new PendingAction(Remove, result, WebEncryptedMediaInitDataType::Unknown, nullptr, String());
+ return new PendingAction(Remove, result, WebEncryptedMediaInitDataType::Unknown, PassRefPtr<DOMArrayBuffer>(), String());
}
~PendingAction()
@@ -193,11 +193,10 @@
DEFINE_INLINE_TRACE()
{
visitor->trace(m_result);
- visitor->trace(m_data);
}
private:
- PendingAction(Type type, ContentDecryptionModuleResult* result, WebEncryptedMediaInitDataType initDataType, DOMArrayBuffer* data, const String& stringData)
+ PendingAction(Type type, ContentDecryptionModuleResult* result, WebEncryptedMediaInitDataType initDataType, PassRefPtr<DOMArrayBuffer> data, const String& stringData)
: m_type(type)
, m_result(result)
, m_initDataType(initDataType)
@@ -209,7 +208,7 @@
const Type m_type;
const Member<ContentDecryptionModuleResult> m_result;
const WebEncryptedMediaInitDataType m_initDataType;
- const Member<DOMArrayBuffer> m_data;
+ const RefPtr<DOMArrayBuffer> m_data;
const String m_stringData;
};
@@ -434,7 +433,7 @@
}
// 6. Let init data be a copy of the contents of the initData parameter.
- DOMArrayBuffer* initDataBuffer = DOMArrayBuffer::create(initData.data(), initData.byteLength());
+ RefPtr<DOMArrayBuffer> initDataBuffer = DOMArrayBuffer::create(initData.data(), initData.byteLength());
// 7. Let session type be this object's session type.
// (Done in constructor.)
@@ -445,7 +444,7 @@
// 9. Run the following steps asynchronously (documented in
// actionTimerFired())
- m_pendingActions.append(PendingAction::CreatePendingGenerateRequest(result, initDataType, initDataBuffer));
+ m_pendingActions.append(PendingAction::CreatePendingGenerateRequest(result, initDataType, initDataBuffer.release()));
ASSERT(!m_actionTimer.isActive());
m_actionTimer.startOneShot(0, BLINK_FROM_HERE);
@@ -529,7 +528,7 @@
}
// 3. Let response copy be a copy of the contents of the response parameter.
- DOMArrayBuffer* responseCopy = DOMArrayBuffer::create(response.data(), response.byteLength());
+ RefPtr<DOMArrayBuffer> responseCopy = DOMArrayBuffer::create(response.data(), response.byteLength());
// 4. Let promise be a new promise.
SimpleContentDecryptionModuleResultPromise* result = new SimpleContentDecryptionModuleResultPromise(scriptState);
@@ -537,7 +536,7 @@
// 5. Run the following steps asynchronously (documented in
// actionTimerFired())
- m_pendingActions.append(PendingAction::CreatePendingUpdate(result, responseCopy));
+ m_pendingActions.append(PendingAction::CreatePendingUpdate(result, responseCopy.release()));
if (!m_actionTimer.isActive())
m_actionTimer.startOneShot(0, BLINK_FROM_HERE);

Powered by Google App Engine
This is Rietveld 408576698