Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3)

Side by Side Diff: third_party/WebKit/Source/modules/indexeddb/WebIDBObserverImpl.cpp

Issue 2459113002: [IDBObservers] Moving options from constructor to .observe call. (Closed)
Patch Set: change bitset to pass by value Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « third_party/WebKit/Source/modules/indexeddb/WebIDBObserverImpl.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/WebIDBObserverImpl.h" 5 #include "modules/indexeddb/WebIDBObserverImpl.h"
6 6
7 #include "wtf/PtrUtil.h" 7 #include "wtf/PtrUtil.h"
8 8
9 namespace blink { 9 namespace blink {
10 10
11 // static 11 // static
12 std::unique_ptr<WebIDBObserverImpl> WebIDBObserverImpl::create( 12 std::unique_ptr<WebIDBObserverImpl> WebIDBObserverImpl::create(
13 IDBObserver* observer) { 13 IDBObserver* observer,
14 return wrapUnique(new WebIDBObserverImpl(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));
15 } 20 }
16 21
17 WebIDBObserverImpl::WebIDBObserverImpl(IDBObserver* observer) 22 WebIDBObserverImpl::WebIDBObserverImpl(
18 : m_id(kInvalidObserverId), m_observer(observer) {} 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) {}
19 34
20 // Remove observe call id from IDBObserver. 35 // Remove observe call id from IDBObserver.
21 WebIDBObserverImpl::~WebIDBObserverImpl() { 36 WebIDBObserverImpl::~WebIDBObserverImpl() {
22 if (m_id != kInvalidObserverId) 37 if (m_id != kInvalidObserverId)
23 m_observer->removeObserver(m_id); 38 m_observer->removeObserver(m_id);
24 } 39 }
25 40
26 void WebIDBObserverImpl::setId(int32_t id) { 41 void WebIDBObserverImpl::setId(int32_t id) {
27 DCHECK_EQ(kInvalidObserverId, m_id); 42 DCHECK_EQ(kInvalidObserverId, m_id);
28 m_id = id; 43 m_id = id;
29 } 44 }
30 45
31 void WebIDBObserverImpl::onChange( 46 void WebIDBObserverImpl::onChange(
32 const WebVector<WebIDBObservation>& observations, 47 const WebVector<WebIDBObservation>& observations,
33 const WebVector<int32_t>& observationIndex) { 48 const WebVector<int32_t>& observationIndex) {
34 m_observer->onChange(m_id, observations, std::move(observationIndex)); 49 m_observer->onChange(m_id, observations, std::move(observationIndex));
35 } 50 }
36 51
37 } // namespace blink 52 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/modules/indexeddb/WebIDBObserverImpl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698