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

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

Issue 2511403003: Send IndexedDB observations through IDBDatabaseCallbacks. (Closed)
Patch Set: Remove unnecessary forward declaration. Created 4 years, 1 month 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 984792ffa4638c692498bcb887f02c90f9fbb5d0..420424613e969890cc1b6e29b976986d51c900ae 100644
--- a/content/child/indexed_db/indexed_db_database_callbacks_impl.cc
+++ b/content/child/indexed_db/indexed_db_database_callbacks_impl.cc
@@ -5,8 +5,10 @@
#include "content/child/indexed_db/indexed_db_database_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"
#include "third_party/WebKit/public/platform/modules/indexeddb/WebIDBDatabaseError.h"
+#include "third_party/WebKit/public/platform/modules/indexeddb/WebIDBObservation.h"
using blink::WebIDBDatabaseCallbacks;
@@ -27,6 +29,21 @@ void BuildErrorAndAbort(WebIDBDatabaseCallbacks* callbacks,
callbacks->onAbort(transaction_id, blink::WebIDBDatabaseError(code, message));
}
+void BuildObservationsAndNotify(WebIDBDatabaseCallbacks* callbacks,
+ indexed_db::mojom::ObserverChangesPtr changes) {
+ std::vector<blink::WebIDBObservation> web_observations;
+ for (const auto& observation : changes->observations) {
+ blink::WebIDBObservation web_observation;
+ web_observation.objectStoreId = observation->object_store_id;
+ web_observation.type = observation->type;
+ web_observation.keyRange =
+ WebIDBKeyRangeBuilder::Build(observation->key_range);
+ // TODO(palakj): Assign value to web_observation.
+ web_observations.push_back(std::move(web_observation));
+ }
+ callbacks->onChanges(changes->observation_index_map, web_observations);
+}
+
} // namespace
IndexedDBDatabaseCallbacksImpl::IndexedDBDatabaseCallbacksImpl(
@@ -72,4 +89,11 @@ void IndexedDBDatabaseCallbacksImpl::Complete(int64_t transaction_id) {
base::Unretained(callbacks_), transaction_id));
}
+void IndexedDBDatabaseCallbacksImpl::Changes(
+ indexed_db::mojom::ObserverChangesPtr changes) {
+ callback_runner_->PostTask(FROM_HERE, base::Bind(&BuildObservationsAndNotify,
+ base::Unretained(callbacks_),
+ base::Passed(&changes)));
+}
+
} // namespace content
« no previous file with comments | « content/child/indexed_db/indexed_db_database_callbacks_impl.h ('k') | content/child/indexed_db/indexed_db_dispatcher.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698