OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/indexeddb/IDBObserver.h" | 5 #include "modules/indexeddb/IDBObserver.h" |
6 | 6 |
7 #include <bitset> | 7 #include <bitset> |
8 | 8 |
9 #include "bindings/core/v8/ExceptionState.h" | 9 #include "bindings/core/v8/ExceptionState.h" |
10 #include "bindings/modules/v8/IDBObserverCallback.h" | 10 #include "bindings/modules/v8/IDBObserverCallback.h" |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 ExceptionState& exceptionState) { | 82 ExceptionState& exceptionState) { |
83 if (!database->backend()) { | 83 if (!database->backend()) { |
84 exceptionState.throwDOMException(InvalidStateError, | 84 exceptionState.throwDOMException(InvalidStateError, |
85 IDBDatabase::databaseClosedErrorMessage); | 85 IDBDatabase::databaseClosedErrorMessage); |
86 return; | 86 return; |
87 } | 87 } |
88 | 88 |
89 Vector<int32_t> observerIdsToRemove; | 89 Vector<int32_t> observerIdsToRemove; |
90 for (const auto& it : m_observerIds) { | 90 for (const auto& it : m_observerIds) { |
91 if (it.value == database) | 91 if (it.value == database) |
92 observerIdsToRemove.append(it.key); | 92 observerIdsToRemove.push_back(it.key); |
93 } | 93 } |
94 m_observerIds.removeAll(observerIdsToRemove); | 94 m_observerIds.removeAll(observerIdsToRemove); |
95 | 95 |
96 if (!observerIdsToRemove.isEmpty()) | 96 if (!observerIdsToRemove.isEmpty()) |
97 database->removeObservers(observerIdsToRemove); | 97 database->removeObservers(observerIdsToRemove); |
98 } | 98 } |
99 | 99 |
100 DEFINE_TRACE(IDBObserver) { | 100 DEFINE_TRACE(IDBObserver) { |
101 visitor->trace(m_callback); | 101 visitor->trace(m_callback); |
102 visitor->trace(m_observerIds); | 102 visitor->trace(m_observerIds); |
103 } | 103 } |
104 | 104 |
105 } // namespace blink | 105 } // namespace blink |
OLD | NEW |