| 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/IDBObserverCallback.h" | 8 #include "bindings/modules/v8/IDBObserverCallback.h" |
| 9 #include "bindings/modules/v8/ToV8ForModules.h" | 9 #include "bindings/modules/v8/ToV8ForModules.h" |
| 10 #include "bindings/modules/v8/V8BindingForModules.h" | 10 #include "bindings/modules/v8/V8BindingForModules.h" |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 } | 25 } |
| 26 | 26 |
| 27 IDBObserver::IDBObserver(ScriptState* scriptState, | 27 IDBObserver::IDBObserver(ScriptState* scriptState, |
| 28 IDBObserverCallback* callback, | 28 IDBObserverCallback* callback, |
| 29 const IDBObserverInit& options) | 29 const IDBObserverInit& options) |
| 30 : m_scriptState(scriptState), | 30 : m_scriptState(scriptState), |
| 31 m_callback(callback), | 31 m_callback(callback), |
| 32 m_transaction(options.transaction()), | 32 m_transaction(options.transaction()), |
| 33 m_values(options.values()), | 33 m_values(options.values()), |
| 34 m_noRecords(options.noRecords()) { | 34 m_noRecords(options.noRecords()) { |
| 35 // TODO(palakj): Throw an exception if unknown operation type. | |
| 36 DCHECK_EQ(m_operationTypes.size(), | 35 DCHECK_EQ(m_operationTypes.size(), |
| 37 static_cast<size_t>(WebIDBOperationTypeCount)); | 36 static_cast<size_t>(WebIDBOperationTypeCount)); |
| 38 m_operationTypes.reset(); | 37 m_operationTypes.reset(); |
| 39 m_operationTypes[WebIDBAdd] = | 38 m_operationTypes[WebIDBAdd] = |
| 40 options.operationTypes().contains(IndexedDBNames::add); | 39 options.operationTypes().contains(IndexedDBNames::add); |
| 41 m_operationTypes[WebIDBPut] = | 40 m_operationTypes[WebIDBPut] = |
| 42 options.operationTypes().contains(IndexedDBNames::put); | 41 options.operationTypes().contains(IndexedDBNames::put); |
| 43 m_operationTypes[WebIDBDelete] = | 42 m_operationTypes[WebIDBDelete] = |
| 44 options.operationTypes().contains(IndexedDBNames::kDelete); | 43 options.operationTypes().contains(IndexedDBNames::kDelete); |
| 45 m_operationTypes[WebIDBClear] = | 44 m_operationTypes[WebIDBClear] = |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 m_scriptState.get(), this, | 105 m_scriptState.get(), this, |
| 107 IDBObserverChanges::create(it->value, observations, observationIndex)); | 106 IDBObserverChanges::create(it->value, observations, observationIndex)); |
| 108 } | 107 } |
| 109 | 108 |
| 110 DEFINE_TRACE(IDBObserver) { | 109 DEFINE_TRACE(IDBObserver) { |
| 111 visitor->trace(m_callback); | 110 visitor->trace(m_callback); |
| 112 visitor->trace(m_observerIds); | 111 visitor->trace(m_observerIds); |
| 113 } | 112 } |
| 114 | 113 |
| 115 } // namespace blink | 114 } // namespace blink |
| OLD | NEW |