OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/common/indexed_db/indexed_db_dispatcher.h" | 5 #include "content/common/indexed_db/indexed_db_dispatcher.h" |
6 | 6 |
7 #include "base/lazy_instance.h" | 7 #include "base/lazy_instance.h" |
8 #include "base/threading/thread_local.h" | 8 #include "base/threading/thread_local.h" |
9 #include "content/common/child_thread.h" | 9 #include "content/common/child_thread.h" |
10 #include "content/common/indexed_db/indexed_db_messages.h" | 10 #include "content/common/indexed_db/indexed_db_messages.h" |
(...skipping 405 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
416 scoped_ptr<WebIDBCallbacks> callbacks(callbacks_ptr); | 416 scoped_ptr<WebIDBCallbacks> callbacks(callbacks_ptr); |
417 | 417 |
418 int32 response_id = pending_callbacks_.Add(callbacks.release()); | 418 int32 response_id = pending_callbacks_.Add(callbacks.release()); |
419 Send(new IndexedDBHostMsg_ObjectStoreDelete( | 419 Send(new IndexedDBHostMsg_ObjectStoreDelete( |
420 idb_object_store_id, CurrentWorkerId(), response_id, key, | 420 idb_object_store_id, CurrentWorkerId(), response_id, key, |
421 TransactionId(transaction), ec)); | 421 TransactionId(transaction), ec)); |
422 if (*ec) | 422 if (*ec) |
423 pending_callbacks_.Remove(response_id); | 423 pending_callbacks_.Remove(response_id); |
424 } | 424 } |
425 | 425 |
| 426 void IndexedDBDispatcher::RequestIDBObjectStoreDeleteRange( |
| 427 const IndexedDBKeyRange& key_range, |
| 428 WebIDBCallbacks* callbacks_ptr, |
| 429 int32 idb_object_store_id, |
| 430 const WebIDBTransaction& transaction, |
| 431 WebExceptionCode* ec) { |
| 432 ResetCursorPrefetchCaches(); |
| 433 scoped_ptr<WebIDBCallbacks> callbacks(callbacks_ptr); |
| 434 |
| 435 int32 response_id = pending_callbacks_.Add(callbacks.release()); |
| 436 Send(new IndexedDBHostMsg_ObjectStoreDeleteRange( |
| 437 idb_object_store_id, CurrentWorkerId(), response_id, key_range, |
| 438 TransactionId(transaction), ec)); |
| 439 if (*ec) |
| 440 pending_callbacks_.Remove(response_id); |
| 441 } |
| 442 |
426 void IndexedDBDispatcher::RequestIDBObjectStoreClear( | 443 void IndexedDBDispatcher::RequestIDBObjectStoreClear( |
427 WebIDBCallbacks* callbacks_ptr, | 444 WebIDBCallbacks* callbacks_ptr, |
428 int32 idb_object_store_id, | 445 int32 idb_object_store_id, |
429 const WebIDBTransaction& transaction, | 446 const WebIDBTransaction& transaction, |
430 WebExceptionCode* ec) { | 447 WebExceptionCode* ec) { |
431 ResetCursorPrefetchCaches(); | 448 ResetCursorPrefetchCaches(); |
432 scoped_ptr<WebIDBCallbacks> callbacks(callbacks_ptr); | 449 scoped_ptr<WebIDBCallbacks> callbacks(callbacks_ptr); |
433 | 450 |
434 int32 response_id = pending_callbacks_.Add(callbacks.release()); | 451 int32 response_id = pending_callbacks_.Add(callbacks.release()); |
435 Send(new IndexedDBHostMsg_ObjectStoreClear( | 452 Send(new IndexedDBHostMsg_ObjectStoreClear( |
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
672 } | 689 } |
673 | 690 |
674 void IndexedDBDispatcher::ResetCursorPrefetchCaches(int32 exception_cursor_id) { | 691 void IndexedDBDispatcher::ResetCursorPrefetchCaches(int32 exception_cursor_id) { |
675 typedef std::map<int32, RendererWebIDBCursorImpl*>::iterator Iterator; | 692 typedef std::map<int32, RendererWebIDBCursorImpl*>::iterator Iterator; |
676 for (Iterator i = cursors_.begin(); i != cursors_.end(); ++i) { | 693 for (Iterator i = cursors_.begin(); i != cursors_.end(); ++i) { |
677 if (i->first == exception_cursor_id) | 694 if (i->first == exception_cursor_id) |
678 continue; | 695 continue; |
679 i->second->ResetPrefetchCache(); | 696 i->second->ResetPrefetchCache(); |
680 } | 697 } |
681 } | 698 } |
OLD | NEW |