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 // This class holds all observed operations of a transaction corresponding to a |
| 6 // single connection. |
| 7 |
| 8 #ifndef CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_OBSERVER_CHANGES_H_ |
| 9 #define CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_OBSERVER_CHANGES_H_ |
| 10 |
| 11 #include <stddef.h> |
| 12 #include <stdint.h> |
| 13 |
| 14 #include <map> |
| 15 #include <set> |
| 16 #include <vector> |
| 17 |
| 18 #include "base/macros.h" |
| 19 #include "base/memory/ptr_util.h" |
| 20 #include "base/stl_util.h" |
| 21 #include "content/common/content_export.h" |
| 22 |
| 23 namespace content { |
| 24 |
| 25 class IndexedDBObservation; |
| 26 |
| 27 class CONTENT_EXPORT IndexedDBObserverChanges { |
| 28 public: |
| 29 IndexedDBObserverChanges(); |
| 30 ~IndexedDBObserverChanges(); |
| 31 |
| 32 void RecordObserverForLastObservation(int32_t observer_id); |
| 33 void AddObservation(std::unique_ptr<IndexedDBObservation> observation); |
| 34 |
| 35 const std::map<int32_t, std::vector<int32_t>>& observation_index() { |
| 36 return observation_index_; |
| 37 } |
| 38 // TODO(palakj): Can I return const here. |
| 39 std::vector<std::unique_ptr<IndexedDBObservation>>& observations() { |
| 40 return observations_; |
| 41 } |
| 42 |
| 43 private: |
| 44 // map observer_id to corresponding set of indices in observations. |
| 45 std::map<int32_t, std::vector<int32_t>> observation_index_; |
| 46 std::vector<std::unique_ptr<IndexedDBObservation>> observations_; |
| 47 |
| 48 DISALLOW_COPY_AND_ASSIGN(IndexedDBObserverChanges); |
| 49 }; |
| 50 |
| 51 } // namespace content |
| 52 |
| 53 #endif // CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_OBSERVER_CHANGES_H_ |
OLD | NEW |