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 "bindings/core/v8/ExceptionState.h" | 7 #include "bindings/core/v8/ExceptionState.h" |
8 #include "bindings/modules/v8/ToV8ForModules.h" | 8 #include "bindings/modules/v8/ToV8ForModules.h" |
9 #include "bindings/modules/v8/V8BindingForModules.h" | 9 #include "bindings/modules/v8/V8BindingForModules.h" |
10 #include "core/dom/ExceptionCode.h" | 10 #include "core/dom/ExceptionCode.h" |
11 #include "modules/indexeddb/IDBDatabase.h" | 11 #include "modules/indexeddb/IDBDatabase.h" |
12 #include "modules/indexeddb/IDBObserverCallback.h" | 12 #include "modules/indexeddb/IDBObserverCallback.h" |
| 13 #include "modules/indexeddb/IDBObserverChanges.h" |
13 #include "modules/indexeddb/IDBObserverInit.h" | 14 #include "modules/indexeddb/IDBObserverInit.h" |
14 #include "modules/indexeddb/IDBTransaction.h" | 15 #include "modules/indexeddb/IDBTransaction.h" |
15 #include "modules/indexeddb/WebIDBObserverImpl.h" | 16 #include "modules/indexeddb/WebIDBObserverImpl.h" |
16 | 17 |
17 namespace blink { | 18 namespace blink { |
18 | 19 |
19 IDBObserver* IDBObserver::create(IDBObserverCallback& callback, const IDBObserve
rInit& options) | 20 IDBObserver* IDBObserver::create(IDBObserverCallback& callback, const IDBObserve
rInit& options) |
20 { | 21 { |
21 return new IDBObserver(callback, options); | 22 return new IDBObserver(callback, options); |
22 } | 23 } |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 } | 72 } |
72 if (!observerIdsToRemove.empty()) | 73 if (!observerIdsToRemove.empty()) |
73 database->backend()->removeObservers(observerIdsToRemove); | 74 database->backend()->removeObservers(observerIdsToRemove); |
74 } | 75 } |
75 | 76 |
76 void IDBObserver::removeObserver(int32_t id) | 77 void IDBObserver::removeObserver(int32_t id) |
77 { | 78 { |
78 m_observerIds.erase(id); | 79 m_observerIds.erase(id); |
79 } | 80 } |
80 | 81 |
| 82 void IDBObserver::onChange(const std::vector<WebIDBObservation>& observations, c
onst std::vector<int32_t>& observationIndex) |
| 83 { |
| 84 m_callback->handleEvent(*IDBObserverChanges::create(observations, observatio
nIndex), *this); |
| 85 } |
| 86 |
81 DEFINE_TRACE(IDBObserver) | 87 DEFINE_TRACE(IDBObserver) |
82 { | 88 { |
83 visitor->trace(m_callback); | 89 visitor->trace(m_callback); |
84 } | 90 } |
85 | 91 |
86 } // namespace blink | 92 } // namespace blink |
OLD | NEW |