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

Side by Side Diff: third_party/WebKit/Source/modules/indexeddb/IDBObserver.h

Issue 2062203004: IDBObserver: Lifetime Management: Adding Observer (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Post cmumford review Created 4 years, 5 months 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
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 #ifndef IDBObserver_h 5 #ifndef IDBObserver_h
6 #define IDBObserver_h 6 #define IDBObserver_h
7 7
8 #include "bindings/core/v8/ScriptWrappable.h" 8 #include "bindings/core/v8/ScriptWrappable.h"
9 #include "modules/indexeddb/IDBDatabase.h" 9 #include "modules/ModulesExport.h"
10 #include "modules/indexeddb/IDBTransaction.h"
11 #include "platform/heap/Handle.h" 10 #include "platform/heap/Handle.h"
11 #include <set>
12 12
13 namespace blink { 13 namespace blink {
14 14
15 class ExceptionState;
15 class IDBObserverCallback; 16 class IDBObserverCallback;
16 class IDBObserverInit; 17 class IDBObserverInit;
18 class IDBDatabase;
cmumford 2016/07/06 22:57:56 Put forward declarations in alphabetical order.
palakj1 2016/07/07 00:19:53 Done.
19 class IDBTransaction;
17 20
18 class IDBObserver final : public GarbageCollected<IDBObserver>, public ScriptWra ppable { 21 class MODULES_EXPORT IDBObserver final : public GarbageCollectedFinalized<IDBObs erver>, public ScriptWrappable {
19 DEFINE_WRAPPERTYPEINFO(); 22 DEFINE_WRAPPERTYPEINFO();
20 23
21 public: 24 public:
22 static IDBObserver* create(IDBObserverCallback&, const IDBObserverInit&); 25 static IDBObserver* create(IDBObserverCallback&, const IDBObserverInit&);
23 26
27 ~IDBObserver();
24 // API methods 28 // API methods
25 void observe(IDBDatabase*, IDBTransaction*, ExceptionState&); 29 void observe(IDBDatabase*, IDBTransaction*, ExceptionState&);
30 void unobserve(IDBDatabase*, ExceptionState&);
31 void removeObserver(int32_t id);
26 32
27 DECLARE_TRACE(); 33 DECLARE_TRACE();
28 34
29 private: 35 private:
30 IDBObserver(IDBObserverCallback&, const IDBObserverInit&); 36 IDBObserver(IDBObserverCallback&, const IDBObserverInit&);
31 37
32 Member<IDBObserverCallback> m_callback; 38 Member<IDBObserverCallback> m_callback;
33 bool m_transaction; 39 bool m_transaction;
34 bool m_values; 40 bool m_values;
35 bool m_noRecords; 41 bool m_noRecords;
42 std::set<int32_t> m_observerIds;
cmumford 2016/07/06 22:57:57 So both IDBObserver and WebIDBDatabaseImpl have a
dmurph 2016/07/06 23:34:24 They're not identical. Here's the overview: 1. Eve
palakj1 2016/07/07 00:19:54 They are in the same thread, but not the same. Con
cmumford 2016/07/07 19:48:51 yep - thx.
36 }; 43 };
37 44
38 } // namespace blink 45 } // namespace blink
39 46
40 #endif // IDBObserver_h 47 #endif // IDBObserver_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698