| 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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 }; | 68 }; |
| 69 | 69 |
| 70 const String& readyState() const; | 70 const String& readyState() const; |
| 71 | 71 |
| 72 DEFINE_ATTRIBUTE_EVENT_LISTENER(success); | 72 DEFINE_ATTRIBUTE_EVENT_LISTENER(success); |
| 73 DEFINE_ATTRIBUTE_EVENT_LISTENER(error); | 73 DEFINE_ATTRIBUTE_EVENT_LISTENER(error); |
| 74 | 74 |
| 75 void markEarlyDeath(); | 75 void markEarlyDeath(); |
| 76 void setCursorDetails(IndexedDB::CursorType, IndexedDB::CursorDirection); | 76 void setCursorDetails(IndexedDB::CursorType, IndexedDB::CursorDirection); |
| 77 void setPendingCursor(PassRefPtr<IDBCursor>); | 77 void setPendingCursor(PassRefPtr<IDBCursor>); |
| 78 void finishCursor(); | |
| 79 void abort(); | 78 void abort(); |
| 80 | 79 |
| 81 // IDBCallbacks | 80 // IDBCallbacks |
| 82 virtual void onError(PassRefPtr<DOMError>); | 81 virtual void onError(PassRefPtr<DOMError>); |
| 83 virtual void onSuccess(const Vector<String>&); | 82 virtual void onSuccess(const Vector<String>&); |
| 84 virtual void onSuccess(PassRefPtr<IDBCursorBackendInterface>, PassRefPtr<IDB
Key>, PassRefPtr<IDBKey> primaryKey, PassRefPtr<SharedBuffer>); | 83 virtual void onSuccess(PassRefPtr<IDBCursorBackendInterface>, PassRefPtr<IDB
Key>, PassRefPtr<IDBKey> primaryKey, PassRefPtr<SharedBuffer>); |
| 85 virtual void onSuccess(PassRefPtr<IDBKey>); | 84 virtual void onSuccess(PassRefPtr<IDBKey>); |
| 86 virtual void onSuccess(PassRefPtr<SharedBuffer>); | 85 virtual void onSuccess(PassRefPtr<SharedBuffer>); |
| 87 virtual void onSuccess(PassRefPtr<SharedBuffer>, PassRefPtr<IDBKey>, const I
DBKeyPath&); | 86 virtual void onSuccess(PassRefPtr<SharedBuffer>, PassRefPtr<IDBKey>, const I
DBKeyPath&); |
| 88 virtual void onSuccess(int64_t); | 87 virtual void onSuccess(int64_t); |
| 89 virtual void onSuccess(); | 88 virtual void onSuccess(); |
| 90 virtual void onSuccess(PassRefPtr<IDBKey>, PassRefPtr<IDBKey> primaryKey, Pa
ssRefPtr<SharedBuffer>); | 89 virtual void onSuccess(PassRefPtr<IDBKey>, PassRefPtr<IDBKey> primaryKey, Pa
ssRefPtr<SharedBuffer>); |
| 91 | 90 |
| 92 // ActiveDOMObject | 91 // ActiveDOMObject |
| 93 virtual bool hasPendingActivity() const OVERRIDE; | 92 virtual bool hasPendingActivity() const OVERRIDE; |
| 94 virtual void stop() OVERRIDE; | 93 virtual void stop() OVERRIDE; |
| 95 | 94 |
| 96 // EventTarget | 95 // EventTarget |
| 97 virtual const AtomicString& interfaceName() const; | 96 virtual const AtomicString& interfaceName() const; |
| 98 virtual ScriptExecutionContext* scriptExecutionContext() const; | 97 virtual ScriptExecutionContext* scriptExecutionContext() const; |
| 99 virtual void uncaughtExceptionInEventHandler(); | 98 virtual void uncaughtExceptionInEventHandler(); |
| 100 | 99 |
| 101 using EventTarget::dispatchEvent; | 100 using EventTarget::dispatchEvent; |
| 102 virtual bool dispatchEvent(PassRefPtr<Event>) OVERRIDE; | 101 virtual bool dispatchEvent(PassRefPtr<Event>) OVERRIDE; |
| 103 | 102 |
| 104 void transactionDidFinishAndDispatch(); | 103 void transactionDidFinishAndDispatch(); |
| 105 | 104 |
| 106 using RefCounted<IDBCallbacks>::ref; | 105 using IDBCallbacks::ref; |
| 107 using RefCounted<IDBCallbacks>::deref; | 106 using IDBCallbacks::deref; |
| 107 |
| 108 virtual void deref() OVERRIDE |
| 109 { |
| 110 if (derefBase()) |
| 111 delete this; |
| 112 else if (hasOneRef()) |
| 113 checkForReferenceCycle(); |
| 114 } |
| 108 | 115 |
| 109 IDBDatabaseBackendInterface::TaskType taskType() { return m_taskType; } | 116 IDBDatabaseBackendInterface::TaskType taskType() { return m_taskType; } |
| 110 | 117 |
| 111 DOMRequestState* requestState() { return &m_requestState; } | 118 DOMRequestState* requestState() { return &m_requestState; } |
| 119 IDBCursor* getResultCursor(); |
| 112 | 120 |
| 113 protected: | 121 protected: |
| 114 IDBRequest(ScriptExecutionContext*, PassRefPtr<IDBAny> source, IDBDatabaseBa
ckendInterface::TaskType, IDBTransaction*); | 122 IDBRequest(ScriptExecutionContext*, PassRefPtr<IDBAny> source, IDBDatabaseBa
ckendInterface::TaskType, IDBTransaction*); |
| 115 void enqueueEvent(PassRefPtr<Event>); | 123 void enqueueEvent(PassRefPtr<Event>); |
| 116 virtual bool shouldEnqueueEvent() const; | 124 virtual bool shouldEnqueueEvent() const; |
| 117 void onSuccessInternal(PassRefPtr<SerializedScriptValue>); | 125 void onSuccessInternal(PassRefPtr<SerializedScriptValue>); |
| 118 void onSuccessInternal(const ScriptValue&); | 126 void onSuccessInternal(const ScriptValue&); |
| 119 | 127 |
| 120 RefPtr<IDBAny> m_result; | 128 RefPtr<IDBAny> m_result; |
| 121 RefPtr<DOMError> m_error; | 129 RefPtr<DOMError> m_error; |
| 122 bool m_contextStopped; | 130 bool m_contextStopped; |
| 123 RefPtr<IDBTransaction> m_transaction; | 131 RefPtr<IDBTransaction> m_transaction; |
| 124 ReadyState m_readyState; | 132 ReadyState m_readyState; |
| 125 bool m_requestAborted; // May be aborted by transaction then receive async o
nsuccess; ignore vs. assert. | 133 bool m_requestAborted; // May be aborted by transaction then receive async o
nsuccess; ignore vs. assert. |
| 126 | 134 |
| 127 private: | 135 private: |
| 128 // EventTarget | 136 // EventTarget |
| 129 virtual void refEventTarget() { ref(); } | 137 virtual void refEventTarget() { ref(); } |
| 130 virtual void derefEventTarget() { deref(); } | 138 virtual void derefEventTarget() { deref(); } |
| 131 virtual EventTargetData* eventTargetData(); | 139 virtual EventTargetData* eventTargetData(); |
| 132 virtual EventTargetData* ensureEventTargetData(); | 140 virtual EventTargetData* ensureEventTargetData(); |
| 133 | 141 |
| 134 PassRefPtr<IDBCursor> getResultCursor(); | |
| 135 void setResultCursor(PassRefPtr<IDBCursor>, PassRefPtr<IDBKey>, PassRefPtr<I
DBKey> primaryKey, PassRefPtr<SharedBuffer> value); | 142 void setResultCursor(PassRefPtr<IDBCursor>, PassRefPtr<IDBKey>, PassRefPtr<I
DBKey> primaryKey, PassRefPtr<SharedBuffer> value); |
| 143 void checkForReferenceCycle(); |
| 144 |
| 136 | 145 |
| 137 RefPtr<IDBAny> m_source; | 146 RefPtr<IDBAny> m_source; |
| 138 const IDBDatabaseBackendInterface::TaskType m_taskType; | 147 const IDBDatabaseBackendInterface::TaskType m_taskType; |
| 139 | 148 |
| 140 bool m_hasPendingActivity; | 149 bool m_hasPendingActivity; |
| 141 Vector<RefPtr<Event> > m_enqueuedEvents; | 150 Vector<RefPtr<Event> > m_enqueuedEvents; |
| 142 | 151 |
| 143 // Only used if the result type will be a cursor. | 152 // Only used if the result type will be a cursor. |
| 144 IndexedDB::CursorType m_cursorType; | 153 IndexedDB::CursorType m_cursorType; |
| 145 IndexedDB::CursorDirection m_cursorDirection; | 154 IndexedDB::CursorDirection m_cursorDirection; |
| 146 bool m_cursorFinished; | |
| 147 RefPtr<IDBCursor> m_pendingCursor; | 155 RefPtr<IDBCursor> m_pendingCursor; |
| 148 RefPtr<IDBKey> m_cursorKey; | 156 RefPtr<IDBKey> m_cursorKey; |
| 149 RefPtr<IDBKey> m_cursorPrimaryKey; | 157 RefPtr<IDBKey> m_cursorPrimaryKey; |
| 150 RefPtr<SharedBuffer> m_cursorValue; | 158 RefPtr<SharedBuffer> m_cursorValue; |
| 151 bool m_didFireUpgradeNeededEvent; | 159 bool m_didFireUpgradeNeededEvent; |
| 152 bool m_preventPropagation; | 160 bool m_preventPropagation; |
| 153 | 161 |
| 154 EventTargetData m_eventTargetData; | 162 EventTargetData m_eventTargetData; |
| 155 DOMRequestState m_requestState; | 163 DOMRequestState m_requestState; |
| 156 }; | 164 }; |
| 157 | 165 |
| 158 } // namespace WebCore | 166 } // namespace WebCore |
| 159 | 167 |
| 160 #endif // IDBRequest_h | 168 #endif // IDBRequest_h |
| OLD | NEW |