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 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
136 } | 136 } |
137 if (!transaction_->IsActive()) { | 137 if (!transaction_->IsActive()) { |
138 exception_state.ThrowDOMException( | 138 exception_state.ThrowDOMException( |
139 kTransactionInactiveError, | 139 kTransactionInactiveError, |
140 IDBDatabase::kTransactionInactiveErrorMessage); | 140 IDBDatabase::kTransactionInactiveErrorMessage); |
141 return nullptr; | 141 return nullptr; |
142 } | 142 } |
143 WebIDBCursorDirection direction = | 143 WebIDBCursorDirection direction = |
144 IDBCursor::StringToDirection(direction_string); | 144 IDBCursor::StringToDirection(direction_string); |
145 IDBKeyRange* key_range = IDBKeyRange::FromScriptValue( | 145 IDBKeyRange* key_range = IDBKeyRange::FromScriptValue( |
146 script_state->GetExecutionContext(), range, exception_state); | 146 ExecutionContext::From(script_state), range, exception_state); |
147 if (exception_state.HadException()) | 147 if (exception_state.HadException()) |
148 return nullptr; | 148 return nullptr; |
149 | 149 |
150 if (!BackendDB()) { | 150 if (!BackendDB()) { |
151 exception_state.ThrowDOMException(kInvalidStateError, | 151 exception_state.ThrowDOMException(kInvalidStateError, |
152 IDBDatabase::kDatabaseClosedErrorMessage); | 152 IDBDatabase::kDatabaseClosedErrorMessage); |
153 return nullptr; | 153 return nullptr; |
154 } | 154 } |
155 | 155 |
156 return openCursor(script_state, key_range, direction); | 156 return openCursor(script_state, key_range, direction); |
(...skipping 27 matching lines...) Expand all Loading... |
184 return nullptr; | 184 return nullptr; |
185 } | 185 } |
186 if (!transaction_->IsActive()) { | 186 if (!transaction_->IsActive()) { |
187 exception_state.ThrowDOMException( | 187 exception_state.ThrowDOMException( |
188 kTransactionInactiveError, | 188 kTransactionInactiveError, |
189 IDBDatabase::kTransactionInactiveErrorMessage); | 189 IDBDatabase::kTransactionInactiveErrorMessage); |
190 return nullptr; | 190 return nullptr; |
191 } | 191 } |
192 | 192 |
193 IDBKeyRange* key_range = IDBKeyRange::FromScriptValue( | 193 IDBKeyRange* key_range = IDBKeyRange::FromScriptValue( |
194 script_state->GetExecutionContext(), range, exception_state); | 194 ExecutionContext::From(script_state), range, exception_state); |
195 if (exception_state.HadException()) | 195 if (exception_state.HadException()) |
196 return nullptr; | 196 return nullptr; |
197 | 197 |
198 if (!BackendDB()) { | 198 if (!BackendDB()) { |
199 exception_state.ThrowDOMException(kInvalidStateError, | 199 exception_state.ThrowDOMException(kInvalidStateError, |
200 IDBDatabase::kDatabaseClosedErrorMessage); | 200 IDBDatabase::kDatabaseClosedErrorMessage); |
201 return nullptr; | 201 return nullptr; |
202 } | 202 } |
203 | 203 |
204 IDBRequest* request = IDBRequest::Create(script_state, IDBAny::Create(this), | 204 IDBRequest* request = IDBRequest::Create(script_state, IDBAny::Create(this), |
(...skipping 21 matching lines...) Expand all Loading... |
226 } | 226 } |
227 if (!transaction_->IsActive()) { | 227 if (!transaction_->IsActive()) { |
228 exception_state.ThrowDOMException( | 228 exception_state.ThrowDOMException( |
229 kTransactionInactiveError, | 229 kTransactionInactiveError, |
230 IDBDatabase::kTransactionInactiveErrorMessage); | 230 IDBDatabase::kTransactionInactiveErrorMessage); |
231 return nullptr; | 231 return nullptr; |
232 } | 232 } |
233 WebIDBCursorDirection direction = | 233 WebIDBCursorDirection direction = |
234 IDBCursor::StringToDirection(direction_string); | 234 IDBCursor::StringToDirection(direction_string); |
235 IDBKeyRange* key_range = IDBKeyRange::FromScriptValue( | 235 IDBKeyRange* key_range = IDBKeyRange::FromScriptValue( |
236 script_state->GetExecutionContext(), range, exception_state); | 236 ExecutionContext::From(script_state), range, exception_state); |
237 if (exception_state.HadException()) | 237 if (exception_state.HadException()) |
238 return nullptr; | 238 return nullptr; |
239 if (!BackendDB()) { | 239 if (!BackendDB()) { |
240 exception_state.ThrowDOMException(kInvalidStateError, | 240 exception_state.ThrowDOMException(kInvalidStateError, |
241 IDBDatabase::kDatabaseClosedErrorMessage); | 241 IDBDatabase::kDatabaseClosedErrorMessage); |
242 return nullptr; | 242 return nullptr; |
243 } | 243 } |
244 | 244 |
245 IDBRequest* request = IDBRequest::Create(script_state, IDBAny::Create(this), | 245 IDBRequest* request = IDBRequest::Create(script_state, IDBAny::Create(this), |
246 transaction_.Get()); | 246 transaction_.Get()); |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
312 return nullptr; | 312 return nullptr; |
313 } | 313 } |
314 if (!transaction_->IsActive()) { | 314 if (!transaction_->IsActive()) { |
315 exception_state.ThrowDOMException( | 315 exception_state.ThrowDOMException( |
316 kTransactionInactiveError, | 316 kTransactionInactiveError, |
317 IDBDatabase::kTransactionInactiveErrorMessage); | 317 IDBDatabase::kTransactionInactiveErrorMessage); |
318 return nullptr; | 318 return nullptr; |
319 } | 319 } |
320 | 320 |
321 IDBKeyRange* key_range = IDBKeyRange::FromScriptValue( | 321 IDBKeyRange* key_range = IDBKeyRange::FromScriptValue( |
322 script_state->GetExecutionContext(), key, exception_state); | 322 ExecutionContext::From(script_state), key, exception_state); |
323 if (exception_state.HadException()) | 323 if (exception_state.HadException()) |
324 return nullptr; | 324 return nullptr; |
325 if (!key_range) { | 325 if (!key_range) { |
326 exception_state.ThrowDOMException( | 326 exception_state.ThrowDOMException( |
327 kDataError, IDBDatabase::kNoKeyOrKeyRangeErrorMessage); | 327 kDataError, IDBDatabase::kNoKeyOrKeyRangeErrorMessage); |
328 return nullptr; | 328 return nullptr; |
329 } | 329 } |
330 if (!BackendDB()) { | 330 if (!BackendDB()) { |
331 exception_state.ThrowDOMException(kInvalidStateError, | 331 exception_state.ThrowDOMException(kInvalidStateError, |
332 IDBDatabase::kDatabaseClosedErrorMessage); | 332 IDBDatabase::kDatabaseClosedErrorMessage); |
(...skipping 27 matching lines...) Expand all Loading... |
360 return nullptr; | 360 return nullptr; |
361 } | 361 } |
362 if (!transaction_->IsActive()) { | 362 if (!transaction_->IsActive()) { |
363 exception_state.ThrowDOMException( | 363 exception_state.ThrowDOMException( |
364 kTransactionInactiveError, | 364 kTransactionInactiveError, |
365 IDBDatabase::kTransactionInactiveErrorMessage); | 365 IDBDatabase::kTransactionInactiveErrorMessage); |
366 return nullptr; | 366 return nullptr; |
367 } | 367 } |
368 | 368 |
369 IDBKeyRange* key_range = IDBKeyRange::FromScriptValue( | 369 IDBKeyRange* key_range = IDBKeyRange::FromScriptValue( |
370 script_state->GetExecutionContext(), range, exception_state); | 370 ExecutionContext::From(script_state), range, exception_state); |
371 if (exception_state.HadException()) | 371 if (exception_state.HadException()) |
372 return nullptr; | 372 return nullptr; |
373 if (!BackendDB()) { | 373 if (!BackendDB()) { |
374 exception_state.ThrowDOMException(kInvalidStateError, | 374 exception_state.ThrowDOMException(kInvalidStateError, |
375 IDBDatabase::kDatabaseClosedErrorMessage); | 375 IDBDatabase::kDatabaseClosedErrorMessage); |
376 return nullptr; | 376 return nullptr; |
377 } | 377 } |
378 | 378 |
379 IDBRequest* request = IDBRequest::Create(script_state, IDBAny::Create(this), | 379 IDBRequest* request = IDBRequest::Create(script_state, IDBAny::Create(this), |
380 transaction_.Get()); | 380 transaction_.Get()); |
381 BackendDB()->GetAll(transaction_->Id(), object_store_->Id(), Id(), key_range, | 381 BackendDB()->GetAll(transaction_->Id(), object_store_->Id(), Id(), key_range, |
382 max_count, key_only, | 382 max_count, key_only, |
383 request->CreateWebCallbacks().release()); | 383 request->CreateWebCallbacks().release()); |
384 return request; | 384 return request; |
385 } | 385 } |
386 | 386 |
387 WebIDBDatabase* IDBIndex::BackendDB() const { | 387 WebIDBDatabase* IDBIndex::BackendDB() const { |
388 return transaction_->BackendDB(); | 388 return transaction_->BackendDB(); |
389 } | 389 } |
390 | 390 |
391 } // namespace blink | 391 } // namespace blink |
OLD | NEW |