Chromium Code Reviews| 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 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 94 IPC_MESSAGE_HANDLER(IndexedDBMsg_CallbacksSuccessIndexedDBKey, | 94 IPC_MESSAGE_HANDLER(IndexedDBMsg_CallbacksSuccessIndexedDBKey, |
| 95 OnSuccessIndexedDBKey) | 95 OnSuccessIndexedDBKey) |
| 96 IPC_MESSAGE_HANDLER(IndexedDBMsg_CallbacksSuccessIDBTransaction, | 96 IPC_MESSAGE_HANDLER(IndexedDBMsg_CallbacksSuccessIDBTransaction, |
| 97 OnSuccessIDBTransaction) | 97 OnSuccessIDBTransaction) |
| 98 IPC_MESSAGE_HANDLER(IndexedDBMsg_CallbacksSuccessStringList, | 98 IPC_MESSAGE_HANDLER(IndexedDBMsg_CallbacksSuccessStringList, |
| 99 OnSuccessStringList) | 99 OnSuccessStringList) |
| 100 IPC_MESSAGE_HANDLER(IndexedDBMsg_CallbacksSuccessSerializedScriptValue, | 100 IPC_MESSAGE_HANDLER(IndexedDBMsg_CallbacksSuccessSerializedScriptValue, |
| 101 OnSuccessSerializedScriptValue) | 101 OnSuccessSerializedScriptValue) |
| 102 IPC_MESSAGE_HANDLER(IndexedDBMsg_CallbacksSuccessSerializedScriptValueWithKe y, | 102 IPC_MESSAGE_HANDLER(IndexedDBMsg_CallbacksSuccessSerializedScriptValueWithKe y, |
| 103 OnSuccessSerializedScriptValueWithKey) | 103 OnSuccessSerializedScriptValueWithKey) |
| 104 IPC_MESSAGE_HANDLER(IndexedDBMsg_CallbacksSuccessInteger, | |
| 105 OnSuccessInteger) | |
| 106 IPC_MESSAGE_HANDLER(IndexedDBMsg_CallbacksSuccessUndefined, | |
| 107 OnSuccessUndefined) | |
| 104 IPC_MESSAGE_HANDLER(IndexedDBMsg_CallbacksError, OnError) | 108 IPC_MESSAGE_HANDLER(IndexedDBMsg_CallbacksError, OnError) |
| 105 IPC_MESSAGE_HANDLER(IndexedDBMsg_CallbacksBlocked, OnBlocked) | 109 IPC_MESSAGE_HANDLER(IndexedDBMsg_CallbacksBlocked, OnBlocked) |
| 106 IPC_MESSAGE_HANDLER(IndexedDBMsg_CallbacksIntBlocked, OnIntBlocked) | 110 IPC_MESSAGE_HANDLER(IndexedDBMsg_CallbacksIntBlocked, OnIntBlocked) |
| 107 IPC_MESSAGE_HANDLER(IndexedDBMsg_CallbacksUpgradeNeeded, OnUpgradeNeeded) | 111 IPC_MESSAGE_HANDLER(IndexedDBMsg_CallbacksUpgradeNeeded, OnUpgradeNeeded) |
| 108 IPC_MESSAGE_HANDLER(IndexedDBMsg_TransactionCallbacksAbortLegacy, | 112 IPC_MESSAGE_HANDLER(IndexedDBMsg_TransactionCallbacksAbortLegacy, |
| 109 OnAbortLegacy) | 113 OnAbortLegacy) |
| 110 IPC_MESSAGE_HANDLER(IndexedDBMsg_TransactionCallbacksAbort, OnAbort) | 114 IPC_MESSAGE_HANDLER(IndexedDBMsg_TransactionCallbacksAbort, OnAbort) |
| 111 IPC_MESSAGE_HANDLER(IndexedDBMsg_TransactionCallbacksComplete, OnComplete) | 115 IPC_MESSAGE_HANDLER(IndexedDBMsg_TransactionCallbacksComplete, OnComplete) |
| 112 IPC_MESSAGE_HANDLER(IndexedDBMsg_DatabaseCallbacksForcedClose, | 116 IPC_MESSAGE_HANDLER(IndexedDBMsg_DatabaseCallbacksForcedClose, |
| 113 OnForcedClose) | 117 OnForcedClose) |
| (...skipping 467 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 581 const IndexedDBKey& primary_key, | 585 const IndexedDBKey& primary_key, |
| 582 const IndexedDBKeyPath& key_path) { | 586 const IndexedDBKeyPath& key_path) { |
| 583 DCHECK_EQ(thread_id, CurrentWorkerId()); | 587 DCHECK_EQ(thread_id, CurrentWorkerId()); |
| 584 WebIDBCallbacks* callbacks = pending_callbacks_.Lookup(response_id); | 588 WebIDBCallbacks* callbacks = pending_callbacks_.Lookup(response_id); |
| 585 if (!callbacks) | 589 if (!callbacks) |
| 586 return; | 590 return; |
| 587 callbacks->onSuccess(value, primary_key, key_path); | 591 callbacks->onSuccess(value, primary_key, key_path); |
| 588 pending_callbacks_.Remove(response_id); | 592 pending_callbacks_.Remove(response_id); |
| 589 } | 593 } |
| 590 | 594 |
| 595 void IndexedDBDispatcher::OnSuccessInteger( | |
| 596 int32 thread_id, int32 response_id, | |
| 597 int64 value) { | |
|
jsbell
2012/10/17 17:24:01
This can probably fit on the previous line
| |
| 598 DCHECK_EQ(thread_id, CurrentWorkerId()); | |
| 599 WebIDBCallbacks* callbacks = pending_callbacks_.Lookup(response_id); | |
| 600 if (!callbacks) | |
| 601 return; | |
| 602 callbacks->onSuccess(value); | |
| 603 pending_callbacks_.Remove(response_id); | |
| 604 } | |
| 605 | |
| 606 void IndexedDBDispatcher::OnSuccessUndefined( | |
| 607 int32 thread_id, int32 response_id) { | |
| 608 DCHECK_EQ(thread_id, CurrentWorkerId()); | |
| 609 WebIDBCallbacks* callbacks = pending_callbacks_.Lookup(response_id); | |
| 610 if (!callbacks) | |
| 611 return; | |
| 612 callbacks->onSuccess(); | |
| 613 pending_callbacks_.Remove(response_id); | |
| 614 } | |
| 615 | |
| 591 void IndexedDBDispatcher::OnSuccessOpenCursor( | 616 void IndexedDBDispatcher::OnSuccessOpenCursor( |
| 592 const IndexedDBMsg_CallbacksSuccessIDBCursor_Params& p) { | 617 const IndexedDBMsg_CallbacksSuccessIDBCursor_Params& p) { |
| 593 DCHECK_EQ(p.thread_id, CurrentWorkerId()); | 618 DCHECK_EQ(p.thread_id, CurrentWorkerId()); |
| 594 int32 response_id = p.response_id; | 619 int32 response_id = p.response_id; |
| 595 int32 object_id = p.cursor_id; | 620 int32 object_id = p.cursor_id; |
| 596 const IndexedDBKey& key = p.key; | 621 const IndexedDBKey& key = p.key; |
| 597 const IndexedDBKey& primary_key = p.primary_key; | 622 const IndexedDBKey& primary_key = p.primary_key; |
| 598 const SerializedScriptValue& value = p.serialized_value; | 623 const SerializedScriptValue& value = p.serialized_value; |
| 599 | 624 |
| 600 WebIDBCallbacks* callbacks = | 625 WebIDBCallbacks* callbacks = |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 759 } | 784 } |
| 760 | 785 |
| 761 void IndexedDBDispatcher::ResetCursorPrefetchCaches(int32 exception_cursor_id) { | 786 void IndexedDBDispatcher::ResetCursorPrefetchCaches(int32 exception_cursor_id) { |
| 762 typedef std::map<int32, RendererWebIDBCursorImpl*>::iterator Iterator; | 787 typedef std::map<int32, RendererWebIDBCursorImpl*>::iterator Iterator; |
| 763 for (Iterator i = cursors_.begin(); i != cursors_.end(); ++i) { | 788 for (Iterator i = cursors_.begin(); i != cursors_.end(); ++i) { |
| 764 if (i->first == exception_cursor_id) | 789 if (i->first == exception_cursor_id) |
| 765 continue; | 790 continue; |
| 766 i->second->ResetPrefetchCache(); | 791 i->second->ResetPrefetchCache(); |
| 767 } | 792 } |
| 768 } | 793 } |
| OLD | NEW |