OLD | NEW |
---|---|
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 #ifndef CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_CONNECTION_H_ | 5 #ifndef CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_CONNECTION_H_ |
6 #define CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_CONNECTION_H_ | 6 #define CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_CONNECTION_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 #include <set> | 9 #include <set> |
10 #include <unordered_map> | 10 #include <unordered_map> |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
70 | 70 |
71 IndexedDBTransaction* GetTransaction(int64_t id) const; | 71 IndexedDBTransaction* GetTransaction(int64_t id) const; |
72 | 72 |
73 base::WeakPtr<IndexedDBTransaction> AddTransactionForTesting( | 73 base::WeakPtr<IndexedDBTransaction> AddTransactionForTesting( |
74 std::unique_ptr<IndexedDBTransaction> transaction); | 74 std::unique_ptr<IndexedDBTransaction> transaction); |
75 | 75 |
76 // We ignore calls where the id doesn't exist to facilitate the AbortAll call. | 76 // We ignore calls where the id doesn't exist to facilitate the AbortAll call. |
77 // TODO(dmurph): Change that so this doesn't need to ignore unknown ids. | 77 // TODO(dmurph): Change that so this doesn't need to ignore unknown ids. |
78 void RemoveTransaction(int64_t id); | 78 void RemoveTransaction(int64_t id); |
79 | 79 |
80 // Returns a new transaction id for an observer transaction. | |
81 // Unique per connection. | |
82 int64_t NewObserverTransactionId(); | |
83 | |
80 private: | 84 private: |
81 const int32_t id_; | 85 const int32_t id_; |
82 | 86 |
87 // The renderer-created transactions are in the right 32 bits, and the | |
palmer
2017/01/18 19:56:01
Nit: Clarify: "...the right 32 bits of a transacti
dmurph
2017/01/18 21:00:57
I tried to clarify. I'm going to add a bug for upd
| |
88 // browser-created transactions are in the left 32 bits. | |
89 // This keeps track of the left 32 bits. | |
90 uint32_t next_observer_transaction_id_ = 1; | |
91 | |
83 // The process id of the child process this connection is associated with. | 92 // The process id of the child process this connection is associated with. |
84 // Tracked for IndexedDBContextImpl::GetAllOriginsDetails and debugging. | 93 // Tracked for IndexedDBContextImpl::GetAllOriginsDetails and debugging. |
85 const int child_process_id_; | 94 const int child_process_id_; |
86 | 95 |
87 // NULL in some unit tests, and after the connection is closed. | 96 // NULL in some unit tests, and after the connection is closed. |
88 scoped_refptr<IndexedDBDatabase> database_; | 97 scoped_refptr<IndexedDBDatabase> database_; |
89 | 98 |
90 // The connection owns transactions created on this connection. | 99 // The connection owns transactions created on this connection. |
91 std::unordered_map<int64_t, std::unique_ptr<IndexedDBTransaction>> | 100 std::unordered_map<int64_t, std::unique_ptr<IndexedDBTransaction>> |
92 transactions_; | 101 transactions_; |
93 | 102 |
94 // The callbacks_ member is cleared when the connection is closed. | 103 // The callbacks_ member is cleared when the connection is closed. |
95 // May be NULL in unit tests. | 104 // May be NULL in unit tests. |
96 scoped_refptr<IndexedDBDatabaseCallbacks> callbacks_; | 105 scoped_refptr<IndexedDBDatabaseCallbacks> callbacks_; |
97 std::vector<std::unique_ptr<IndexedDBObserver>> active_observers_; | 106 std::vector<std::unique_ptr<IndexedDBObserver>> active_observers_; |
98 base::WeakPtrFactory<IndexedDBConnection> weak_factory_; | 107 base::WeakPtrFactory<IndexedDBConnection> weak_factory_; |
99 | 108 |
100 DISALLOW_COPY_AND_ASSIGN(IndexedDBConnection); | 109 DISALLOW_COPY_AND_ASSIGN(IndexedDBConnection); |
101 }; | 110 }; |
102 | 111 |
103 } // namespace content | 112 } // namespace content |
104 | 113 |
105 #endif // CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_CONNECTION_H_ | 114 #endif // CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_CONNECTION_H_ |
OLD | NEW |