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

Side by Side Diff: content/browser/indexed_db/database_impl.cc

Issue 2941353002: Indexed DB: Use BindOnce / OnceCallback / OnceClosure where applicable (Closed)
Patch Set: Created 3 years, 6 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
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/browser/indexed_db/database_impl.h" 5 #include "content/browser/indexed_db/database_impl.h"
6 6
7 #include "base/memory/ptr_util.h" 7 #include "base/memory/ptr_util.h"
8 #include "base/metrics/histogram_macros.h" 8 #include "base/metrics/histogram_macros.h"
9 #include "base/numerics/safe_math.h" 9 #include "base/numerics/safe_math.h"
10 #include "base/sequence_checker.h" 10 #include "base/sequence_checker.h"
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 const url::Origin& origin, 147 const url::Origin& origin,
148 IndexedDBDispatcherHost* dispatcher_host, 148 IndexedDBDispatcherHost* dispatcher_host,
149 scoped_refptr<base::SequencedTaskRunner> idb_runner) 149 scoped_refptr<base::SequencedTaskRunner> idb_runner)
150 : dispatcher_host_(dispatcher_host), 150 : dispatcher_host_(dispatcher_host),
151 origin_(origin), 151 origin_(origin),
152 idb_runner_(std::move(idb_runner)) { 152 idb_runner_(std::move(idb_runner)) {
153 DCHECK(connection); 153 DCHECK(connection);
154 helper_ = new IDBSequenceHelper(std::move(connection), origin, 154 helper_ = new IDBSequenceHelper(std::move(connection), origin,
155 dispatcher_host->context()); 155 dispatcher_host->context());
156 idb_runner_->PostTask(FROM_HERE, 156 idb_runner_->PostTask(FROM_HERE,
157 base::Bind(&IDBSequenceHelper::ConnectionOpened, 157 base::BindOnce(&IDBSequenceHelper::ConnectionOpened,
158 base::Unretained(helper_))); 158 base::Unretained(helper_)));
159 } 159 }
160 160
161 DatabaseImpl::~DatabaseImpl() { 161 DatabaseImpl::~DatabaseImpl() {
162 idb_runner_->DeleteSoon(FROM_HERE, helper_); 162 idb_runner_->DeleteSoon(FROM_HERE, helper_);
163 } 163 }
164 164
165 void DatabaseImpl::CreateObjectStore(int64_t transaction_id, 165 void DatabaseImpl::CreateObjectStore(int64_t transaction_id,
166 int64_t object_store_id, 166 int64_t object_store_id,
167 const base::string16& name, 167 const base::string16& name,
168 const IndexedDBKeyPath& key_path, 168 const IndexedDBKeyPath& key_path,
169 bool auto_increment) { 169 bool auto_increment) {
170 idb_runner_->PostTask( 170 idb_runner_->PostTask(
171 FROM_HERE, base::Bind(&IDBSequenceHelper::CreateObjectStore, 171 FROM_HERE,
172 base::Unretained(helper_), transaction_id, 172 base::BindOnce(&IDBSequenceHelper::CreateObjectStore,
173 object_store_id, name, key_path, auto_increment)); 173 base::Unretained(helper_), transaction_id, object_store_id,
174 name, key_path, auto_increment));
174 } 175 }
175 176
176 void DatabaseImpl::DeleteObjectStore(int64_t transaction_id, 177 void DatabaseImpl::DeleteObjectStore(int64_t transaction_id,
177 int64_t object_store_id) { 178 int64_t object_store_id) {
178 idb_runner_->PostTask( 179 idb_runner_->PostTask(
179 FROM_HERE, 180 FROM_HERE, base::BindOnce(&IDBSequenceHelper::DeleteObjectStore,
180 base::Bind(&IDBSequenceHelper::DeleteObjectStore, 181 base::Unretained(helper_), transaction_id,
181 base::Unretained(helper_), transaction_id, object_store_id)); 182 object_store_id));
182 } 183 }
183 184
184 void DatabaseImpl::RenameObjectStore(int64_t transaction_id, 185 void DatabaseImpl::RenameObjectStore(int64_t transaction_id,
185 int64_t object_store_id, 186 int64_t object_store_id,
186 const base::string16& new_name) { 187 const base::string16& new_name) {
187 idb_runner_->PostTask(FROM_HERE, 188 idb_runner_->PostTask(
188 base::Bind(&IDBSequenceHelper::RenameObjectStore, 189 FROM_HERE, base::BindOnce(&IDBSequenceHelper::RenameObjectStore,
189 base::Unretained(helper_), transaction_id, 190 base::Unretained(helper_), transaction_id,
190 object_store_id, new_name)); 191 object_store_id, new_name));
191 } 192 }
192 193
193 void DatabaseImpl::CreateTransaction( 194 void DatabaseImpl::CreateTransaction(
194 int64_t transaction_id, 195 int64_t transaction_id,
195 const std::vector<int64_t>& object_store_ids, 196 const std::vector<int64_t>& object_store_ids,
196 blink::WebIDBTransactionMode mode) { 197 blink::WebIDBTransactionMode mode) {
197 idb_runner_->PostTask(FROM_HERE, 198 idb_runner_->PostTask(
198 base::Bind(&IDBSequenceHelper::CreateTransaction, 199 FROM_HERE, base::BindOnce(&IDBSequenceHelper::CreateTransaction,
199 base::Unretained(helper_), transaction_id, 200 base::Unretained(helper_), transaction_id,
200 object_store_ids, mode)); 201 object_store_ids, mode));
201 } 202 }
202 203
203 void DatabaseImpl::Close() { 204 void DatabaseImpl::Close() {
204 idb_runner_->PostTask(FROM_HERE, base::Bind(&IDBSequenceHelper::Close, 205 idb_runner_->PostTask(FROM_HERE, base::BindOnce(&IDBSequenceHelper::Close,
205 base::Unretained(helper_))); 206 base::Unretained(helper_)));
206 } 207 }
207 208
208 void DatabaseImpl::VersionChangeIgnored() { 209 void DatabaseImpl::VersionChangeIgnored() {
209 idb_runner_->PostTask(FROM_HERE, 210 idb_runner_->PostTask(FROM_HERE,
210 base::Bind(&IDBSequenceHelper::VersionChangeIgnored, 211 base::BindOnce(&IDBSequenceHelper::VersionChangeIgnored,
211 base::Unretained(helper_))); 212 base::Unretained(helper_)));
212 } 213 }
213 214
214 void DatabaseImpl::AddObserver(int64_t transaction_id, 215 void DatabaseImpl::AddObserver(int64_t transaction_id,
215 int32_t observer_id, 216 int32_t observer_id,
216 bool include_transaction, 217 bool include_transaction,
217 bool no_records, 218 bool no_records,
218 bool values, 219 bool values,
219 uint16_t operation_types) { 220 uint16_t operation_types) {
220 idb_runner_->PostTask( 221 idb_runner_->PostTask(
221 FROM_HERE, 222 FROM_HERE,
222 base::Bind(&IDBSequenceHelper::AddObserver, base::Unretained(helper_), 223 base::BindOnce(&IDBSequenceHelper::AddObserver, base::Unretained(helper_),
223 transaction_id, observer_id, include_transaction, no_records, 224 transaction_id, observer_id, include_transaction,
224 values, operation_types)); 225 no_records, values, operation_types));
225 } 226 }
226 227
227 void DatabaseImpl::RemoveObservers(const std::vector<int32_t>& observers) { 228 void DatabaseImpl::RemoveObservers(const std::vector<int32_t>& observers) {
228 idb_runner_->PostTask(FROM_HERE, 229 idb_runner_->PostTask(FROM_HERE,
229 base::Bind(&IDBSequenceHelper::RemoveObservers, 230 base::BindOnce(&IDBSequenceHelper::RemoveObservers,
230 base::Unretained(helper_), observers)); 231 base::Unretained(helper_), observers));
231 } 232 }
232 233
233 void DatabaseImpl::Get( 234 void DatabaseImpl::Get(
234 int64_t transaction_id, 235 int64_t transaction_id,
235 int64_t object_store_id, 236 int64_t object_store_id,
236 int64_t index_id, 237 int64_t index_id,
237 const IndexedDBKeyRange& key_range, 238 const IndexedDBKeyRange& key_range,
238 bool key_only, 239 bool key_only,
239 ::indexed_db::mojom::CallbacksAssociatedPtrInfo callbacks_info) { 240 ::indexed_db::mojom::CallbacksAssociatedPtrInfo callbacks_info) {
240 scoped_refptr<IndexedDBCallbacks> callbacks( 241 scoped_refptr<IndexedDBCallbacks> callbacks(
241 new IndexedDBCallbacks(dispatcher_host_->AsWeakPtr(), origin_, 242 new IndexedDBCallbacks(dispatcher_host_->AsWeakPtr(), origin_,
242 std::move(callbacks_info), idb_runner_)); 243 std::move(callbacks_info), idb_runner_));
243 idb_runner_->PostTask( 244 idb_runner_->PostTask(
244 FROM_HERE, base::Bind(&IDBSequenceHelper::Get, base::Unretained(helper_), 245 FROM_HERE,
245 transaction_id, object_store_id, index_id, 246 base::BindOnce(&IDBSequenceHelper::Get, base::Unretained(helper_),
246 key_range, key_only, base::Passed(&callbacks))); 247 transaction_id, object_store_id, index_id, key_range,
248 key_only, base::Passed(&callbacks)));
247 } 249 }
248 250
249 void DatabaseImpl::GetAll( 251 void DatabaseImpl::GetAll(
250 int64_t transaction_id, 252 int64_t transaction_id,
251 int64_t object_store_id, 253 int64_t object_store_id,
252 int64_t index_id, 254 int64_t index_id,
253 const IndexedDBKeyRange& key_range, 255 const IndexedDBKeyRange& key_range,
254 bool key_only, 256 bool key_only,
255 int64_t max_count, 257 int64_t max_count,
256 ::indexed_db::mojom::CallbacksAssociatedPtrInfo callbacks_info) { 258 ::indexed_db::mojom::CallbacksAssociatedPtrInfo callbacks_info) {
257 scoped_refptr<IndexedDBCallbacks> callbacks( 259 scoped_refptr<IndexedDBCallbacks> callbacks(
258 new IndexedDBCallbacks(dispatcher_host_->AsWeakPtr(), origin_, 260 new IndexedDBCallbacks(dispatcher_host_->AsWeakPtr(), origin_,
259 std::move(callbacks_info), idb_runner_)); 261 std::move(callbacks_info), idb_runner_));
260 idb_runner_->PostTask( 262 idb_runner_->PostTask(
261 FROM_HERE, 263 FROM_HERE,
262 base::Bind(&IDBSequenceHelper::GetAll, base::Unretained(helper_), 264 base::BindOnce(&IDBSequenceHelper::GetAll, base::Unretained(helper_),
263 transaction_id, object_store_id, index_id, key_range, key_only, 265 transaction_id, object_store_id, index_id, key_range,
264 max_count, base::Passed(&callbacks))); 266 key_only, max_count, base::Passed(&callbacks)));
265 } 267 }
266 268
267 void DatabaseImpl::Put( 269 void DatabaseImpl::Put(
268 int64_t transaction_id, 270 int64_t transaction_id,
269 int64_t object_store_id, 271 int64_t object_store_id,
270 ::indexed_db::mojom::ValuePtr value, 272 ::indexed_db::mojom::ValuePtr value,
271 const IndexedDBKey& key, 273 const IndexedDBKey& key,
272 blink::WebIDBPutMode mode, 274 blink::WebIDBPutMode mode,
273 const std::vector<IndexedDBIndexKeys>& index_keys, 275 const std::vector<IndexedDBIndexKeys>& index_keys,
274 ::indexed_db::mojom::CallbacksAssociatedPtrInfo callbacks_info) { 276 ::indexed_db::mojom::CallbacksAssociatedPtrInfo callbacks_info) {
(...skipping 17 matching lines...) Expand all
292 294
293 // Due to known issue crbug.com/351753, blobs can die while being passed to 295 // Due to known issue crbug.com/351753, blobs can die while being passed to
294 // a different process. So this case must be handled gracefully. 296 // a different process. So this case must be handled gracefully.
295 // TODO(dmurph): Revert back to using mojo::ReportBadMessage once fixed. 297 // TODO(dmurph): Revert back to using mojo::ReportBadMessage once fixed.
296 UMA_HISTOGRAM_BOOLEAN("Storage.IndexedDB.PutValidBlob", 298 UMA_HISTOGRAM_BOOLEAN("Storage.IndexedDB.PutValidBlob",
297 handle.get() != nullptr); 299 handle.get() != nullptr);
298 if (!handle) { 300 if (!handle) {
299 IndexedDBDatabaseError error(blink::kWebIDBDatabaseExceptionUnknownError, 301 IndexedDBDatabaseError error(blink::kWebIDBDatabaseExceptionUnknownError,
300 kInvalidBlobUuid); 302 kInvalidBlobUuid);
301 idb_runner_->PostTask( 303 idb_runner_->PostTask(
302 FROM_HERE, base::Bind(&IDBSequenceHelper::AbortWithError, 304 FROM_HERE, base::BindOnce(&IDBSequenceHelper::AbortWithError,
303 base::Unretained(helper_), transaction_id, 305 base::Unretained(helper_), transaction_id,
304 base::Passed(&callbacks), error)); 306 base::Passed(&callbacks), error));
305 return; 307 return;
306 } 308 }
307 uint64_t size = handle->size(); 309 uint64_t size = handle->size();
308 UMA_HISTOGRAM_MEMORY_KB("Storage.IndexedDB.PutBlobSizeKB", size / 1024ull); 310 UMA_HISTOGRAM_MEMORY_KB("Storage.IndexedDB.PutBlobSizeKB", size / 1024ull);
309 total_blob_size += size; 311 total_blob_size += size;
310 handles[i] = std::move(handle); 312 handles[i] = std::move(handle);
311 313
312 if (info->file) { 314 if (info->file) {
313 if (!info->file->path.empty() && 315 if (!info->file->path.empty() &&
314 !policy->CanReadFile(dispatcher_host_->ipc_process_id(), 316 !policy->CanReadFile(dispatcher_host_->ipc_process_id(),
(...skipping 15 matching lines...) Expand all
330 blob_info.size()); 332 blob_info.size());
331 uint64_t blob_size = 0; 333 uint64_t blob_size = 0;
332 total_blob_size.AssignIfValid(&blob_size); 334 total_blob_size.AssignIfValid(&blob_size);
333 if (blob_size != 0) { 335 if (blob_size != 0) {
334 // 1KB to 1GB. 336 // 1KB to 1GB.
335 UMA_HISTOGRAM_COUNTS_1M("WebCore.IndexedDB.PutBlobsTotalSize", 337 UMA_HISTOGRAM_COUNTS_1M("WebCore.IndexedDB.PutBlobsTotalSize",
336 blob_size / 1024); 338 blob_size / 1024);
337 } 339 }
338 idb_runner_->PostTask( 340 idb_runner_->PostTask(
339 FROM_HERE, 341 FROM_HERE,
340 base::Bind(&IDBSequenceHelper::Put, base::Unretained(helper_), 342 base::BindOnce(&IDBSequenceHelper::Put, base::Unretained(helper_),
341 transaction_id, object_store_id, base::Passed(&value), 343 transaction_id, object_store_id, base::Passed(&value),
342 base::Passed(&handles), base::Passed(&blob_info), key, mode, 344 base::Passed(&handles), base::Passed(&blob_info), key,
343 index_keys, base::Passed(&callbacks))); 345 mode, index_keys, base::Passed(&callbacks)));
344 } 346 }
345 347
346 void DatabaseImpl::SetIndexKeys( 348 void DatabaseImpl::SetIndexKeys(
347 int64_t transaction_id, 349 int64_t transaction_id,
348 int64_t object_store_id, 350 int64_t object_store_id,
349 const IndexedDBKey& primary_key, 351 const IndexedDBKey& primary_key,
350 const std::vector<IndexedDBIndexKeys>& index_keys) { 352 const std::vector<IndexedDBIndexKeys>& index_keys) {
351 idb_runner_->PostTask( 353 idb_runner_->PostTask(
352 FROM_HERE, 354 FROM_HERE, base::BindOnce(&IDBSequenceHelper::SetIndexKeys,
353 base::Bind(&IDBSequenceHelper::SetIndexKeys, base::Unretained(helper_), 355 base::Unretained(helper_), transaction_id,
354 transaction_id, object_store_id, primary_key, index_keys)); 356 object_store_id, primary_key, index_keys));
355 } 357 }
356 358
357 void DatabaseImpl::SetIndexesReady(int64_t transaction_id, 359 void DatabaseImpl::SetIndexesReady(int64_t transaction_id,
358 int64_t object_store_id, 360 int64_t object_store_id,
359 const std::vector<int64_t>& index_ids) { 361 const std::vector<int64_t>& index_ids) {
360 idb_runner_->PostTask( 362 idb_runner_->PostTask(
361 FROM_HERE, 363 FROM_HERE, base::BindOnce(&IDBSequenceHelper::SetIndexesReady,
362 base::Bind(&IDBSequenceHelper::SetIndexesReady, base::Unretained(helper_), 364 base::Unretained(helper_), transaction_id,
363 transaction_id, object_store_id, index_ids)); 365 object_store_id, index_ids));
364 } 366 }
365 367
366 void DatabaseImpl::OpenCursor( 368 void DatabaseImpl::OpenCursor(
367 int64_t transaction_id, 369 int64_t transaction_id,
368 int64_t object_store_id, 370 int64_t object_store_id,
369 int64_t index_id, 371 int64_t index_id,
370 const IndexedDBKeyRange& key_range, 372 const IndexedDBKeyRange& key_range,
371 blink::WebIDBCursorDirection direction, 373 blink::WebIDBCursorDirection direction,
372 bool key_only, 374 bool key_only,
373 blink::WebIDBTaskType task_type, 375 blink::WebIDBTaskType task_type,
374 ::indexed_db::mojom::CallbacksAssociatedPtrInfo callbacks_info) { 376 ::indexed_db::mojom::CallbacksAssociatedPtrInfo callbacks_info) {
375 scoped_refptr<IndexedDBCallbacks> callbacks( 377 scoped_refptr<IndexedDBCallbacks> callbacks(
376 new IndexedDBCallbacks(dispatcher_host_->AsWeakPtr(), origin_, 378 new IndexedDBCallbacks(dispatcher_host_->AsWeakPtr(), origin_,
377 std::move(callbacks_info), idb_runner_)); 379 std::move(callbacks_info), idb_runner_));
378 idb_runner_->PostTask( 380 idb_runner_->PostTask(
379 FROM_HERE, 381 FROM_HERE,
380 base::Bind(&IDBSequenceHelper::OpenCursor, base::Unretained(helper_), 382 base::BindOnce(&IDBSequenceHelper::OpenCursor, base::Unretained(helper_),
381 transaction_id, object_store_id, index_id, key_range, 383 transaction_id, object_store_id, index_id, key_range,
382 direction, key_only, task_type, base::Passed(&callbacks))); 384 direction, key_only, task_type, base::Passed(&callbacks)));
383 } 385 }
384 386
385 void DatabaseImpl::Count( 387 void DatabaseImpl::Count(
386 int64_t transaction_id, 388 int64_t transaction_id,
387 int64_t object_store_id, 389 int64_t object_store_id,
388 int64_t index_id, 390 int64_t index_id,
389 const IndexedDBKeyRange& key_range, 391 const IndexedDBKeyRange& key_range,
390 ::indexed_db::mojom::CallbacksAssociatedPtrInfo callbacks_info) { 392 ::indexed_db::mojom::CallbacksAssociatedPtrInfo callbacks_info) {
391 scoped_refptr<IndexedDBCallbacks> callbacks( 393 scoped_refptr<IndexedDBCallbacks> callbacks(
392 new IndexedDBCallbacks(dispatcher_host_->AsWeakPtr(), origin_, 394 new IndexedDBCallbacks(dispatcher_host_->AsWeakPtr(), origin_,
393 std::move(callbacks_info), idb_runner_)); 395 std::move(callbacks_info), idb_runner_));
394 idb_runner_->PostTask( 396 idb_runner_->PostTask(
395 FROM_HERE, 397 FROM_HERE,
396 base::Bind(&IDBSequenceHelper::Count, base::Unretained(helper_), 398 base::BindOnce(&IDBSequenceHelper::Count, base::Unretained(helper_),
397 transaction_id, object_store_id, index_id, key_range, 399 transaction_id, object_store_id, index_id, key_range,
398 base::Passed(&callbacks))); 400 base::Passed(&callbacks)));
399 } 401 }
400 402
401 void DatabaseImpl::DeleteRange( 403 void DatabaseImpl::DeleteRange(
402 int64_t transaction_id, 404 int64_t transaction_id,
403 int64_t object_store_id, 405 int64_t object_store_id,
404 const IndexedDBKeyRange& key_range, 406 const IndexedDBKeyRange& key_range,
405 ::indexed_db::mojom::CallbacksAssociatedPtrInfo callbacks_info) { 407 ::indexed_db::mojom::CallbacksAssociatedPtrInfo callbacks_info) {
406 scoped_refptr<IndexedDBCallbacks> callbacks( 408 scoped_refptr<IndexedDBCallbacks> callbacks(
407 new IndexedDBCallbacks(dispatcher_host_->AsWeakPtr(), origin_, 409 new IndexedDBCallbacks(dispatcher_host_->AsWeakPtr(), origin_,
408 std::move(callbacks_info), idb_runner_)); 410 std::move(callbacks_info), idb_runner_));
409 idb_runner_->PostTask( 411 idb_runner_->PostTask(
410 FROM_HERE, 412 FROM_HERE,
411 base::Bind(&IDBSequenceHelper::DeleteRange, base::Unretained(helper_), 413 base::BindOnce(&IDBSequenceHelper::DeleteRange, base::Unretained(helper_),
412 transaction_id, object_store_id, key_range, 414 transaction_id, object_store_id, key_range,
413 base::Passed(&callbacks))); 415 base::Passed(&callbacks)));
414 } 416 }
415 417
416 void DatabaseImpl::Clear( 418 void DatabaseImpl::Clear(
417 int64_t transaction_id, 419 int64_t transaction_id,
418 int64_t object_store_id, 420 int64_t object_store_id,
419 ::indexed_db::mojom::CallbacksAssociatedPtrInfo callbacks_info) { 421 ::indexed_db::mojom::CallbacksAssociatedPtrInfo callbacks_info) {
420 scoped_refptr<IndexedDBCallbacks> callbacks( 422 scoped_refptr<IndexedDBCallbacks> callbacks(
421 new IndexedDBCallbacks(dispatcher_host_->AsWeakPtr(), origin_, 423 new IndexedDBCallbacks(dispatcher_host_->AsWeakPtr(), origin_,
422 std::move(callbacks_info), idb_runner_)); 424 std::move(callbacks_info), idb_runner_));
423 idb_runner_->PostTask( 425 idb_runner_->PostTask(
424 FROM_HERE, 426 FROM_HERE, base::BindOnce(&IDBSequenceHelper::Clear,
425 base::Bind(&IDBSequenceHelper::Clear, base::Unretained(helper_), 427 base::Unretained(helper_), transaction_id,
426 transaction_id, object_store_id, base::Passed(&callbacks))); 428 object_store_id, base::Passed(&callbacks)));
427 } 429 }
428 430
429 void DatabaseImpl::CreateIndex(int64_t transaction_id, 431 void DatabaseImpl::CreateIndex(int64_t transaction_id,
430 int64_t object_store_id, 432 int64_t object_store_id,
431 int64_t index_id, 433 int64_t index_id,
432 const base::string16& name, 434 const base::string16& name,
433 const IndexedDBKeyPath& key_path, 435 const IndexedDBKeyPath& key_path,
434 bool unique, 436 bool unique,
435 bool multi_entry) { 437 bool multi_entry) {
436 idb_runner_->PostTask( 438 idb_runner_->PostTask(
437 FROM_HERE, 439 FROM_HERE,
438 base::Bind(&IDBSequenceHelper::CreateIndex, base::Unretained(helper_), 440 base::BindOnce(&IDBSequenceHelper::CreateIndex, base::Unretained(helper_),
439 transaction_id, object_store_id, index_id, name, key_path, 441 transaction_id, object_store_id, index_id, name, key_path,
440 unique, multi_entry)); 442 unique, multi_entry));
441 } 443 }
442 444
443 void DatabaseImpl::DeleteIndex(int64_t transaction_id, 445 void DatabaseImpl::DeleteIndex(int64_t transaction_id,
444 int64_t object_store_id, 446 int64_t object_store_id,
445 int64_t index_id) { 447 int64_t index_id) {
446 idb_runner_->PostTask( 448 idb_runner_->PostTask(
447 FROM_HERE, 449 FROM_HERE,
448 base::Bind(&IDBSequenceHelper::DeleteIndex, base::Unretained(helper_), 450 base::BindOnce(&IDBSequenceHelper::DeleteIndex, base::Unretained(helper_),
449 transaction_id, object_store_id, index_id)); 451 transaction_id, object_store_id, index_id));
450 } 452 }
451 453
452 void DatabaseImpl::RenameIndex(int64_t transaction_id, 454 void DatabaseImpl::RenameIndex(int64_t transaction_id,
453 int64_t object_store_id, 455 int64_t object_store_id,
454 int64_t index_id, 456 int64_t index_id,
455 const base::string16& new_name) { 457 const base::string16& new_name) {
456 idb_runner_->PostTask( 458 idb_runner_->PostTask(
457 FROM_HERE, 459 FROM_HERE,
458 base::Bind(&IDBSequenceHelper::RenameIndex, base::Unretained(helper_), 460 base::BindOnce(&IDBSequenceHelper::RenameIndex, base::Unretained(helper_),
459 transaction_id, object_store_id, index_id, new_name)); 461 transaction_id, object_store_id, index_id, new_name));
460 } 462 }
461 463
462 void DatabaseImpl::Abort(int64_t transaction_id) { 464 void DatabaseImpl::Abort(int64_t transaction_id) {
463 idb_runner_->PostTask(FROM_HERE, 465 idb_runner_->PostTask(
464 base::Bind(&IDBSequenceHelper::Abort, 466 FROM_HERE, base::BindOnce(&IDBSequenceHelper::Abort,
465 base::Unretained(helper_), transaction_id)); 467 base::Unretained(helper_), transaction_id));
466 } 468 }
467 469
468 void DatabaseImpl::Commit(int64_t transaction_id) { 470 void DatabaseImpl::Commit(int64_t transaction_id) {
469 idb_runner_->PostTask(FROM_HERE, 471 idb_runner_->PostTask(
470 base::Bind(&IDBSequenceHelper::Commit, 472 FROM_HERE, base::BindOnce(&IDBSequenceHelper::Commit,
471 base::Unretained(helper_), transaction_id)); 473 base::Unretained(helper_), transaction_id));
472 } 474 }
473 475
474 void DatabaseImpl::AckReceivedBlobs(const std::vector<std::string>& uuids) { 476 void DatabaseImpl::AckReceivedBlobs(const std::vector<std::string>& uuids) {
475 for (const auto& uuid : uuids) 477 for (const auto& uuid : uuids)
476 dispatcher_host_->DropBlobData(uuid); 478 dispatcher_host_->DropBlobData(uuid);
477 } 479 }
478 480
479 DatabaseImpl::IDBSequenceHelper::IDBSequenceHelper( 481 DatabaseImpl::IDBSequenceHelper::IDBSequenceHelper(
480 std::unique_ptr<IndexedDBConnection> connection, 482 std::unique_ptr<IndexedDBConnection> connection,
481 const url::Origin& origin, 483 const url::Origin& origin,
(...skipping 457 matching lines...) Expand 10 before | Expand all | Expand 10 after
939 usage + transaction->size() <= quota) { 941 usage + transaction->size() <= quota) {
940 connection_->database()->Commit(transaction); 942 connection_->database()->Commit(transaction);
941 } else { 943 } else {
942 connection_->AbortTransaction( 944 connection_->AbortTransaction(
943 transaction, 945 transaction,
944 IndexedDBDatabaseError(blink::kWebIDBDatabaseExceptionQuotaError)); 946 IndexedDBDatabaseError(blink::kWebIDBDatabaseExceptionQuotaError));
945 } 947 }
946 } 948 }
947 949
948 } // namespace content 950 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/indexed_db/cursor_impl.cc ('k') | content/browser/indexed_db/indexed_db_active_blob_registry.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698