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

Side by Side Diff: content/common/indexed_db/indexed_db_dispatcher.cc

Issue 10695158: IndexedDB: Close open databases when user requests browsing data deletion (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove const from iterator (not sure how this slipped through) Created 8 years, 3 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 | Annotate | Revision Log
OLDNEW
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 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
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_CallbacksError, OnError) 104 IPC_MESSAGE_HANDLER(IndexedDBMsg_CallbacksError, OnError)
105 IPC_MESSAGE_HANDLER(IndexedDBMsg_CallbacksBlocked, OnBlocked) 105 IPC_MESSAGE_HANDLER(IndexedDBMsg_CallbacksBlocked, OnBlocked)
106 IPC_MESSAGE_HANDLER(IndexedDBMsg_CallbacksIntBlocked, OnIntBlocked) 106 IPC_MESSAGE_HANDLER(IndexedDBMsg_CallbacksIntBlocked, OnIntBlocked)
107 IPC_MESSAGE_HANDLER(IndexedDBMsg_CallbacksUpgradeNeeded, OnUpgradeNeeded) 107 IPC_MESSAGE_HANDLER(IndexedDBMsg_CallbacksUpgradeNeeded, OnUpgradeNeeded)
108 IPC_MESSAGE_HANDLER(IndexedDBMsg_TransactionCallbacksAbort, OnAbort) 108 IPC_MESSAGE_HANDLER(IndexedDBMsg_TransactionCallbacksAbort, OnAbort)
109 IPC_MESSAGE_HANDLER(IndexedDBMsg_TransactionCallbacksComplete, OnComplete) 109 IPC_MESSAGE_HANDLER(IndexedDBMsg_TransactionCallbacksComplete, OnComplete)
110 IPC_MESSAGE_HANDLER(IndexedDBMsg_DatabaseCallbacksForcedClose,
111 OnForcedClose)
110 IPC_MESSAGE_HANDLER(IndexedDBMsg_DatabaseCallbacksIntVersionChange, 112 IPC_MESSAGE_HANDLER(IndexedDBMsg_DatabaseCallbacksIntVersionChange,
111 OnIntVersionChange) 113 OnIntVersionChange)
112 IPC_MESSAGE_HANDLER(IndexedDBMsg_DatabaseCallbacksVersionChange, 114 IPC_MESSAGE_HANDLER(IndexedDBMsg_DatabaseCallbacksVersionChange,
113 OnVersionChange) 115 OnVersionChange)
114 IPC_MESSAGE_UNHANDLED(handled = false) 116 IPC_MESSAGE_UNHANDLED(handled = false)
115 IPC_END_MESSAGE_MAP() 117 IPC_END_MESSAGE_MAP()
116 // If a message gets here, IndexedDBMessageFilter already determined that it 118 // If a message gets here, IndexedDBMessageFilter already determined that it
117 // is an IndexedDB message. 119 // is an IndexedDB message.
118 DCHECK(handled) << "Didn't handle a message defined at line " 120 DCHECK(handled) << "Didn't handle a message defined at line "
119 << IPC_MESSAGE_ID_LINE(msg.type()); 121 << IPC_MESSAGE_ID_LINE(msg.type());
(...skipping 615 matching lines...) Expand 10 before | Expand all | Expand 10 after
735 void IndexedDBDispatcher::OnComplete(int32 thread_id, int32 transaction_id) { 737 void IndexedDBDispatcher::OnComplete(int32 thread_id, int32 transaction_id) {
736 DCHECK_EQ(thread_id, CurrentWorkerId()); 738 DCHECK_EQ(thread_id, CurrentWorkerId());
737 WebIDBTransactionCallbacks* callbacks = 739 WebIDBTransactionCallbacks* callbacks =
738 pending_transaction_callbacks_.Lookup(transaction_id); 740 pending_transaction_callbacks_.Lookup(transaction_id);
739 if (!callbacks) 741 if (!callbacks)
740 return; 742 return;
741 callbacks->onComplete(); 743 callbacks->onComplete();
742 pending_transaction_callbacks_.Remove(transaction_id); 744 pending_transaction_callbacks_.Remove(transaction_id);
743 } 745 }
744 746
747 void IndexedDBDispatcher::OnForcedClose(int32 thread_id,
748 int32 database_id) {
749 DCHECK_EQ(thread_id, CurrentWorkerId());
750 WebIDBDatabaseCallbacks* callbacks =
751 pending_database_callbacks_.Lookup(database_id);
752 if (!callbacks)
753 return;
754 callbacks->onForcedClose();
755 }
756
745 void IndexedDBDispatcher::OnIntVersionChange(int32 thread_id, 757 void IndexedDBDispatcher::OnIntVersionChange(int32 thread_id,
746 int32 database_id, 758 int32 database_id,
747 int64 old_version, 759 int64 old_version,
748 int64 new_version) { 760 int64 new_version) {
749 DCHECK_EQ(thread_id, CurrentWorkerId()); 761 DCHECK_EQ(thread_id, CurrentWorkerId());
750 WebIDBDatabaseCallbacks* callbacks = 762 WebIDBDatabaseCallbacks* callbacks =
751 pending_database_callbacks_.Lookup(database_id); 763 pending_database_callbacks_.Lookup(database_id);
752 // callbacks would be NULL if a versionchange event is received after close 764 // callbacks would be NULL if a versionchange event is received after close
753 // has been called. 765 // has been called.
754 if (!callbacks) 766 if (!callbacks)
(...skipping 15 matching lines...) Expand all
770 } 782 }
771 783
772 void IndexedDBDispatcher::ResetCursorPrefetchCaches(int32 exception_cursor_id) { 784 void IndexedDBDispatcher::ResetCursorPrefetchCaches(int32 exception_cursor_id) {
773 typedef std::map<int32, RendererWebIDBCursorImpl*>::iterator Iterator; 785 typedef std::map<int32, RendererWebIDBCursorImpl*>::iterator Iterator;
774 for (Iterator i = cursors_.begin(); i != cursors_.end(); ++i) { 786 for (Iterator i = cursors_.begin(); i != cursors_.end(); ++i) {
775 if (i->first == exception_cursor_id) 787 if (i->first == exception_cursor_id)
776 continue; 788 continue;
777 i->second->ResetPrefetchCache(); 789 i->second->ResetPrefetchCache();
778 } 790 }
779 } 791 }
OLDNEW
« no previous file with comments | « content/common/indexed_db/indexed_db_dispatcher.h ('k') | content/common/indexed_db/indexed_db_messages.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698