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

Unified Diff: Source/wtf/ArrayBuffer.cpp

Issue 19019002: Ensure that ArrayBuffers actively being used by the Web Audio API cannot be neutered (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: rebase for re-landing Created 7 years, 5 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
« no previous file with comments | « Source/modules/webaudio/AudioBuffer.cpp ('k') | Source/wtf/ArrayBufferContents.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/wtf/ArrayBuffer.cpp
diff --git a/Source/wtf/ArrayBuffer.cpp b/Source/wtf/ArrayBuffer.cpp
index 78616e1df6aa76f775ff4b583eee65321ff4db03..f3dfa2eb3d6aa0f5e0a3f921677c74bd7a57b7e2 100644
--- a/Source/wtf/ArrayBuffer.cpp
+++ b/Source/wtf/ArrayBuffer.cpp
@@ -43,12 +43,25 @@ bool ArrayBuffer::transfer(ArrayBufferContents& result, Vector<RefPtr<ArrayBuffe
return false;
}
- m_contents.transfer(result);
+ bool allViewsAreNeuterable = true;
+ for (ArrayBufferView* i = m_firstView; i; i = i->m_nextView) {
+ if (!i->isNeuterable())
+ allViewsAreNeuterable = false;
+ }
+
+ if (allViewsAreNeuterable) {
+ m_contents.transfer(result);
+ } else {
+ m_contents.copyTo(result);
+ if (!result.data())
+ return false;
+ }
while (m_firstView) {
ArrayBufferView* current = m_firstView;
removeView(current);
- current->neuter();
+ if (allViewsAreNeuterable || current->isNeuterable())
+ current->neuter();
neuteredViews.append(current);
}
« no previous file with comments | « Source/modules/webaudio/AudioBuffer.cpp ('k') | Source/wtf/ArrayBufferContents.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698