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 20 matching lines...) Expand all Loading... |
31 { | 31 { |
32 // TODO(palakj): Throw an exception if unknown operation type. | 32 // TODO(palakj): Throw an exception if unknown operation type. |
33 DCHECK_EQ(m_operationTypes.size(), static_cast<size_t>(WebIDBOperationTypeCo
unt)); | 33 DCHECK_EQ(m_operationTypes.size(), static_cast<size_t>(WebIDBOperationTypeCo
unt)); |
34 m_operationTypes.reset(); | 34 m_operationTypes.reset(); |
35 m_operationTypes[WebIDBAdd] = options.operationTypes().contains(IndexedDBNam
es::add); | 35 m_operationTypes[WebIDBAdd] = options.operationTypes().contains(IndexedDBNam
es::add); |
36 m_operationTypes[WebIDBPut] = options.operationTypes().contains(IndexedDBNam
es::put); | 36 m_operationTypes[WebIDBPut] = options.operationTypes().contains(IndexedDBNam
es::put); |
37 m_operationTypes[WebIDBDelete] = options.operationTypes().contains(IndexedDB
Names::kDelete); | 37 m_operationTypes[WebIDBDelete] = options.operationTypes().contains(IndexedDB
Names::kDelete); |
38 m_operationTypes[WebIDBClear] = options.operationTypes().contains(IndexedDBN
ames::clear); | 38 m_operationTypes[WebIDBClear] = options.operationTypes().contains(IndexedDBN
ames::clear); |
39 } | 39 } |
40 | 40 |
41 IDBObserver::~IDBObserver() {} | |
42 | |
43 void IDBObserver::observe(IDBDatabase* database, IDBTransaction* transaction, Ex
ceptionState& exceptionState) | 41 void IDBObserver::observe(IDBDatabase* database, IDBTransaction* transaction, Ex
ceptionState& exceptionState) |
44 { | 42 { |
45 if (transaction->isFinished() || transaction->isFinishing()) { | 43 if (transaction->isFinished() || transaction->isFinishing()) { |
46 exceptionState.throwDOMException(TransactionInactiveError, IDBDatabase::
transactionFinishedErrorMessage); | 44 exceptionState.throwDOMException(TransactionInactiveError, IDBDatabase::
transactionFinishedErrorMessage); |
47 return; | 45 return; |
48 } | 46 } |
49 if (!transaction->isActive()) { | 47 if (!transaction->isActive()) { |
50 exceptionState.throwDOMException(TransactionInactiveError, IDBDatabase::
transactionInactiveErrorMessage); | 48 exceptionState.throwDOMException(TransactionInactiveError, IDBDatabase::
transactionInactiveErrorMessage); |
51 return; | 49 return; |
52 } | 50 } |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 m_callback->handleChanges(*IDBObserverChanges::create(it->value, observation
s, observationIndex), *this); | 90 m_callback->handleChanges(*IDBObserverChanges::create(it->value, observation
s, observationIndex), *this); |
93 } | 91 } |
94 | 92 |
95 DEFINE_TRACE(IDBObserver) | 93 DEFINE_TRACE(IDBObserver) |
96 { | 94 { |
97 visitor->trace(m_callback); | 95 visitor->trace(m_callback); |
98 visitor->trace(m_observerIds); | 96 visitor->trace(m_observerIds); |
99 } | 97 } |
100 | 98 |
101 } // namespace blink | 99 } // namespace blink |
OLD | NEW |