| OLD | NEW |
| 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 "modules/encryptedmedia/MediaKeyStatusMap.h" | 5 #include "modules/encryptedmedia/MediaKeyStatusMap.h" |
| 6 | 6 |
| 7 #include "core/dom/DOMArrayBuffer.h" | 7 #include "core/dom/DOMArrayBuffer.h" |
| 8 #include "core/dom/DOMArrayPiece.h" | 8 #include "core/dom/DOMArrayPiece.h" |
| 9 #include "public/platform/WebData.h" | 9 #include "public/platform/WebData.h" |
| 10 #include "wtf/text/WTFString.h" | 10 #include "wtf/text/WTFString.h" |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 // No need to do any sorting for the first entry. | 119 // No need to do any sorting for the first entry. |
| 120 if (m_entries.size() == 1) | 120 if (m_entries.size() == 1) |
| 121 return; | 121 return; |
| 122 | 122 |
| 123 // Sort the entries. | 123 // Sort the entries. |
| 124 std::sort(m_entries.begin(), m_entries.end(), MapEntry::compareLessThan); | 124 std::sort(m_entries.begin(), m_entries.end(), MapEntry::compareLessThan); |
| 125 } | 125 } |
| 126 | 126 |
| 127 const MediaKeyStatusMap::MapEntry& MediaKeyStatusMap::at(size_t index) const | 127 const MediaKeyStatusMap::MapEntry& MediaKeyStatusMap::at(size_t index) const |
| 128 { | 128 { |
| 129 BLINK_ASSERT(index < m_entries.size()); | 129 DCHECK_LT(index, m_entries.size()); |
| 130 return *m_entries.at(index); | 130 return *m_entries.at(index); |
| 131 } | 131 } |
| 132 | 132 |
| 133 size_t MediaKeyStatusMap::indexOf(const DOMArrayPiece& key) const | 133 size_t MediaKeyStatusMap::indexOf(const DOMArrayPiece& key) const |
| 134 { | 134 { |
| 135 for (size_t index = 0; index < m_entries.size(); ++index) { | 135 for (size_t index = 0; index < m_entries.size(); ++index) { |
| 136 const auto& current = m_entries.at(index)->keyId(); | 136 const auto& current = m_entries.at(index)->keyId(); |
| 137 if (key == *current) | 137 if (key == *current) |
| 138 return index; | 138 return index; |
| 139 } | 139 } |
| (...skipping 16 matching lines...) Expand all Loading... |
| 156 } | 156 } |
| 157 return false; | 157 return false; |
| 158 } | 158 } |
| 159 | 159 |
| 160 DEFINE_TRACE(MediaKeyStatusMap) | 160 DEFINE_TRACE(MediaKeyStatusMap) |
| 161 { | 161 { |
| 162 visitor->trace(m_entries); | 162 visitor->trace(m_entries); |
| 163 } | 163 } |
| 164 | 164 |
| 165 } // namespace blink | 165 } // namespace blink |
| OLD | NEW |