| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "modules/indexeddb/WebIDBObserverImpl.h" | |
| 6 | |
| 7 #include "wtf/PtrUtil.h" | |
| 8 | |
| 9 namespace blink { | |
| 10 | |
| 11 // static | |
| 12 std::unique_ptr<WebIDBObserverImpl> WebIDBObserverImpl::create( | |
| 13 IDBObserver* observer, | |
| 14 bool transaction, | |
| 15 bool values, | |
| 16 bool noRecords, | |
| 17 std::bitset<WebIDBOperationTypeCount> operationTypes) { | |
| 18 return wrapUnique(new WebIDBObserverImpl(observer, transaction, values, | |
| 19 noRecords, operationTypes)); | |
| 20 } | |
| 21 | |
| 22 WebIDBObserverImpl::WebIDBObserverImpl( | |
| 23 IDBObserver* observer, | |
| 24 bool transaction, | |
| 25 bool values, | |
| 26 bool noRecords, | |
| 27 std::bitset<WebIDBOperationTypeCount> operationTypes) | |
| 28 : m_id(kInvalidObserverId), | |
| 29 m_transaction(transaction), | |
| 30 m_values(values), | |
| 31 m_noRecords(noRecords), | |
| 32 m_operationTypes(operationTypes), | |
| 33 m_observer(observer) {} | |
| 34 | |
| 35 // Remove observe call id from IDBObserver. | |
| 36 WebIDBObserverImpl::~WebIDBObserverImpl() { | |
| 37 if (m_id != kInvalidObserverId) | |
| 38 m_observer->removeObserver(m_id); | |
| 39 } | |
| 40 | |
| 41 void WebIDBObserverImpl::setId(int32_t id) { | |
| 42 DCHECK_EQ(kInvalidObserverId, m_id); | |
| 43 m_id = id; | |
| 44 } | |
| 45 | |
| 46 void WebIDBObserverImpl::onChange( | |
| 47 const WebVector<WebIDBObservation>& observations, | |
| 48 const WebVector<int32_t>& observationIndex) { | |
| 49 m_observer->onChange(m_id, observations, std::move(observationIndex)); | |
| 50 } | |
| 51 | |
| 52 } // namespace blink | |
| OLD | NEW |