| 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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 class IDBCursor; | 54 class IDBCursor; |
| 55 struct IDBDatabaseMetadata; | 55 struct IDBDatabaseMetadata; |
| 56 class IDBValue; | 56 class IDBValue; |
| 57 | 57 |
| 58 class MODULES_EXPORT IDBRequest | 58 class MODULES_EXPORT IDBRequest |
| 59 : public RefCountedGarbageCollectedEventTargetWithInlineData<IDBRequest> | 59 : public RefCountedGarbageCollectedEventTargetWithInlineData<IDBRequest> |
| 60 , public ActiveScriptWrappable | 60 , public ActiveScriptWrappable |
| 61 , public ActiveDOMObject { | 61 , public ActiveDOMObject { |
| 62 REFCOUNTED_GARBAGE_COLLECTED_EVENT_TARGET(IDBRequest); | 62 REFCOUNTED_GARBAGE_COLLECTED_EVENT_TARGET(IDBRequest); |
| 63 DEFINE_WRAPPERTYPEINFO(); | 63 DEFINE_WRAPPERTYPEINFO(); |
| 64 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(IDBRequest); | 64 USING_GARBAGE_COLLECTED_MIXIN(IDBRequest); |
| 65 public: | 65 public: |
| 66 static IDBRequest* create(ScriptState*, IDBAny* source, IDBTransaction*); | 66 static IDBRequest* create(ScriptState*, IDBAny* source, IDBTransaction*); |
| 67 ~IDBRequest() override; | 67 ~IDBRequest() override; |
| 68 DECLARE_VIRTUAL_TRACE(); | 68 DECLARE_VIRTUAL_TRACE(); |
| 69 | 69 |
| 70 ScriptState* getScriptState() { return m_scriptState.get(); } | 70 ScriptState* getScriptState() { return m_scriptState.get(); } |
| 71 ScriptValue result(ExceptionState&); | 71 ScriptValue result(ExceptionState&); |
| 72 DOMException* error(ExceptionState&) const; | 72 DOMException* error(ExceptionState&) const; |
| 73 ScriptValue source() const; | 73 ScriptValue source() const; |
| 74 IDBTransaction* transaction() const { return m_transaction.get(); } | 74 IDBTransaction* transaction() const { return m_transaction.get(); } |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 IDBCursor* getResultCursor() const; | 130 IDBCursor* getResultCursor() const; |
| 131 | 131 |
| 132 protected: | 132 protected: |
| 133 IDBRequest(ScriptState*, IDBAny* source, IDBTransaction*); | 133 IDBRequest(ScriptState*, IDBAny* source, IDBTransaction*); |
| 134 void enqueueEvent(PassRefPtrWillBeRawPtr<Event>); | 134 void enqueueEvent(RawPtr<Event>); |
| 135 void dequeueEvent(Event*); | 135 void dequeueEvent(Event*); |
| 136 virtual bool shouldEnqueueEvent() const; | 136 virtual bool shouldEnqueueEvent() const; |
| 137 void onSuccessInternal(IDBAny*); | 137 void onSuccessInternal(IDBAny*); |
| 138 void setResult(IDBAny*); | 138 void setResult(IDBAny*); |
| 139 | 139 |
| 140 // EventTarget | 140 // EventTarget |
| 141 DispatchEventResult dispatchEventInternal(PassRefPtrWillBeRawPtr<Event>) ove
rride; | 141 DispatchEventResult dispatchEventInternal(RawPtr<Event>) override; |
| 142 | 142 |
| 143 bool m_contextStopped = false; | 143 bool m_contextStopped = false; |
| 144 Member<IDBTransaction> m_transaction; | 144 Member<IDBTransaction> m_transaction; |
| 145 ReadyState m_readyState = PENDING; | 145 ReadyState m_readyState = PENDING; |
| 146 bool m_requestAborted = false; // May be aborted by transaction then receive
async onsuccess; ignore vs. assert. | 146 bool m_requestAborted = false; // May be aborted by transaction then receive
async onsuccess; ignore vs. assert. |
| 147 | 147 |
| 148 private: | 148 private: |
| 149 void setResultCursor(IDBCursor*, IDBKey*, IDBKey* primaryKey, PassRefPtr<IDB
Value>); | 149 void setResultCursor(IDBCursor*, IDBKey*, IDBKey* primaryKey, PassRefPtr<IDB
Value>); |
| 150 void ackReceivedBlobs(const IDBValue*); | 150 void ackReceivedBlobs(const IDBValue*); |
| 151 void ackReceivedBlobs(const Vector<RefPtr<IDBValue>>&); | 151 void ackReceivedBlobs(const Vector<RefPtr<IDBValue>>&); |
| 152 | 152 |
| 153 RefPtr<ScriptState> m_scriptState; | 153 RefPtr<ScriptState> m_scriptState; |
| 154 Member<IDBAny> m_source; | 154 Member<IDBAny> m_source; |
| 155 Member<IDBAny> m_result; | 155 Member<IDBAny> m_result; |
| 156 Member<DOMException> m_error; | 156 Member<DOMException> m_error; |
| 157 | 157 |
| 158 bool m_hasPendingActivity = true; | 158 bool m_hasPendingActivity = true; |
| 159 WillBeHeapVector<RefPtrWillBeMember<Event>> m_enqueuedEvents; | 159 HeapVector<Member<Event>> m_enqueuedEvents; |
| 160 | 160 |
| 161 // Only used if the result type will be a cursor. | 161 // Only used if the result type will be a cursor. |
| 162 IndexedDB::CursorType m_cursorType = IndexedDB::CursorKeyAndValue; | 162 IndexedDB::CursorType m_cursorType = IndexedDB::CursorKeyAndValue; |
| 163 WebIDBCursorDirection m_cursorDirection = WebIDBCursorDirectionNext; | 163 WebIDBCursorDirection m_cursorDirection = WebIDBCursorDirectionNext; |
| 164 // When a cursor is continued/advanced, m_result is cleared and m_pendingCur
sor holds it. | 164 // When a cursor is continued/advanced, m_result is cleared and m_pendingCur
sor holds it. |
| 165 Member<IDBCursor> m_pendingCursor; | 165 Member<IDBCursor> m_pendingCursor; |
| 166 // New state is not applied to the cursor object until the event is dispatch
ed. | 166 // New state is not applied to the cursor object until the event is dispatch
ed. |
| 167 Member<IDBKey> m_cursorKey; | 167 Member<IDBKey> m_cursorKey; |
| 168 Member<IDBKey> m_cursorPrimaryKey; | 168 Member<IDBKey> m_cursorPrimaryKey; |
| 169 RefPtr<IDBValue> m_cursorValue; | 169 RefPtr<IDBValue> m_cursorValue; |
| 170 | 170 |
| 171 bool m_didFireUpgradeNeededEvent = false; | 171 bool m_didFireUpgradeNeededEvent = false; |
| 172 bool m_preventPropagation = false; | 172 bool m_preventPropagation = false; |
| 173 bool m_resultDirty = true; | 173 bool m_resultDirty = true; |
| 174 }; | 174 }; |
| 175 | 175 |
| 176 } // namespace blink | 176 } // namespace blink |
| 177 | 177 |
| 178 #endif // IDBRequest_h | 178 #endif // IDBRequest_h |
| OLD | NEW |