Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(117)

Side by Side Diff: Source/modules/indexeddb/IDBCursor.cpp

Issue 18548003: Rename ExceptionCode constants to use the names in the spec (2/3) (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/modules/encryptedmedia/MediaKeys.cpp ('k') | Source/modules/indexeddb/IDBDatabase.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 IDBAny* IDBCursor::source() const 119 IDBAny* IDBCursor::source() const
120 { 120 {
121 return m_source.get(); 121 return m_source.get();
122 } 122 }
123 123
124 PassRefPtr<IDBRequest> IDBCursor::update(ScriptState* state, ScriptValue& value, ExceptionCode& ec) 124 PassRefPtr<IDBRequest> IDBCursor::update(ScriptState* state, ScriptValue& value, ExceptionCode& ec)
125 { 125 {
126 IDB_TRACE("IDBCursor::update"); 126 IDB_TRACE("IDBCursor::update");
127 127
128 if (!m_gotValue || isKeyCursor() || isDeleted()) { 128 if (!m_gotValue || isKeyCursor() || isDeleted()) {
129 ec = INVALID_STATE_ERR; 129 ec = InvalidStateError;
130 return 0; 130 return 0;
131 } 131 }
132 if (!m_transaction->isActive()) { 132 if (!m_transaction->isActive()) {
133 ec = TransactionInactiveError; 133 ec = TransactionInactiveError;
134 return 0; 134 return 0;
135 } 135 }
136 if (m_transaction->isReadOnly()) { 136 if (m_transaction->isReadOnly()) {
137 ec = ReadOnlyError; 137 ec = ReadOnlyError;
138 return 0; 138 return 0;
139 } 139 }
(...skipping 10 matching lines...) Expand all
150 } 150 }
151 151
152 return objectStore->put(IDBDatabaseBackendInterface::CursorUpdate, IDBAny::c reate(this), state, value, m_currentPrimaryKey, ec); 152 return objectStore->put(IDBDatabaseBackendInterface::CursorUpdate, IDBAny::c reate(this), state, value, m_currentPrimaryKey, ec);
153 } 153 }
154 154
155 void IDBCursor::advance(unsigned long count, ExceptionCode& ec) 155 void IDBCursor::advance(unsigned long count, ExceptionCode& ec)
156 { 156 {
157 ec = 0; 157 ec = 0;
158 IDB_TRACE("IDBCursor::advance"); 158 IDB_TRACE("IDBCursor::advance");
159 if (!m_gotValue || isDeleted()) { 159 if (!m_gotValue || isDeleted()) {
160 ec = INVALID_STATE_ERR; 160 ec = InvalidStateError;
161 return; 161 return;
162 } 162 }
163 163
164 if (!m_transaction->isActive()) { 164 if (!m_transaction->isActive()) {
165 ec = TransactionInactiveError; 165 ec = TransactionInactiveError;
166 return; 166 return;
167 } 167 }
168 168
169 if (!count) { 169 if (!count) {
170 ec = TypeError; 170 ec = TypeError;
(...skipping 20 matching lines...) Expand all
191 ec = DataError; 191 ec = DataError;
192 return; 192 return;
193 } 193 }
194 194
195 if (!m_transaction->isActive()) { 195 if (!m_transaction->isActive()) {
196 ec = TransactionInactiveError; 196 ec = TransactionInactiveError;
197 return; 197 return;
198 } 198 }
199 199
200 if (!m_gotValue || isDeleted()) { 200 if (!m_gotValue || isDeleted()) {
201 ec = INVALID_STATE_ERR; 201 ec = InvalidStateError;
202 return; 202 return;
203 } 203 }
204 204
205 if (key) { 205 if (key) {
206 ASSERT(m_currentKey); 206 ASSERT(m_currentKey);
207 if (m_direction == IndexedDB::CursorNext || m_direction == IndexedDB::Cu rsorNextNoDuplicate) { 207 if (m_direction == IndexedDB::CursorNext || m_direction == IndexedDB::Cu rsorNextNoDuplicate) {
208 if (!m_currentKey->isLessThan(key.get())) { 208 if (!m_currentKey->isLessThan(key.get())) {
209 ec = DataError; 209 ec = DataError;
210 return; 210 return;
211 } 211 }
(...skipping 19 matching lines...) Expand all
231 if (!m_transaction->isActive()) { 231 if (!m_transaction->isActive()) {
232 ec = TransactionInactiveError; 232 ec = TransactionInactiveError;
233 return 0; 233 return 0;
234 } 234 }
235 if (m_transaction->isReadOnly()) { 235 if (m_transaction->isReadOnly()) {
236 ec = ReadOnlyError; 236 ec = ReadOnlyError;
237 return 0; 237 return 0;
238 } 238 }
239 239
240 if (!m_gotValue || isKeyCursor() || isDeleted()) { 240 if (!m_gotValue || isKeyCursor() || isDeleted()) {
241 ec = INVALID_STATE_ERR; 241 ec = InvalidStateError;
242 return 0; 242 return 0;
243 } 243 }
244 244
245 RefPtr<IDBKeyRange> keyRange = IDBKeyRange::only(m_currentPrimaryKey, ec); 245 RefPtr<IDBKeyRange> keyRange = IDBKeyRange::only(m_currentPrimaryKey, ec);
246 ASSERT(!ec); 246 ASSERT(!ec);
247 247
248 RefPtr<IDBRequest> request = IDBRequest::create(context, IDBAny::create(this ), m_transaction.get()); 248 RefPtr<IDBRequest> request = IDBRequest::create(context, IDBAny::create(this ), m_transaction.get());
249 m_transaction->backendDB()->deleteRange(m_transaction->id(), effectiveObject Store()->id(), keyRange, request); 249 m_transaction->backendDB()->deleteRange(m_transaction->id(), effectiveObject Store()->id(), keyRange, request);
250 return request.release(); 250 return request.release();
251 } 251 }
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
335 case IndexedDB::CursorPrevNoDuplicate: 335 case IndexedDB::CursorPrevNoDuplicate:
336 return IDBCursor::directionPrevUnique(); 336 return IDBCursor::directionPrevUnique();
337 337
338 default: 338 default:
339 ASSERT_NOT_REACHED(); 339 ASSERT_NOT_REACHED();
340 return IDBCursor::directionNext(); 340 return IDBCursor::directionNext();
341 } 341 }
342 } 342 }
343 343
344 } // namespace WebCore 344 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/modules/encryptedmedia/MediaKeys.cpp ('k') | Source/modules/indexeddb/IDBDatabase.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698