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 int64_t NextObserverTransactionId(); | |
cmumford
2017/01/09 21:31:25
Comment for method.
dmurph
2017/01/10 00:17:38
Done.
| |
81 | |
80 private: | 82 private: |
81 const int32_t id_; | 83 const int32_t id_; |
82 | 84 |
85 // The renderer-created transactions are in the right 32 bits, and the | |
86 // browser-created transactions are in the left 32 bits. | |
87 int64_t next_observer_transaction_id_ = 1ll << 32; | |
pwnall
2017/01/10 01:01:24
I think it'd be easier to debug if you have the hi
dmurph
2017/01/10 20:39:59
That second suggestion wouldn't work as the the sa
pwnall
2017/01/10 23:21:54
Thank you for explaining! Sorry, I completely forg
| |
88 static const int64_t kMaxObserverTransactionId = -1ll; | |
cmumford
2017/01/09 21:31:25
How about moving kMaxObserverTransactionId to the
dmurph
2017/01/10 00:17:38
Done.
pwnall
2017/01/10 01:01:24
Hm, I was going to suggest adding a static_assert
| |
89 | |
83 // The process id of the child process this connection is associated with. | 90 // The process id of the child process this connection is associated with. |
84 // Tracked for IndexedDBContextImpl::GetAllOriginsDetails and debugging. | 91 // Tracked for IndexedDBContextImpl::GetAllOriginsDetails and debugging. |
85 const int child_process_id_; | 92 const int child_process_id_; |
86 | 93 |
87 // NULL in some unit tests, and after the connection is closed. | 94 // NULL in some unit tests, and after the connection is closed. |
88 scoped_refptr<IndexedDBDatabase> database_; | 95 scoped_refptr<IndexedDBDatabase> database_; |
89 | 96 |
90 // The connection owns transactions created on this connection. | 97 // The connection owns transactions created on this connection. |
91 std::unordered_map<int64_t, std::unique_ptr<IndexedDBTransaction>> | 98 std::unordered_map<int64_t, std::unique_ptr<IndexedDBTransaction>> |
92 transactions_; | 99 transactions_; |
93 | 100 |
94 // The callbacks_ member is cleared when the connection is closed. | 101 // The callbacks_ member is cleared when the connection is closed. |
95 // May be NULL in unit tests. | 102 // May be NULL in unit tests. |
96 scoped_refptr<IndexedDBDatabaseCallbacks> callbacks_; | 103 scoped_refptr<IndexedDBDatabaseCallbacks> callbacks_; |
97 std::vector<std::unique_ptr<IndexedDBObserver>> active_observers_; | 104 std::vector<std::unique_ptr<IndexedDBObserver>> active_observers_; |
98 base::WeakPtrFactory<IndexedDBConnection> weak_factory_; | 105 base::WeakPtrFactory<IndexedDBConnection> weak_factory_; |
99 | 106 |
100 DISALLOW_COPY_AND_ASSIGN(IndexedDBConnection); | 107 DISALLOW_COPY_AND_ASSIGN(IndexedDBConnection); |
101 }; | 108 }; |
102 | 109 |
103 } // namespace content | 110 } // namespace content |
104 | 111 |
105 #endif // CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_CONNECTION_H_ | 112 #endif // CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_CONNECTION_H_ |
OLD | NEW |