| 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 465 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 476 int32 response_id = pending_callbacks_.Add(callbacks.release()); | 476 int32 response_id = pending_callbacks_.Add(callbacks.release()); |
| 477 Send(new IndexedDBHostMsg_ObjectStoreClear( | 477 Send(new IndexedDBHostMsg_ObjectStoreClear( |
| 478 idb_object_store_id, CurrentWorkerId(), response_id, | 478 idb_object_store_id, CurrentWorkerId(), response_id, |
| 479 TransactionId(transaction), ec)); | 479 TransactionId(transaction), ec)); |
| 480 if (*ec) | 480 if (*ec) |
| 481 pending_callbacks_.Remove(response_id); | 481 pending_callbacks_.Remove(response_id); |
| 482 } | 482 } |
| 483 | 483 |
| 484 void IndexedDBDispatcher::RequestIDBObjectStoreOpenCursor( | 484 void IndexedDBDispatcher::RequestIDBObjectStoreOpenCursor( |
| 485 const WebIDBKeyRange& idb_key_range, | 485 const WebIDBKeyRange& idb_key_range, |
| 486 unsigned short direction, | 486 WebKit::WebIDBCursor::Direction direction, |
| 487 WebIDBCallbacks* callbacks_ptr, | 487 WebIDBCallbacks* callbacks_ptr, |
| 488 int32 idb_object_store_id, | 488 int32 idb_object_store_id, |
| 489 WebKit::WebIDBTransaction::TaskType task_type, |
| 489 const WebIDBTransaction& transaction, | 490 const WebIDBTransaction& transaction, |
| 490 WebExceptionCode* ec) { | 491 WebExceptionCode* ec) { |
| 491 ResetCursorPrefetchCaches(); | 492 ResetCursorPrefetchCaches(); |
| 492 scoped_ptr<WebIDBCallbacks> callbacks(callbacks_ptr); | 493 scoped_ptr<WebIDBCallbacks> callbacks(callbacks_ptr); |
| 493 IndexedDBHostMsg_ObjectStoreOpenCursor_Params params; | 494 IndexedDBHostMsg_ObjectStoreOpenCursor_Params params; |
| 494 params.thread_id = CurrentWorkerId(); | 495 params.thread_id = CurrentWorkerId(); |
| 495 params.response_id = pending_callbacks_.Add(callbacks.release()); | 496 params.response_id = pending_callbacks_.Add(callbacks.release()); |
| 496 params.key_range = IndexedDBKeyRange(idb_key_range); | 497 params.key_range = IndexedDBKeyRange(idb_key_range); |
| 497 params.direction = direction; | 498 params.direction = direction; |
| 498 params.idb_object_store_id = idb_object_store_id; | 499 params.idb_object_store_id = idb_object_store_id; |
| 500 params.task_type = task_type; |
| 499 params.transaction_id = TransactionId(transaction); | 501 params.transaction_id = TransactionId(transaction); |
| 500 Send(new IndexedDBHostMsg_ObjectStoreOpenCursor(params, ec)); | 502 Send(new IndexedDBHostMsg_ObjectStoreOpenCursor(params, ec)); |
| 501 if (*ec) | 503 if (*ec) |
| 502 pending_callbacks_.Remove(params.response_id); | 504 pending_callbacks_.Remove(params.response_id); |
| 503 } | 505 } |
| 504 | 506 |
| 505 void IndexedDBDispatcher::RequestIDBObjectStoreCount( | 507 void IndexedDBDispatcher::RequestIDBObjectStoreCount( |
| 506 const WebIDBKeyRange& idb_key_range, | 508 const WebIDBKeyRange& idb_key_range, |
| 507 WebIDBCallbacks* callbacks_ptr, | 509 WebIDBCallbacks* callbacks_ptr, |
| 508 int32 idb_object_store_id, | 510 int32 idb_object_store_id, |
| (...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 769 } | 771 } |
| 770 | 772 |
| 771 void IndexedDBDispatcher::ResetCursorPrefetchCaches(int32 exception_cursor_id) { | 773 void IndexedDBDispatcher::ResetCursorPrefetchCaches(int32 exception_cursor_id) { |
| 772 typedef std::map<int32, RendererWebIDBCursorImpl*>::iterator Iterator; | 774 typedef std::map<int32, RendererWebIDBCursorImpl*>::iterator Iterator; |
| 773 for (Iterator i = cursors_.begin(); i != cursors_.end(); ++i) { | 775 for (Iterator i = cursors_.begin(); i != cursors_.end(); ++i) { |
| 774 if (i->first == exception_cursor_id) | 776 if (i->first == exception_cursor_id) |
| 775 continue; | 777 continue; |
| 776 i->second->ResetPrefetchCache(); | 778 i->second->ResetPrefetchCache(); |
| 777 } | 779 } |
| 778 } | 780 } |
| OLD | NEW |