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

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

Issue 2438233004: Make IndexedDBConnection IDs independent from the IPC database ID. (Closed)
Patch Set: Created 4 years, 2 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
OLDNEW
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 <utility> 7 #include <utility>
8 8
9 #include "base/format_macros.h" 9 #include "base/format_macros.h"
10 #include "base/lazy_instance.h" 10 #include "base/lazy_instance.h"
(...skipping 629 matching lines...) Expand 10 before | Expand all | Expand 10 after
640 if (message.empty()) 640 if (message.empty())
641 callbacks->onError(WebIDBDatabaseError(code)); 641 callbacks->onError(WebIDBDatabaseError(code));
642 else 642 else
643 callbacks->onError(WebIDBDatabaseError(code, message)); 643 callbacks->onError(WebIDBDatabaseError(code, message));
644 pending_callbacks_.Remove(ipc_callbacks_id); 644 pending_callbacks_.Remove(ipc_callbacks_id);
645 cursor_transaction_ids_.erase(ipc_callbacks_id); 645 cursor_transaction_ids_.erase(ipc_callbacks_id);
646 } 646 }
647 647
648 void IndexedDBDispatcher::OnDatabaseChanges( 648 void IndexedDBDispatcher::OnDatabaseChanges(
649 int32_t ipc_thread_id, 649 int32_t ipc_thread_id,
650 int32_t ipc_database_id,
651 const IndexedDBMsg_ObserverChanges& changes) { 650 const IndexedDBMsg_ObserverChanges& changes) {
652 DCHECK_EQ(ipc_thread_id, CurrentWorkerId()); 651 DCHECK_EQ(ipc_thread_id, CurrentWorkerId());
653 std::vector<WebIDBObservation> observations( 652 std::vector<WebIDBObservation> observations(
654 ConvertObservations(changes.observations)); 653 ConvertObservations(changes.observations));
655 for (auto& it : changes.observation_index) { 654 for (auto& it : changes.observation_index) {
656 WebIDBObserver* observer = observers_.Lookup(it.first); 655 WebIDBObserver* observer = observers_.Lookup(it.first);
657 // An observer can be removed from the renderer, but still exist in the 656 // An observer can be removed from the renderer, but still exist in the
658 // backend. Moreover, observer might have recorded some changes before being 657 // backend. Moreover, observer might have recorded some changes before being
659 // removed from the backend and thus, have its id be present in changes. 658 // removed from the backend and thus, have its id be present in changes.
660 if (!observer) 659 if (!observer)
661 continue; 660 continue;
662 observer->onChange(observations, std::move(it.second)); 661 observer->onChange(observations, std::move(it.second));
663 } 662 }
664 } 663 }
665 664
666 void IndexedDBDispatcher::ResetCursorPrefetchCaches( 665 void IndexedDBDispatcher::ResetCursorPrefetchCaches(
667 int64_t transaction_id, 666 int64_t transaction_id,
668 int32_t ipc_exception_cursor_id) { 667 int32_t ipc_exception_cursor_id) {
669 typedef std::map<int32_t, WebIDBCursorImpl*>::iterator Iterator; 668 typedef std::map<int32_t, WebIDBCursorImpl*>::iterator Iterator;
670 for (Iterator i = cursors_.begin(); i != cursors_.end(); ++i) { 669 for (Iterator i = cursors_.begin(); i != cursors_.end(); ++i) {
671 if (i->first == ipc_exception_cursor_id || 670 if (i->first == ipc_exception_cursor_id ||
672 i->second->transaction_id() != transaction_id) 671 i->second->transaction_id() != transaction_id)
673 continue; 672 continue;
674 i->second->ResetPrefetchCache(); 673 i->second->ResetPrefetchCache();
675 } 674 }
676 } 675 }
677 676
678 } // namespace content 677 } // namespace content
OLDNEW
« no previous file with comments | « content/child/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