| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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/browser/indexed_db/indexed_db_database.h" | 5 #include "content/browser/indexed_db/indexed_db_database.h" |
| 6 | 6 |
| 7 #include <math.h> | 7 #include <math.h> |
| 8 | 8 |
| 9 #include <limits> | 9 #include <limits> |
| 10 #include <memory> | 10 #include <memory> |
| (...skipping 771 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 782 it.second->RemovePendingObservers(pending_observer_ids); | 782 it.second->RemovePendingObservers(pending_observer_ids); |
| 783 } | 783 } |
| 784 } | 784 } |
| 785 | 785 |
| 786 // TODO(palakj): Augment the function with IDBValue later. Issue | 786 // TODO(palakj): Augment the function with IDBValue later. Issue |
| 787 // crbug.com/609934. | 787 // crbug.com/609934. |
| 788 void IndexedDBDatabase::FilterObservation(IndexedDBTransaction* transaction, | 788 void IndexedDBDatabase::FilterObservation(IndexedDBTransaction* transaction, |
| 789 int64_t object_store_id, | 789 int64_t object_store_id, |
| 790 blink::WebIDBOperationType type, | 790 blink::WebIDBOperationType type, |
| 791 const IndexedDBKeyRange& key_range) { | 791 const IndexedDBKeyRange& key_range) { |
| 792 for (const auto& connection : connections_) { | 792 for (auto* connection : connections_) { |
| 793 bool recorded = false; | 793 bool recorded = false; |
| 794 for (const auto& observer : connection->active_observers()) { | 794 for (const auto& observer : connection->active_observers()) { |
| 795 if (!observer->IsRecordingType(type) || | 795 if (!observer->IsRecordingType(type) || |
| 796 !observer->IsRecordingObjectStore(object_store_id)) | 796 !observer->IsRecordingObjectStore(object_store_id)) |
| 797 continue; | 797 continue; |
| 798 if (!recorded) { | 798 if (!recorded) { |
| 799 if (type == blink::WebIDBClear) { | 799 if (type == blink::WebIDBClear) { |
| 800 transaction->AddObservation(connection->id(), | 800 transaction->AddObservation(connection->id(), |
| 801 base::WrapUnique(new IndexedDBObservation( | 801 base::WrapUnique(new IndexedDBObservation( |
| 802 object_store_id, type))); | 802 object_store_id, type))); |
| 803 } else { | 803 } else { |
| 804 transaction->AddObservation(connection->id(), | 804 transaction->AddObservation(connection->id(), |
| 805 base::WrapUnique(new IndexedDBObservation( | 805 base::WrapUnique(new IndexedDBObservation( |
| 806 object_store_id, type, key_range))); | 806 object_store_id, type, key_range))); |
| 807 } | 807 } |
| 808 recorded = true; | 808 recorded = true; |
| 809 } | 809 } |
| 810 transaction->RecordObserverForLastObservation(connection->id(), | 810 transaction->RecordObserverForLastObservation(connection->id(), |
| 811 observer->id()); | 811 observer->id()); |
| 812 } | 812 } |
| 813 } | 813 } |
| 814 } | 814 } |
| 815 | 815 |
| 816 void IndexedDBDatabase::SendObservations( | 816 void IndexedDBDatabase::SendObservations( |
| 817 std::map<int32_t, std::unique_ptr<IndexedDBObserverChanges>> changes_map) { | 817 std::map<int32_t, std::unique_ptr<IndexedDBObserverChanges>> changes_map) { |
| 818 for (const auto& conn : connections_) { | 818 for (auto* conn : connections_) { |
| 819 auto it = changes_map.find(conn->id()); | 819 auto it = changes_map.find(conn->id()); |
| 820 if (it != changes_map.end()) | 820 if (it != changes_map.end()) |
| 821 conn->callbacks()->OnDatabaseChange(it->first, std::move(it->second)); | 821 conn->callbacks()->OnDatabaseChange(it->first, std::move(it->second)); |
| 822 } | 822 } |
| 823 } | 823 } |
| 824 | 824 |
| 825 void IndexedDBDatabase::GetAll(int64_t transaction_id, | 825 void IndexedDBDatabase::GetAll(int64_t transaction_id, |
| 826 int64_t object_store_id, | 826 int64_t object_store_id, |
| 827 int64_t index_id, | 827 int64_t index_id, |
| 828 std::unique_ptr<IndexedDBKeyRange> key_range, | 828 std::unique_ptr<IndexedDBKeyRange> key_range, |
| (...skipping 1176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2005 | 2005 |
| 2006 void IndexedDBDatabase::VersionChangeAbortOperation( | 2006 void IndexedDBDatabase::VersionChangeAbortOperation( |
| 2007 int64_t previous_version, | 2007 int64_t previous_version, |
| 2008 IndexedDBTransaction* transaction) { | 2008 IndexedDBTransaction* transaction) { |
| 2009 DCHECK(!transaction); | 2009 DCHECK(!transaction); |
| 2010 IDB_TRACE("IndexedDBDatabase::VersionChangeAbortOperation"); | 2010 IDB_TRACE("IndexedDBDatabase::VersionChangeAbortOperation"); |
| 2011 metadata_.version = previous_version; | 2011 metadata_.version = previous_version; |
| 2012 } | 2012 } |
| 2013 | 2013 |
| 2014 } // namespace content | 2014 } // namespace content |
| OLD | NEW |