Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1599)

Unified Diff: content/browser/indexed_db/indexed_db_connection.cc

Issue 2601983002: [IndexedDB] Adding transaction and value support to observers (Closed)
Patch Set: fixed bit check Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..d698307002b37d3b62ad76267dadbb11890fdc25 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;
cmumford 2017/01/17 20:58:10 Add newline before.
dmurph 2017/01/17 23:28:04 Done. Actually, as per working with Victor, we re
static int32_t next_id;
} // namespace
@@ -158,4 +158,13 @@ void IndexedDBConnection::RemoveTransaction(int64_t id) {
transactions_.erase(id);
}
+int64_t IndexedDBConnection::NewObserverTransactionId() {
+ // If we ever overflow, just reset the ID.
+ if (next_observer_transaction_id_ == kMaxObserverTransactionId)
+ next_observer_transaction_id_ = 1ll << 32;
+ DCHECK_EQ(next_observer_transaction_id_ & 0xFFFFFFFF, 0)
+ << "Highest order bits reserved for renderer-created transactions";
+ return next_observer_transaction_id_++;
+}
+
} // namespace content

Powered by Google App Engine
This is Rietveld 408576698