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 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 return 0; | 79 return 0; |
80 } | 80 } |
81 if (m_transaction->isFinished() || m_transaction->isFinishing()) { | 81 if (m_transaction->isFinished() || m_transaction->isFinishing()) { |
82 exceptionState.throwDOMException(TransactionInactiveError, IDBDatabase::
transactionFinishedErrorMessage); | 82 exceptionState.throwDOMException(TransactionInactiveError, IDBDatabase::
transactionFinishedErrorMessage); |
83 return 0; | 83 return 0; |
84 } | 84 } |
85 if (!m_transaction->isActive()) { | 85 if (!m_transaction->isActive()) { |
86 exceptionState.throwDOMException(TransactionInactiveError, IDBDatabase::
transactionInactiveErrorMessage); | 86 exceptionState.throwDOMException(TransactionInactiveError, IDBDatabase::
transactionInactiveErrorMessage); |
87 return 0; | 87 return 0; |
88 } | 88 } |
89 WebIDBCursor::Direction direction = IDBCursor::stringToDirection(directionSt
ring, exceptionState); | 89 blink::WebIDBCursorDirection direction = IDBCursor::stringToDirection(direct
ionString, exceptionState); |
90 if (exceptionState.hadException()) | 90 if (exceptionState.hadException()) |
91 return 0; | 91 return 0; |
92 | 92 |
93 IDBKeyRange* keyRange = IDBKeyRange::fromScriptValue(scriptState->executionC
ontext(), range, exceptionState); | 93 IDBKeyRange* keyRange = IDBKeyRange::fromScriptValue(scriptState->executionC
ontext(), range, exceptionState); |
94 if (exceptionState.hadException()) | 94 if (exceptionState.hadException()) |
95 return 0; | 95 return 0; |
96 | 96 |
97 if (!backendDB()) { | 97 if (!backendDB()) { |
98 exceptionState.throwDOMException(InvalidStateError, IDBDatabase::databas
eClosedErrorMessage); | 98 exceptionState.throwDOMException(InvalidStateError, IDBDatabase::databas
eClosedErrorMessage); |
99 return 0; | 99 return 0; |
100 } | 100 } |
101 | 101 |
102 return openCursor(scriptState, keyRange, direction); | 102 return openCursor(scriptState, keyRange, direction); |
103 } | 103 } |
104 | 104 |
105 IDBRequest* IDBIndex::openCursor(ScriptState* scriptState, IDBKeyRange* keyRange
, WebIDBCursor::Direction direction) | 105 IDBRequest* IDBIndex::openCursor(ScriptState* scriptState, IDBKeyRange* keyRange
, blink::WebIDBCursorDirection direction) |
106 { | 106 { |
107 IDBRequest* request = IDBRequest::create(scriptState, IDBAny::create(this),
m_transaction.get()); | 107 IDBRequest* request = IDBRequest::create(scriptState, IDBAny::create(this),
m_transaction.get()); |
108 request->setCursorDetails(IndexedDB::CursorKeyAndValue, direction); | 108 request->setCursorDetails(IndexedDB::CursorKeyAndValue, direction); |
109 backendDB()->openCursor(m_transaction->id(), m_objectStore->id(), m_metadata
.id, keyRange, direction, false, WebIDBDatabase::NormalTask, WebIDBCallbacksImpl
::create(request).leakPtr()); | 109 backendDB()->openCursor(m_transaction->id(), m_objectStore->id(), m_metadata
.id, keyRange, direction, false, blink::WebIDBTaskTypeNormal, WebIDBCallbacksImp
l::create(request).leakPtr()); |
110 return request; | 110 return request; |
111 } | 111 } |
112 | 112 |
113 IDBRequest* IDBIndex::count(ScriptState* scriptState, const ScriptValue& range,
ExceptionState& exceptionState) | 113 IDBRequest* IDBIndex::count(ScriptState* scriptState, const ScriptValue& range,
ExceptionState& exceptionState) |
114 { | 114 { |
115 IDB_TRACE("IDBIndex::count"); | 115 IDB_TRACE("IDBIndex::count"); |
116 if (isDeleted()) { | 116 if (isDeleted()) { |
117 exceptionState.throwDOMException(InvalidStateError, IDBDatabase::indexDe
letedErrorMessage); | 117 exceptionState.throwDOMException(InvalidStateError, IDBDatabase::indexDe
letedErrorMessage); |
118 return 0; | 118 return 0; |
119 } | 119 } |
(...skipping 28 matching lines...) Expand all Loading... |
148 return 0; | 148 return 0; |
149 } | 149 } |
150 if (m_transaction->isFinished() || m_transaction->isFinishing()) { | 150 if (m_transaction->isFinished() || m_transaction->isFinishing()) { |
151 exceptionState.throwDOMException(TransactionInactiveError, IDBDatabase::
transactionFinishedErrorMessage); | 151 exceptionState.throwDOMException(TransactionInactiveError, IDBDatabase::
transactionFinishedErrorMessage); |
152 return 0; | 152 return 0; |
153 } | 153 } |
154 if (!m_transaction->isActive()) { | 154 if (!m_transaction->isActive()) { |
155 exceptionState.throwDOMException(TransactionInactiveError, IDBDatabase::
transactionInactiveErrorMessage); | 155 exceptionState.throwDOMException(TransactionInactiveError, IDBDatabase::
transactionInactiveErrorMessage); |
156 return 0; | 156 return 0; |
157 } | 157 } |
158 WebIDBCursor::Direction direction = IDBCursor::stringToDirection(directionSt
ring, exceptionState); | 158 blink::WebIDBCursorDirection direction = IDBCursor::stringToDirection(direct
ionString, exceptionState); |
159 if (exceptionState.hadException()) | 159 if (exceptionState.hadException()) |
160 return 0; | 160 return 0; |
161 | 161 |
162 IDBKeyRange* keyRange = IDBKeyRange::fromScriptValue(scriptState->executionC
ontext(), range, exceptionState); | 162 IDBKeyRange* keyRange = IDBKeyRange::fromScriptValue(scriptState->executionC
ontext(), range, exceptionState); |
163 if (exceptionState.hadException()) | 163 if (exceptionState.hadException()) |
164 return 0; | 164 return 0; |
165 if (!backendDB()) { | 165 if (!backendDB()) { |
166 exceptionState.throwDOMException(InvalidStateError, IDBDatabase::databas
eClosedErrorMessage); | 166 exceptionState.throwDOMException(InvalidStateError, IDBDatabase::databas
eClosedErrorMessage); |
167 return 0; | 167 return 0; |
168 } | 168 } |
169 | 169 |
170 IDBRequest* request = IDBRequest::create(scriptState, IDBAny::create(this),
m_transaction.get()); | 170 IDBRequest* request = IDBRequest::create(scriptState, IDBAny::create(this),
m_transaction.get()); |
171 request->setCursorDetails(IndexedDB::CursorKeyOnly, direction); | 171 request->setCursorDetails(IndexedDB::CursorKeyOnly, direction); |
172 backendDB()->openCursor(m_transaction->id(), m_objectStore->id(), m_metadata
.id, keyRange, direction, true, WebIDBDatabase::NormalTask, WebIDBCallbacksImpl:
:create(request).leakPtr()); | 172 backendDB()->openCursor(m_transaction->id(), m_objectStore->id(), m_metadata
.id, keyRange, direction, true, blink::WebIDBTaskTypeNormal, WebIDBCallbacksImpl
::create(request).leakPtr()); |
173 return request; | 173 return request; |
174 } | 174 } |
175 | 175 |
176 IDBRequest* IDBIndex::get(ScriptState* scriptState, const ScriptValue& key, Exce
ptionState& exceptionState) | 176 IDBRequest* IDBIndex::get(ScriptState* scriptState, const ScriptValue& key, Exce
ptionState& exceptionState) |
177 { | 177 { |
178 IDB_TRACE("IDBIndex::get"); | 178 IDB_TRACE("IDBIndex::get"); |
179 return getInternal(scriptState, key, exceptionState, false); | 179 return getInternal(scriptState, key, exceptionState, false); |
180 } | 180 } |
181 | 181 |
182 IDBRequest* IDBIndex::getKey(ScriptState* scriptState, const ScriptValue& key, E
xceptionState& exceptionState) | 182 IDBRequest* IDBIndex::getKey(ScriptState* scriptState, const ScriptValue& key, E
xceptionState& exceptionState) |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
221 { | 221 { |
222 return m_transaction->backendDB(); | 222 return m_transaction->backendDB(); |
223 } | 223 } |
224 | 224 |
225 bool IDBIndex::isDeleted() const | 225 bool IDBIndex::isDeleted() const |
226 { | 226 { |
227 return m_deleted || m_objectStore->isDeleted(); | 227 return m_deleted || m_objectStore->isDeleted(); |
228 } | 228 } |
229 | 229 |
230 } // namespace WebCore | 230 } // namespace WebCore |
OLD | NEW |