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

Unified Diff: content/child/indexed_db/indexed_db_database_callbacks_impl.cc

Issue 2601983002: [IndexedDB] Adding transaction and value support to observers (Closed)
Patch Set: Moved transaction creation to SendObservations 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/child/indexed_db/indexed_db_database_callbacks_impl.cc
diff --git a/content/child/indexed_db/indexed_db_database_callbacks_impl.cc b/content/child/indexed_db/indexed_db_database_callbacks_impl.cc
index 24b8f694196a1e95f0ece8bcfb1baaedf7c524a4..0d5edee644cd04e92ab6849c7c6f43788bc44e7b 100644
--- a/content/child/indexed_db/indexed_db_database_callbacks_impl.cc
+++ b/content/child/indexed_db/indexed_db_database_callbacks_impl.cc
@@ -4,7 +4,11 @@
#include "content/child/indexed_db/indexed_db_database_callbacks_impl.h"
+#include <unordered_map>
+#include <utility>
+
#include "base/threading/thread_task_runner_handle.h"
+#include "content/child/indexed_db/indexed_db_callbacks_impl.h"
#include "content/child/indexed_db/indexed_db_dispatcher.h"
#include "content/child/indexed_db/indexed_db_key_builders.h"
#include "third_party/WebKit/public/platform/modules/indexeddb/WebIDBDatabaseCallbacks.h"
@@ -41,10 +45,26 @@ void BuildObservationsAndNotify(WebIDBDatabaseCallbacks* callbacks,
web_observation.type = observation->type;
web_observation.keyRange =
WebIDBKeyRangeBuilder::Build(observation->key_range);
- // TODO(palakj): Assign value to web_observation.
+ if (observation->value) {
+ IndexedDBCallbacksImpl::ConvertValue(observation->value,
+ &web_observation.value);
+ }
web_observations.push_back(std::move(web_observation));
}
- callbacks->onChanges(changes->observation_index_map, web_observations);
+ std::unordered_map<int32_t, std::pair<int64_t, std::vector<int64_t>>>
+ observer_transactions;
+
+ for (const auto& transaction_pair : changes->transaction_map) {
+ std::pair<int64_t, std::vector<int64_t>>& obs_txn =
+ observer_transactions[transaction_pair.first];
+ obs_txn.first = transaction_pair.second->id;
+ for (int64_t scope : transaction_pair.second->scope) {
+ obs_txn.second.push_back(scope);
+ }
+ }
+
+ callbacks->onChanges(changes->observation_index_map, web_observations,
+ observer_transactions);
}
} // namespace

Powered by Google App Engine
This is Rietveld 408576698