OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2010 Google Inc. All rights reserved. | 2 * Copyright (C) 2010 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * | 7 * |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 10 matching lines...) Expand all Loading... |
21 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 21 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
23 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 23 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
24 */ | 24 */ |
25 | 25 |
26 #ifndef IDBTransaction_h | 26 #ifndef IDBTransaction_h |
27 #define IDBTransaction_h | 27 #define IDBTransaction_h |
28 | 28 |
29 #include "bindings/core/v8/ScriptState.h" | 29 #include "bindings/core/v8/ScriptState.h" |
30 #include "core/dom/ActiveDOMObject.h" | 30 #include "core/dom/ActiveDOMObject.h" |
31 #include "core/dom/DOMError.h" | |
32 #include "core/events/EventListener.h" | 31 #include "core/events/EventListener.h" |
33 #include "modules/EventModules.h" | 32 #include "modules/EventModules.h" |
34 #include "modules/EventTargetModules.h" | 33 #include "modules/EventTargetModules.h" |
35 #include "modules/ModulesExport.h" | 34 #include "modules/ModulesExport.h" |
36 #include "modules/indexeddb/IDBMetadata.h" | 35 #include "modules/indexeddb/IDBMetadata.h" |
37 #include "modules/indexeddb/IndexedDB.h" | 36 #include "modules/indexeddb/IndexedDB.h" |
38 #include "platform/heap/Handle.h" | 37 #include "platform/heap/Handle.h" |
39 #include "public/platform/modules/indexeddb/WebIDBDatabase.h" | 38 #include "public/platform/modules/indexeddb/WebIDBDatabase.h" |
40 #include "public/platform/modules/indexeddb/WebIDBTypes.h" | 39 #include "public/platform/modules/indexeddb/WebIDBTypes.h" |
41 #include "wtf/HashSet.h" | 40 #include "wtf/HashSet.h" |
42 | 41 |
43 namespace blink { | 42 namespace blink { |
44 | 43 |
45 class DOMError; | 44 class DOMException; |
46 class ExceptionState; | 45 class ExceptionState; |
47 class IDBDatabase; | 46 class IDBDatabase; |
48 class IDBObjectStore; | 47 class IDBObjectStore; |
49 class IDBOpenDBRequest; | 48 class IDBOpenDBRequest; |
50 struct IDBObjectStoreMetadata; | 49 struct IDBObjectStoreMetadata; |
51 | 50 |
52 class MODULES_EXPORT IDBTransaction final | 51 class MODULES_EXPORT IDBTransaction final |
53 : public RefCountedGarbageCollectedEventTargetWithInlineData<IDBTransaction> | 52 : public RefCountedGarbageCollectedEventTargetWithInlineData<IDBTransaction> |
54 , public ActiveDOMObject { | 53 , public ActiveDOMObject { |
55 REFCOUNTED_GARBAGE_COLLECTED_EVENT_TARGET(IDBTransaction); | 54 REFCOUNTED_GARBAGE_COLLECTED_EVENT_TARGET(IDBTransaction); |
(...skipping 14 matching lines...) Expand all Loading... |
70 bool isActive() const { return m_state == Active; } | 69 bool isActive() const { return m_state == Active; } |
71 bool isFinished() const { return m_state == Finished; } | 70 bool isFinished() const { return m_state == Finished; } |
72 bool isFinishing() const { return m_state == Finishing; } | 71 bool isFinishing() const { return m_state == Finishing; } |
73 bool isReadOnly() const { return m_mode == WebIDBTransactionModeReadOnly; } | 72 bool isReadOnly() const { return m_mode == WebIDBTransactionModeReadOnly; } |
74 bool isVersionChange() const { return m_mode == WebIDBTransactionModeVersion
Change; } | 73 bool isVersionChange() const { return m_mode == WebIDBTransactionModeVersion
Change; } |
75 | 74 |
76 // Implement the IDBTransaction IDL | 75 // Implement the IDBTransaction IDL |
77 const String& mode() const; | 76 const String& mode() const; |
78 PassRefPtrWillBeRawPtr<DOMStringList> objectStoreNames() const; | 77 PassRefPtrWillBeRawPtr<DOMStringList> objectStoreNames() const; |
79 IDBDatabase* db() const { return m_database.get(); } | 78 IDBDatabase* db() const { return m_database.get(); } |
80 DOMError* error() const { return m_error; } | 79 DOMException* error() const { return m_error; } |
81 IDBObjectStore* objectStore(const String& name, ExceptionState&); | 80 IDBObjectStore* objectStore(const String& name, ExceptionState&); |
82 void abort(ExceptionState&); | 81 void abort(ExceptionState&); |
83 | 82 |
84 void registerRequest(IDBRequest*); | 83 void registerRequest(IDBRequest*); |
85 void unregisterRequest(IDBRequest*); | 84 void unregisterRequest(IDBRequest*); |
86 void objectStoreCreated(const String&, IDBObjectStore*); | 85 void objectStoreCreated(const String&, IDBObjectStore*); |
87 void objectStoreDeleted(const String&); | 86 void objectStoreDeleted(const String&); |
88 void setActive(bool); | 87 void setActive(bool); |
89 void setError(DOMError*); | 88 void setError(DOMException*); |
90 | 89 |
91 DEFINE_ATTRIBUTE_EVENT_LISTENER(abort); | 90 DEFINE_ATTRIBUTE_EVENT_LISTENER(abort); |
92 DEFINE_ATTRIBUTE_EVENT_LISTENER(complete); | 91 DEFINE_ATTRIBUTE_EVENT_LISTENER(complete); |
93 DEFINE_ATTRIBUTE_EVENT_LISTENER(error); | 92 DEFINE_ATTRIBUTE_EVENT_LISTENER(error); |
94 | 93 |
95 void onAbort(DOMError*); | 94 void onAbort(DOMException*); |
96 void onComplete(); | 95 void onComplete(); |
97 | 96 |
98 // EventTarget | 97 // EventTarget |
99 const AtomicString& interfaceName() const override; | 98 const AtomicString& interfaceName() const override; |
100 ExecutionContext* executionContext() const override; | 99 ExecutionContext* executionContext() const override; |
101 | 100 |
102 // ActiveDOMObject | 101 // ActiveDOMObject |
103 bool hasPendingActivity() const override; | 102 bool hasPendingActivity() const override; |
104 void stop() override; | 103 void stop() override; |
105 | 104 |
(...skipping 14 matching lines...) Expand all Loading... |
120 }; | 119 }; |
121 | 120 |
122 const int64_t m_id; | 121 const int64_t m_id; |
123 Member<IDBDatabase> m_database; | 122 Member<IDBDatabase> m_database; |
124 const HashSet<String> m_objectStoreNames; | 123 const HashSet<String> m_objectStoreNames; |
125 Member<IDBOpenDBRequest> m_openDBRequest; | 124 Member<IDBOpenDBRequest> m_openDBRequest; |
126 const WebIDBTransactionMode m_mode; | 125 const WebIDBTransactionMode m_mode; |
127 State m_state = Active; | 126 State m_state = Active; |
128 bool m_hasPendingActivity = true; | 127 bool m_hasPendingActivity = true; |
129 bool m_contextStopped = false; | 128 bool m_contextStopped = false; |
130 Member<DOMError> m_error; | 129 Member<DOMException> m_error; |
131 | 130 |
132 HeapListHashSet<Member<IDBRequest>> m_requestList; | 131 HeapListHashSet<Member<IDBRequest>> m_requestList; |
133 | 132 |
134 typedef HeapHashMap<String, Member<IDBObjectStore>> IDBObjectStoreMap; | 133 typedef HeapHashMap<String, Member<IDBObjectStore>> IDBObjectStoreMap; |
135 IDBObjectStoreMap m_objectStoreMap; | 134 IDBObjectStoreMap m_objectStoreMap; |
136 | 135 |
137 HeapHashSet<Member<IDBObjectStore>> m_deletedObjectStores; | 136 HeapHashSet<Member<IDBObjectStore>> m_deletedObjectStores; |
138 HeapHashMap<Member<IDBObjectStore>, IDBObjectStoreMetadata> m_objectStoreCle
anupMap; | 137 HeapHashMap<Member<IDBObjectStore>, IDBObjectStoreMetadata> m_objectStoreCle
anupMap; |
139 IDBDatabaseMetadata m_previousMetadata; | 138 IDBDatabaseMetadata m_previousMetadata; |
140 }; | 139 }; |
141 | 140 |
142 } // namespace blink | 141 } // namespace blink |
143 | 142 |
144 #endif // IDBTransaction_h | 143 #endif // IDBTransaction_h |
OLD | NEW |