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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 | 42 |
43 class DOMError; | 43 class DOMError; |
44 class ExceptionState; | 44 class ExceptionState; |
45 class IDBCursor; | 45 class IDBCursor; |
46 class IDBDatabase; | 46 class IDBDatabase; |
47 class IDBDatabaseBackendInterface; | 47 class IDBDatabaseBackendInterface; |
48 class IDBObjectStore; | 48 class IDBObjectStore; |
49 class IDBOpenDBRequest; | 49 class IDBOpenDBRequest; |
50 struct IDBObjectStoreMetadata; | 50 struct IDBObjectStoreMetadata; |
51 | 51 |
52 class IDBTransaction : public ScriptWrappable, public RefCounted<IDBTransaction>
, public EventTarget, public ActiveDOMObject { | 52 class IDBTransaction : public ScriptWrappable, public RefCounted<IDBTransaction>
, public EventTargetWithInlineData, public ActiveDOMObject { |
53 public: | 53 public: |
54 static PassRefPtr<IDBTransaction> create(ScriptExecutionContext*, int64_t, c
onst Vector<String>& objectStoreNames, IndexedDB::TransactionMode, IDBDatabase*)
; | 54 static PassRefPtr<IDBTransaction> create(ScriptExecutionContext*, int64_t, c
onst Vector<String>& objectStoreNames, IndexedDB::TransactionMode, IDBDatabase*)
; |
55 static PassRefPtr<IDBTransaction> create(ScriptExecutionContext*, int64_t, I
DBDatabase*, IDBOpenDBRequest*, const IDBDatabaseMetadata& previousMetadata); | 55 static PassRefPtr<IDBTransaction> create(ScriptExecutionContext*, int64_t, I
DBDatabase*, IDBOpenDBRequest*, const IDBDatabaseMetadata& previousMetadata); |
56 virtual ~IDBTransaction(); | 56 virtual ~IDBTransaction(); |
57 | 57 |
58 static const AtomicString& modeReadOnly(); | 58 static const AtomicString& modeReadOnly(); |
59 static const AtomicString& modeReadWrite(); | 59 static const AtomicString& modeReadWrite(); |
60 static const AtomicString& modeVersionChange(); | 60 static const AtomicString& modeVersionChange(); |
61 static const AtomicString& modeReadOnlyLegacy(); | 61 static const AtomicString& modeReadOnlyLegacy(); |
62 static const AtomicString& modeReadWriteLegacy(); | 62 static const AtomicString& modeReadWriteLegacy(); |
(...skipping 24 matching lines...) Expand all Loading... |
87 void setError(PassRefPtr<DOMError>); | 87 void setError(PassRefPtr<DOMError>); |
88 | 88 |
89 DEFINE_ATTRIBUTE_EVENT_LISTENER(abort); | 89 DEFINE_ATTRIBUTE_EVENT_LISTENER(abort); |
90 DEFINE_ATTRIBUTE_EVENT_LISTENER(complete); | 90 DEFINE_ATTRIBUTE_EVENT_LISTENER(complete); |
91 DEFINE_ATTRIBUTE_EVENT_LISTENER(error); | 91 DEFINE_ATTRIBUTE_EVENT_LISTENER(error); |
92 | 92 |
93 virtual void onAbort(PassRefPtr<DOMError>); | 93 virtual void onAbort(PassRefPtr<DOMError>); |
94 virtual void onComplete(); | 94 virtual void onComplete(); |
95 | 95 |
96 // EventTarget | 96 // EventTarget |
97 virtual const AtomicString& interfaceName() const; | 97 virtual const AtomicString& interfaceName() const OVERRIDE; |
98 virtual ScriptExecutionContext* scriptExecutionContext() const; | 98 virtual ScriptExecutionContext* scriptExecutionContext() const OVERRIDE; |
99 | 99 |
100 using EventTarget::dispatchEvent; | 100 using EventTarget::dispatchEvent; |
101 virtual bool dispatchEvent(PassRefPtr<Event>) OVERRIDE; | 101 virtual bool dispatchEvent(PassRefPtr<Event>) OVERRIDE; |
102 | 102 |
103 // ActiveDOMObject | 103 // ActiveDOMObject |
104 virtual bool hasPendingActivity() const OVERRIDE; | 104 virtual bool hasPendingActivity() const OVERRIDE; |
105 virtual bool canSuspend() const OVERRIDE; | 105 virtual bool canSuspend() const OVERRIDE; |
106 virtual void stop() OVERRIDE; | 106 virtual void stop() OVERRIDE; |
107 | 107 |
108 using RefCounted<IDBTransaction>::ref; | 108 using RefCounted<IDBTransaction>::ref; |
109 using RefCounted<IDBTransaction>::deref; | 109 using RefCounted<IDBTransaction>::deref; |
110 | 110 |
111 private: | 111 private: |
112 IDBTransaction(ScriptExecutionContext*, int64_t, const Vector<String>&, Inde
xedDB::TransactionMode, IDBDatabase*, IDBOpenDBRequest*, const IDBDatabaseMetada
ta&); | 112 IDBTransaction(ScriptExecutionContext*, int64_t, const Vector<String>&, Inde
xedDB::TransactionMode, IDBDatabase*, IDBOpenDBRequest*, const IDBDatabaseMetada
ta&); |
113 | 113 |
114 void enqueueEvent(PassRefPtr<Event>); | 114 void enqueueEvent(PassRefPtr<Event>); |
115 | 115 |
116 // EventTarget | 116 // EventTarget |
117 virtual void refEventTarget() { ref(); } | 117 virtual void refEventTarget() OVERRIDE { ref(); } |
118 virtual void derefEventTarget() { deref(); } | 118 virtual void derefEventTarget() OVERRIDE { deref(); } |
119 virtual EventTargetData* eventTargetData(); | |
120 virtual EventTargetData* ensureEventTargetData(); | |
121 | 119 |
122 enum State { | 120 enum State { |
123 Inactive, // Created or started, but not in an event callback | 121 Inactive, // Created or started, but not in an event callback |
124 Active, // Created or started, in creation scope or an event callback | 122 Active, // Created or started, in creation scope or an event callback |
125 Finishing, // In the process of aborting or completing. | 123 Finishing, // In the process of aborting or completing. |
126 Finished, // No more events will fire and no new requests may be filed. | 124 Finished, // No more events will fire and no new requests may be filed. |
127 }; | 125 }; |
128 | 126 |
129 int64_t m_id; | 127 int64_t m_id; |
130 RefPtr<IDBDatabase> m_database; | 128 RefPtr<IDBDatabase> m_database; |
131 const Vector<String> m_objectStoreNames; | 129 const Vector<String> m_objectStoreNames; |
132 IDBOpenDBRequest* m_openDBRequest; | 130 IDBOpenDBRequest* m_openDBRequest; |
133 const IndexedDB::TransactionMode m_mode; | 131 const IndexedDB::TransactionMode m_mode; |
134 State m_state; | 132 State m_state; |
135 bool m_hasPendingActivity; | 133 bool m_hasPendingActivity; |
136 bool m_contextStopped; | 134 bool m_contextStopped; |
137 RefPtr<DOMError> m_error; | 135 RefPtr<DOMError> m_error; |
138 | 136 |
139 ListHashSet<RefPtr<IDBRequest> > m_requestList; | 137 ListHashSet<RefPtr<IDBRequest> > m_requestList; |
140 | 138 |
141 typedef HashMap<String, RefPtr<IDBObjectStore> > IDBObjectStoreMap; | 139 typedef HashMap<String, RefPtr<IDBObjectStore> > IDBObjectStoreMap; |
142 IDBObjectStoreMap m_objectStoreMap; | 140 IDBObjectStoreMap m_objectStoreMap; |
143 | 141 |
144 typedef HashSet<RefPtr<IDBObjectStore> > IDBObjectStoreSet; | 142 typedef HashSet<RefPtr<IDBObjectStore> > IDBObjectStoreSet; |
145 IDBObjectStoreSet m_deletedObjectStores; | 143 IDBObjectStoreSet m_deletedObjectStores; |
146 | 144 |
147 typedef HashMap<RefPtr<IDBObjectStore>, IDBObjectStoreMetadata> IDBObjectSto
reMetadataMap; | 145 typedef HashMap<RefPtr<IDBObjectStore>, IDBObjectStoreMetadata> IDBObjectSto
reMetadataMap; |
148 IDBObjectStoreMetadataMap m_objectStoreCleanupMap; | 146 IDBObjectStoreMetadataMap m_objectStoreCleanupMap; |
149 IDBDatabaseMetadata m_previousMetadata; | 147 IDBDatabaseMetadata m_previousMetadata; |
150 | |
151 EventTargetData m_eventTargetData; | |
152 }; | 148 }; |
153 | 149 |
154 } // namespace WebCore | 150 } // namespace WebCore |
155 | 151 |
156 #endif // IDBTransaction_h | 152 #endif // IDBTransaction_h |
OLD | NEW |