OLD | NEW |
(Empty) | |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_OBSERVER_CHANGES_H_ |
| 6 #define CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_OBSERVER_CHANGES_H_ |
| 7 |
| 8 #include <stddef.h> |
| 9 #include <stdint.h> |
| 10 |
| 11 #include <map> |
| 12 #include <set> |
| 13 #include <vector> |
| 14 |
| 15 #include "base/macros.h" |
| 16 #include "base/memory/ptr_util.h" |
| 17 #include "base/stl_util.h" |
| 18 #include "content/browser/indexed_db/indexed_db_observation.h" |
| 19 #include "content/common/content_export.h" |
| 20 |
| 21 namespace content { |
| 22 |
| 23 class IndexedDBObservation; |
| 24 |
| 25 // Holds observations corresponding to a transaction for a single connection. |
| 26 class CONTENT_EXPORT IndexedDBObserverChanges { |
| 27 public: |
| 28 IndexedDBObserverChanges(); |
| 29 ~IndexedDBObserverChanges(); |
| 30 |
| 31 void RecordObserverForLastObservation(int32_t observer_id); |
| 32 void AddObservation(std::unique_ptr<IndexedDBObservation> observation); |
| 33 |
| 34 std::map<int32_t, std::vector<int32_t>> release_observation_indices_map() { |
| 35 return std::move(observation_indices_map_); |
| 36 } |
| 37 std::vector<std::unique_ptr<IndexedDBObservation>> release_observations() { |
| 38 return std::move(observations_); |
| 39 } |
| 40 |
| 41 private: |
| 42 // Maps observer_id to corresponding set of indices in observations. |
| 43 std::map<int32_t, std::vector<int32_t>> observation_indices_map_; |
| 44 std::vector<std::unique_ptr<IndexedDBObservation>> observations_; |
| 45 |
| 46 DISALLOW_COPY_AND_ASSIGN(IndexedDBObserverChanges); |
| 47 }; |
| 48 |
| 49 } // namespace content |
| 50 |
| 51 #endif // CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_OBSERVER_CHANGES_H_ |
OLD | NEW |