| 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 { | 113 { |
| 114 IDB_TRACE("IDBCursor::value"); | 114 IDB_TRACE("IDBCursor::value"); |
| 115 return m_currentValue; | 115 return m_currentValue; |
| 116 } | 116 } |
| 117 | 117 |
| 118 IDBAny* IDBCursor::source() const | 118 IDBAny* IDBCursor::source() const |
| 119 { | 119 { |
| 120 return m_source.get(); | 120 return m_source.get(); |
| 121 } | 121 } |
| 122 | 122 |
| 123 PassRefPtr<IDBRequest> IDBCursor::update(ScriptState* state, ScriptValue& value,
ExceptionCode& ec) | 123 IDBRequest* IDBCursor::update(ScriptState* state, ScriptValue& value, ExceptionC
ode& ec) |
| 124 { | 124 { |
| 125 IDB_TRACE("IDBCursor::update"); | 125 IDB_TRACE("IDBCursor::update"); |
| 126 | 126 |
| 127 if (!m_gotValue || isKeyCursor() || isDeleted()) { | 127 if (!m_gotValue || isKeyCursor() || isDeleted()) { |
| 128 ec = IDBDatabaseException::InvalidStateError; | 128 ec = IDBDatabaseException::InvalidStateError; |
| 129 return 0; | 129 return 0; |
| 130 } | 130 } |
| 131 if (!m_transaction->isActive()) { | 131 if (!m_transaction->isActive()) { |
| 132 ec = IDBDatabaseException::TransactionInactiveError; | 132 ec = IDBDatabaseException::TransactionInactiveError; |
| 133 return 0; | 133 return 0; |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 216 } | 216 } |
| 217 } | 217 } |
| 218 | 218 |
| 219 // FIXME: We're not using the context from when continue was called, which m
eans the callback | 219 // FIXME: We're not using the context from when continue was called, which m
eans the callback |
| 220 // will be on the original context openCursor was called on. Is this
right? | 220 // will be on the original context openCursor was called on. Is this
right? |
| 221 m_request->setPendingCursor(this); | 221 m_request->setPendingCursor(this); |
| 222 m_gotValue = false; | 222 m_gotValue = false; |
| 223 m_backend->continueFunction(key, m_request); | 223 m_backend->continueFunction(key, m_request); |
| 224 } | 224 } |
| 225 | 225 |
| 226 PassRefPtr<IDBRequest> IDBCursor::deleteFunction(ScriptExecutionContext* context
, ExceptionCode& ec) | 226 IDBRequest* IDBCursor::deleteFunction(ScriptExecutionContext* context, Exception
Code& ec) |
| 227 { | 227 { |
| 228 ec = 0; | 228 ec = 0; |
| 229 IDB_TRACE("IDBCursor::delete"); | 229 IDB_TRACE("IDBCursor::delete"); |
| 230 if (!m_transaction->isActive()) { | 230 if (!m_transaction->isActive()) { |
| 231 ec = IDBDatabaseException::TransactionInactiveError; | 231 ec = IDBDatabaseException::TransactionInactiveError; |
| 232 return 0; | 232 return 0; |
| 233 } | 233 } |
| 234 if (m_transaction->isReadOnly()) { | 234 if (m_transaction->isReadOnly()) { |
| 235 ec = IDBDatabaseException::ReadOnlyError; | 235 ec = IDBDatabaseException::ReadOnlyError; |
| 236 return 0; | 236 return 0; |
| 237 } | 237 } |
| 238 | 238 |
| 239 if (!m_gotValue || isKeyCursor() || isDeleted()) { | 239 if (!m_gotValue || isKeyCursor() || isDeleted()) { |
| 240 ec = IDBDatabaseException::InvalidStateError; | 240 ec = IDBDatabaseException::InvalidStateError; |
| 241 return 0; | 241 return 0; |
| 242 } | 242 } |
| 243 RefPtr<IDBRequest> request = IDBRequest::create(context, IDBAny::create(this
), m_transaction.get()); | 243 IDBRequest* request = IDBRequest::create(context, IDBAny::create(this), m_tr
ansaction.get()); |
| 244 m_backend->deleteFunction(request); | 244 m_backend->deleteFunction(request); |
| 245 return request.release(); | 245 return request; |
| 246 } | 246 } |
| 247 | 247 |
| 248 void IDBCursor::postSuccessHandlerCallback() | 248 void IDBCursor::postSuccessHandlerCallback() |
| 249 { | 249 { |
| 250 m_backend->postSuccessHandlerCallback(); | 250 m_backend->postSuccessHandlerCallback(); |
| 251 } | 251 } |
| 252 | 252 |
| 253 void IDBCursor::close() | 253 void IDBCursor::close() |
| 254 { | 254 { |
| 255 m_transactionNotifier.cursorFinished(); | 255 m_transactionNotifier.cursorFinished(); |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 330 case IndexedDB::CursorPrevNoDuplicate: | 330 case IndexedDB::CursorPrevNoDuplicate: |
| 331 return IDBCursor::directionPrevUnique(); | 331 return IDBCursor::directionPrevUnique(); |
| 332 | 332 |
| 333 default: | 333 default: |
| 334 ASSERT_NOT_REACHED(); | 334 ASSERT_NOT_REACHED(); |
| 335 return IDBCursor::directionNext(); | 335 return IDBCursor::directionNext(); |
| 336 } | 336 } |
| 337 } | 337 } |
| 338 | 338 |
| 339 } // namespace WebCore | 339 } // namespace WebCore |
| OLD | NEW |