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

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

Issue 1878463002: Move DOMArrayBuffer, DOMArrayBufferViews and DataView to the heap. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: tidy Created 4 years, 8 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 55cd354377b24372d7ce1b3f91be4664b868dafe..975a4429adb15685802b0bc88ec3198ebda64897 100644
--- a/third_party/WebKit/Source/modules/encryptedmedia/MediaKeySession.cpp
+++ b/third_party/WebKit/Source/modules/encryptedmedia/MediaKeySession.cpp
@@ -136,7 +136,7 @@ public:
return m_result;
}
- const PassRefPtr<DOMArrayBuffer> data() const
+ DOMArrayBuffer* data() const
{
ASSERT(m_type == GenerateRequest || m_type == Update);
return m_data;
@@ -154,7 +154,7 @@ public:
return m_stringData;
}
- static PendingAction* CreatePendingGenerateRequest(ContentDecryptionModuleResult* result, WebEncryptedMediaInitDataType initDataType, PassRefPtr<DOMArrayBuffer> initData)
+ static PendingAction* CreatePendingGenerateRequest(ContentDecryptionModuleResult* result, WebEncryptedMediaInitDataType initDataType, DOMArrayBuffer* initData)
{
ASSERT(result);
ASSERT(initData);
@@ -164,10 +164,10 @@ public:
static PendingAction* CreatePendingLoadRequest(ContentDecryptionModuleResult* result, const String& sessionId)
{
ASSERT(result);
- return new PendingAction(Load, result, WebEncryptedMediaInitDataType::Unknown, PassRefPtr<DOMArrayBuffer>(), sessionId);
+ return new PendingAction(Load, result, WebEncryptedMediaInitDataType::Unknown, nullptr, sessionId);
}
- static PendingAction* CreatePendingUpdate(ContentDecryptionModuleResult* result, PassRefPtr<DOMArrayBuffer> data)
+ static PendingAction* CreatePendingUpdate(ContentDecryptionModuleResult* result, DOMArrayBuffer* data)
{
ASSERT(result);
ASSERT(data);
@@ -177,13 +177,13 @@ public:
static PendingAction* CreatePendingClose(ContentDecryptionModuleResult* result)
{
ASSERT(result);
- return new PendingAction(Close, result, WebEncryptedMediaInitDataType::Unknown, PassRefPtr<DOMArrayBuffer>(), String());
+ return new PendingAction(Close, result, WebEncryptedMediaInitDataType::Unknown, nullptr, String());
}
static PendingAction* CreatePendingRemove(ContentDecryptionModuleResult* result)
{
ASSERT(result);
- return new PendingAction(Remove, result, WebEncryptedMediaInitDataType::Unknown, PassRefPtr<DOMArrayBuffer>(), String());
+ return new PendingAction(Remove, result, WebEncryptedMediaInitDataType::Unknown, nullptr, String());
}
~PendingAction()
@@ -193,10 +193,11 @@ public:
DEFINE_INLINE_TRACE()
{
visitor->trace(m_result);
+ visitor->trace(m_data);
}
private:
- PendingAction(Type type, ContentDecryptionModuleResult* result, WebEncryptedMediaInitDataType initDataType, PassRefPtr<DOMArrayBuffer> data, const String& stringData)
+ PendingAction(Type type, ContentDecryptionModuleResult* result, WebEncryptedMediaInitDataType initDataType, DOMArrayBuffer* data, const String& stringData)
: m_type(type)
, m_result(result)
, m_initDataType(initDataType)
@@ -208,7 +209,7 @@ private:
const Type m_type;
const Member<ContentDecryptionModuleResult> m_result;
const WebEncryptedMediaInitDataType m_initDataType;
- const RefPtr<DOMArrayBuffer> m_data;
+ const Member<DOMArrayBuffer> m_data;
const String m_stringData;
};
@@ -433,7 +434,7 @@ ScriptPromise MediaKeySession::generateRequest(ScriptState* scriptState, const S
}
// 6. Let init data be a copy of the contents of the initData parameter.
- RefPtr<DOMArrayBuffer> initDataBuffer = DOMArrayBuffer::create(initData.data(), initData.byteLength());
+ DOMArrayBuffer* initDataBuffer = DOMArrayBuffer::create(initData.data(), initData.byteLength());
// 7. Let session type be this object's session type.
// (Done in constructor.)
@@ -444,7 +445,7 @@ ScriptPromise MediaKeySession::generateRequest(ScriptState* scriptState, const S
// 9. Run the following steps asynchronously (documented in
// actionTimerFired())
- m_pendingActions.append(PendingAction::CreatePendingGenerateRequest(result, initDataType, initDataBuffer.release()));
+ m_pendingActions.append(PendingAction::CreatePendingGenerateRequest(result, initDataType, initDataBuffer));
ASSERT(!m_actionTimer.isActive());
m_actionTimer.startOneShot(0, BLINK_FROM_HERE);
@@ -528,7 +529,7 @@ ScriptPromise MediaKeySession::update(ScriptState* scriptState, const DOMArrayPi
}
// 3. Let response copy be a copy of the contents of the response parameter.
- RefPtr<DOMArrayBuffer> responseCopy = DOMArrayBuffer::create(response.data(), response.byteLength());
+ DOMArrayBuffer* responseCopy = DOMArrayBuffer::create(response.data(), response.byteLength());
// 4. Let promise be a new promise.
SimpleContentDecryptionModuleResultPromise* result = new SimpleContentDecryptionModuleResultPromise(scriptState);
@@ -536,7 +537,7 @@ ScriptPromise MediaKeySession::update(ScriptState* scriptState, const DOMArrayPi
// 5. Run the following steps asynchronously (documented in
// actionTimerFired())
- m_pendingActions.append(PendingAction::CreatePendingUpdate(result, responseCopy.release()));
+ m_pendingActions.append(PendingAction::CreatePendingUpdate(result, responseCopy));
if (!m_actionTimer.isActive())
m_actionTimer.startOneShot(0, BLINK_FROM_HERE);

Powered by Google App Engine
This is Rietveld 408576698