OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/child/indexed_db/indexed_db_dispatcher.h" | 5 #include "content/child/indexed_db/indexed_db_dispatcher.h" |
6 | 6 |
7 #include "base/format_macros.h" | 7 #include "base/format_macros.h" |
8 #include "base/lazy_instance.h" | 8 #include "base/lazy_instance.h" |
9 #include "base/strings/stringprintf.h" | 9 #include "base/strings/stringprintf.h" |
10 #include "base/threading/thread_local.h" | 10 #include "base/threading/thread_local.h" |
(...skipping 625 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
636 } | 636 } |
637 | 637 |
638 void IndexedDBDispatcher::OnError(int32 ipc_thread_id, | 638 void IndexedDBDispatcher::OnError(int32 ipc_thread_id, |
639 int32 ipc_callbacks_id, | 639 int32 ipc_callbacks_id, |
640 int code, | 640 int code, |
641 const string16& message) { | 641 const string16& message) { |
642 DCHECK_EQ(ipc_thread_id, CurrentWorkerId()); | 642 DCHECK_EQ(ipc_thread_id, CurrentWorkerId()); |
643 WebIDBCallbacks* callbacks = pending_callbacks_.Lookup(ipc_callbacks_id); | 643 WebIDBCallbacks* callbacks = pending_callbacks_.Lookup(ipc_callbacks_id); |
644 if (!callbacks) | 644 if (!callbacks) |
645 return; | 645 return; |
646 callbacks->onError(WebIDBDatabaseError(code, message)); | 646 if (message.empty()) |
| 647 callbacks->onError(WebIDBDatabaseError(code)); |
| 648 else |
| 649 callbacks->onError(WebIDBDatabaseError(code, message)); |
647 pending_callbacks_.Remove(ipc_callbacks_id); | 650 pending_callbacks_.Remove(ipc_callbacks_id); |
648 } | 651 } |
649 | 652 |
650 void IndexedDBDispatcher::OnAbort(int32 ipc_thread_id, | 653 void IndexedDBDispatcher::OnAbort(int32 ipc_thread_id, |
651 int32 ipc_database_callbacks_id, | 654 int32 ipc_database_callbacks_id, |
652 int64 transaction_id, | 655 int64 transaction_id, |
653 int code, | 656 int code, |
654 const string16& message) { | 657 const string16& message) { |
655 DCHECK_EQ(ipc_thread_id, CurrentWorkerId()); | 658 DCHECK_EQ(ipc_thread_id, CurrentWorkerId()); |
656 WebIDBDatabaseCallbacks* callbacks = | 659 WebIDBDatabaseCallbacks* callbacks = |
657 pending_database_callbacks_.Lookup(ipc_database_callbacks_id); | 660 pending_database_callbacks_.Lookup(ipc_database_callbacks_id); |
658 if (!callbacks) | 661 if (!callbacks) |
659 return; | 662 return; |
660 callbacks->onAbort(transaction_id, WebIDBDatabaseError(code, message)); | 663 if (message.empty()) |
| 664 callbacks->onAbort(transaction_id, WebIDBDatabaseError(code)); |
| 665 else |
| 666 callbacks->onAbort(transaction_id, WebIDBDatabaseError(code, message)); |
661 } | 667 } |
662 | 668 |
663 void IndexedDBDispatcher::OnComplete(int32 ipc_thread_id, | 669 void IndexedDBDispatcher::OnComplete(int32 ipc_thread_id, |
664 int32 ipc_database_callbacks_id, | 670 int32 ipc_database_callbacks_id, |
665 int64 transaction_id) { | 671 int64 transaction_id) { |
666 DCHECK_EQ(ipc_thread_id, CurrentWorkerId()); | 672 DCHECK_EQ(ipc_thread_id, CurrentWorkerId()); |
667 WebIDBDatabaseCallbacks* callbacks = | 673 WebIDBDatabaseCallbacks* callbacks = |
668 pending_database_callbacks_.Lookup(ipc_database_callbacks_id); | 674 pending_database_callbacks_.Lookup(ipc_database_callbacks_id); |
669 if (!callbacks) | 675 if (!callbacks) |
670 return; | 676 return; |
(...skipping 28 matching lines...) Expand all Loading... |
699 int32 ipc_exception_cursor_id) { | 705 int32 ipc_exception_cursor_id) { |
700 typedef std::map<int32, RendererWebIDBCursorImpl*>::iterator Iterator; | 706 typedef std::map<int32, RendererWebIDBCursorImpl*>::iterator Iterator; |
701 for (Iterator i = cursors_.begin(); i != cursors_.end(); ++i) { | 707 for (Iterator i = cursors_.begin(); i != cursors_.end(); ++i) { |
702 if (i->first == ipc_exception_cursor_id) | 708 if (i->first == ipc_exception_cursor_id) |
703 continue; | 709 continue; |
704 i->second->ResetPrefetchCache(); | 710 i->second->ResetPrefetchCache(); |
705 } | 711 } |
706 } | 712 } |
707 | 713 |
708 } // namespace content | 714 } // namespace content |
OLD | NEW |