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