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" |
(...skipping 11 matching lines...) Expand all Loading... |
22 { | 22 { |
23 return new IDBObserver(callback, options); | 23 return new IDBObserver(callback, options); |
24 } | 24 } |
25 | 25 |
26 IDBObserver::IDBObserver(IDBObserverCallback& callback, const IDBObserverInit& o
ptions) | 26 IDBObserver::IDBObserver(IDBObserverCallback& callback, const IDBObserverInit& o
ptions) |
27 : m_callback(&callback) | 27 : m_callback(&callback) |
28 , m_transaction(options.transaction()) | 28 , m_transaction(options.transaction()) |
29 , m_values(options.values()) | 29 , m_values(options.values()) |
30 , m_noRecords(options.noRecords()) | 30 , m_noRecords(options.noRecords()) |
31 { | 31 { |
32 // TODO(palakj): Throw an exception if unknown operation type. | |
33 DCHECK_EQ(m_operationTypes.size(), static_cast<size_t>(WebIDBOperationTypeCo
unt)); | 32 DCHECK_EQ(m_operationTypes.size(), static_cast<size_t>(WebIDBOperationTypeCo
unt)); |
34 m_operationTypes.reset(); | 33 m_operationTypes.reset(); |
35 m_operationTypes[WebIDBAdd] = options.operationTypes().contains(IndexedDBNam
es::add); | 34 m_operationTypes[WebIDBAdd] = options.operationTypes().contains(IndexedDBNam
es::add); |
36 m_operationTypes[WebIDBPut] = options.operationTypes().contains(IndexedDBNam
es::put); | 35 m_operationTypes[WebIDBPut] = options.operationTypes().contains(IndexedDBNam
es::put); |
37 m_operationTypes[WebIDBDelete] = options.operationTypes().contains(IndexedDB
Names::kDelete); | 36 m_operationTypes[WebIDBDelete] = options.operationTypes().contains(IndexedDB
Names::kDelete); |
38 m_operationTypes[WebIDBClear] = options.operationTypes().contains(IndexedDBN
ames::clear); | 37 m_operationTypes[WebIDBClear] = options.operationTypes().contains(IndexedDBN
ames::clear); |
39 } | 38 } |
40 | 39 |
41 IDBObserver::~IDBObserver() {} | 40 IDBObserver::~IDBObserver() {} |
42 | 41 |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 m_callback->handleChanges(*IDBObserverChanges::create(it->value, observation
s, observationIndex), *this); | 91 m_callback->handleChanges(*IDBObserverChanges::create(it->value, observation
s, observationIndex), *this); |
93 } | 92 } |
94 | 93 |
95 DEFINE_TRACE(IDBObserver) | 94 DEFINE_TRACE(IDBObserver) |
96 { | 95 { |
97 visitor->trace(m_callback); | 96 visitor->trace(m_callback); |
98 visitor->trace(m_observerIds); | 97 visitor->trace(m_observerIds); |
99 } | 98 } |
100 | 99 |
101 } // namespace blink | 100 } // namespace blink |
OLD | NEW |