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 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 // ActiveDOMObject | 113 // ActiveDOMObject |
114 virtual bool hasPendingActivity() const OVERRIDE FINAL; | 114 virtual bool hasPendingActivity() const OVERRIDE FINAL; |
115 virtual void stop() OVERRIDE FINAL; | 115 virtual void stop() OVERRIDE FINAL; |
116 | 116 |
117 // EventTarget | 117 // EventTarget |
118 virtual const AtomicString& interfaceName() const OVERRIDE; | 118 virtual const AtomicString& interfaceName() const OVERRIDE; |
119 virtual ExecutionContext* executionContext() const OVERRIDE FINAL; | 119 virtual ExecutionContext* executionContext() const OVERRIDE FINAL; |
120 virtual void uncaughtExceptionInEventHandler() OVERRIDE FINAL; | 120 virtual void uncaughtExceptionInEventHandler() OVERRIDE FINAL; |
121 | 121 |
122 using EventTarget::dispatchEvent; | 122 using EventTarget::dispatchEvent; |
123 virtual bool dispatchEvent(PassRefPtr<Event>) OVERRIDE; | 123 virtual bool dispatchEvent(PassRefPtrWillBeRawPtr<Event>) OVERRIDE; |
124 | 124 |
125 // Called by a version change transaction that has finished to set this | 125 // Called by a version change transaction that has finished to set this |
126 // request back from DONE (following "upgradeneeded") back to PENDING (for | 126 // request back from DONE (following "upgradeneeded") back to PENDING (for |
127 // the upcoming "success" or "error"). | 127 // the upcoming "success" or "error"). |
128 void transactionDidFinishAndDispatch(); | 128 void transactionDidFinishAndDispatch(); |
129 | 129 |
130 virtual void deref() OVERRIDE FINAL | 130 virtual void deref() OVERRIDE FINAL |
131 { | 131 { |
132 if (derefBase()) | 132 if (derefBase()) |
133 delete this; | 133 delete this; |
134 else if (hasOneRef()) | 134 else if (hasOneRef()) |
135 checkForReferenceCycle(); | 135 checkForReferenceCycle(); |
136 } | 136 } |
137 | 137 |
138 DOMRequestState* requestState() { return &m_requestState; } | 138 DOMRequestState* requestState() { return &m_requestState; } |
139 IDBCursor* getResultCursor() const; | 139 IDBCursor* getResultCursor() const; |
140 | 140 |
141 protected: | 141 protected: |
142 IDBRequest(ExecutionContext*, PassRefPtr<IDBAny> source, IDBTransaction*); | 142 IDBRequest(ExecutionContext*, PassRefPtr<IDBAny> source, IDBTransaction*); |
143 void enqueueEvent(PassRefPtr<Event>); | 143 void enqueueEvent(PassRefPtrWillBeRawPtr<Event>); |
144 void dequeueEvent(Event*); | 144 void dequeueEvent(Event*); |
145 virtual bool shouldEnqueueEvent() const; | 145 virtual bool shouldEnqueueEvent() const; |
146 void onSuccessInternal(PassRefPtr<IDBAny>); | 146 void onSuccessInternal(PassRefPtr<IDBAny>); |
147 void setResult(PassRefPtr<IDBAny>); | 147 void setResult(PassRefPtr<IDBAny>); |
148 | 148 |
149 bool m_contextStopped; | 149 bool m_contextStopped; |
150 RefPtr<IDBTransaction> m_transaction; | 150 RefPtr<IDBTransaction> m_transaction; |
151 ReadyState m_readyState; | 151 ReadyState m_readyState; |
152 bool m_requestAborted; // May be aborted by transaction then receive async o
nsuccess; ignore vs. assert. | 152 bool m_requestAborted; // May be aborted by transaction then receive async o
nsuccess; ignore vs. assert. |
153 | 153 |
154 private: | 154 private: |
155 void setResultCursor(PassRefPtr<IDBCursor>, PassRefPtr<IDBKey>, PassRefPtr<I
DBKey> primaryKey, PassRefPtr<SharedBuffer> value); | 155 void setResultCursor(PassRefPtr<IDBCursor>, PassRefPtr<IDBKey>, PassRefPtr<I
DBKey> primaryKey, PassRefPtr<SharedBuffer> value); |
156 void checkForReferenceCycle(); | 156 void checkForReferenceCycle(); |
157 | 157 |
158 RefPtr<IDBAny> m_source; | 158 RefPtr<IDBAny> m_source; |
159 RefPtr<IDBAny> m_result; | 159 RefPtr<IDBAny> m_result; |
160 RefPtrWillBePersistent<DOMError> m_error; | 160 RefPtrWillBePersistent<DOMError> m_error; |
161 | 161 |
162 bool m_hasPendingActivity; | 162 bool m_hasPendingActivity; |
163 Vector<RefPtr<Event> > m_enqueuedEvents; | 163 WillBePersistentHeapVector<RefPtrWillBeMember<Event> > m_enqueuedEvents; |
164 | 164 |
165 // Only used if the result type will be a cursor. | 165 // Only used if the result type will be a cursor. |
166 IndexedDB::CursorType m_cursorType; | 166 IndexedDB::CursorType m_cursorType; |
167 blink::WebIDBCursor::Direction m_cursorDirection; | 167 blink::WebIDBCursor::Direction m_cursorDirection; |
168 // When a cursor is continued/advanced, m_result is cleared and m_pendingCur
sor holds it. | 168 // When a cursor is continued/advanced, m_result is cleared and m_pendingCur
sor holds it. |
169 RefPtr<IDBCursor> m_pendingCursor; | 169 RefPtr<IDBCursor> m_pendingCursor; |
170 // New state is not applied to the cursor object until the event is dispatch
ed. | 170 // New state is not applied to the cursor object until the event is dispatch
ed. |
171 RefPtr<IDBKey> m_cursorKey; | 171 RefPtr<IDBKey> m_cursorKey; |
172 RefPtr<IDBKey> m_cursorPrimaryKey; | 172 RefPtr<IDBKey> m_cursorPrimaryKey; |
173 RefPtr<SharedBuffer> m_cursorValue; | 173 RefPtr<SharedBuffer> m_cursorValue; |
174 | 174 |
175 bool m_didFireUpgradeNeededEvent; | 175 bool m_didFireUpgradeNeededEvent; |
176 bool m_preventPropagation; | 176 bool m_preventPropagation; |
177 bool m_resultDirty; | 177 bool m_resultDirty; |
178 | 178 |
179 DOMRequestState m_requestState; | 179 DOMRequestState m_requestState; |
180 }; | 180 }; |
181 | 181 |
182 } // namespace WebCore | 182 } // namespace WebCore |
183 | 183 |
184 #endif // IDBRequest_h | 184 #endif // IDBRequest_h |
OLD | NEW |