Chromium Code Reviews| Index: content/browser/indexed_db/indexed_db_connection.cc |
| diff --git a/content/browser/indexed_db/indexed_db_connection.cc b/content/browser/indexed_db/indexed_db_connection.cc |
| index 216786a1d365f783f207895b0158fbce7808eab7..70c3de7dd0a04251db93aa717e4a5bd3d05a0db2 100644 |
| --- a/content/browser/indexed_db/indexed_db_connection.cc |
| +++ b/content/browser/indexed_db/indexed_db_connection.cc |
| @@ -15,7 +15,7 @@ |
| namespace content { |
| namespace { |
| - |
| +static const int64_t kMaxObserverTransactionId = -1ll; |
| static int32_t next_id; |
| } // namespace |
| @@ -158,4 +158,12 @@ void IndexedDBConnection::RemoveTransaction(int64_t id) { |
| transactions_.erase(id); |
| } |
| +int64_t IndexedDBConnection::NewObserverTransactionId() { |
| + // If we ever overflow, just reset the ID. |
|
jsbell
2017/01/13 00:14:12
At 1000 transaction/sec that's 285000 years. But g
dmurph
2017/01/13 01:50:42
haha sgtm.
|
| + if (next_observer_transaction_id_ == kMaxObserverTransactionId) { |
|
jsbell
2017/01/13 00:14:12
nit: no need for {}
dmurph
2017/01/13 01:50:42
Done.
|
| + next_observer_transaction_id_ = 1ll << 32; |
| + } |
| + return next_observer_transaction_id_++; |
|
jsbell
2017/01/13 00:14:12
Maybe DCHECK that the high bits are not 0 ?
(whic
dmurph
2017/01/13 01:50:42
Done.
|
| +} |
| + |
| } // namespace content |