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

Side by Side Diff: third_party/WebKit/Source/modules/encryptedmedia/MediaKeyStatusMap.cpp

Issue 1414553002: Fix out-of-memory crashes related to ArrayBuffer allocation Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase+more tweaks Created 5 years, 1 month 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 unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "config.h" 5 #include "config.h"
6 #include "modules/encryptedmedia/MediaKeyStatusMap.h" 6 #include "modules/encryptedmedia/MediaKeyStatusMap.h"
7 7
8 #include "core/dom/DOMArrayBuffer.h" 8 #include "core/dom/DOMArrayBuffer.h"
9 #include "core/dom/DOMArrayPiece.h" 9 #include "core/dom/DOMArrayPiece.h"
10 #include "public/platform/WebData.h" 10 #include "public/platform/WebData.h"
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 // KeyIds are equal to the shared length, so the shorter string is <. 57 // KeyIds are equal to the shared length, so the shorter string is <.
58 return a->keyId()->byteLength() <= b->keyId()->byteLength(); 58 return a->keyId()->byteLength() <= b->keyId()->byteLength();
59 } 59 }
60 60
61 DEFINE_INLINE_VIRTUAL_TRACE() 61 DEFINE_INLINE_VIRTUAL_TRACE()
62 { 62 {
63 } 63 }
64 64
65 private: 65 private:
66 MapEntry(WebData keyId, const String& status) 66 MapEntry(WebData keyId, const String& status)
67 : m_keyId(DOMArrayBuffer::create(keyId.data(), keyId.size())) 67 : m_keyId(DOMArrayBuffer::deprecatedCreateOrCrash(keyId.data(), keyId.si ze()))
68 , m_status(status) 68 , m_status(status)
69 { 69 {
70 } 70 }
71 71
72 RefPtr<DOMArrayBuffer> m_keyId; 72 RefPtr<DOMArrayBuffer> m_keyId;
73 const String m_status; 73 const String m_status;
74 }; 74 };
75 75
76 // Represents an Iterator that loops through the set of MapEntrys. 76 // Represents an Iterator that loops through the set of MapEntrys.
77 class MapIterationSource final : public PairIterable<ArrayBufferOrArrayBufferVie w, String>::IterationSource { 77 class MapIterationSource final : public PairIterable<ArrayBufferOrArrayBufferVie w, String>::IterationSource {
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 } 157 }
158 return false; 158 return false;
159 } 159 }
160 160
161 DEFINE_TRACE(MediaKeyStatusMap) 161 DEFINE_TRACE(MediaKeyStatusMap)
162 { 162 {
163 visitor->trace(m_entries); 163 visitor->trace(m_entries);
164 } 164 }
165 165
166 } // namespace blink 166 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698