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

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

Issue 2125213002: [IndexedDB] Propogating changes to observers : Renderer (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@lifetime
Patch Set: Post cmumford review Created 4 years, 5 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_dispatcher_host.cc
diff --git a/content/browser/indexed_db/indexed_db_dispatcher_host.cc b/content/browser/indexed_db/indexed_db_dispatcher_host.cc
index aac0dd9381135acfa6393bc6c5ccbd0fa173b308..ad65b56c575362dc8d4c698e465ea872be1f4907 100644
--- a/content/browser/indexed_db/indexed_db_dispatcher_host.cc
+++ b/content/browser/indexed_db/indexed_db_dispatcher_host.cc
@@ -23,6 +23,8 @@
#include "content/browser/indexed_db/indexed_db_cursor.h"
#include "content/browser/indexed_db/indexed_db_database_callbacks.h"
#include "content/browser/indexed_db/indexed_db_metadata.h"
+#include "content/browser/indexed_db/indexed_db_observation.h"
+#include "content/browser/indexed_db/indexed_db_observer_changes.h"
#include "content/browser/indexed_db/indexed_db_pending_connection.h"
#include "content/browser/indexed_db/indexed_db_value.h"
#include "content/browser/renderer_host/render_message_filter.h"
@@ -188,6 +190,7 @@ int32_t IndexedDBDispatcherHost::Add(IndexedDBConnection* connection,
return -1;
}
int32_t ipc_database_id = database_dispatcher_host_->map_.Add(connection);
+ connection->setId(ipc_database_id);
context()->ConnectionOpened(origin, connection);
database_dispatcher_host_->database_origin_map_[ipc_database_id] = origin;
return ipc_database_id;
@@ -317,6 +320,27 @@ IndexedDBCursor* IndexedDBDispatcherHost::GetCursorFromId(
return metadata;
}
+::IndexedDBObserverChanges IndexedDBDispatcherHost::ConvertObserverChanges(
+ content::IndexedDBObserverChanges* changes) {
+ ::IndexedDBObserverChanges idb_changes;
+ // TODO(palakj): Move the map instead of copying?
+ idb_changes.observation_index = changes->observation_index();
dmurph 2016/07/08 18:40:44 Yeah, do a move.
+ for (auto& iter : changes->observations()) {
+ ::IndexedDBObservation idb_observation =
dmurph 2016/07/08 18:40:44 Don't you need to store these somewhere?
palakj1 2016/07/08 22:17:53 oops! changed.
+ ConvertObservation(std::move(iter));
+ }
+ return idb_changes;
+}
+
+::IndexedDBObservation IndexedDBDispatcherHost::ConvertObservation(
+ std::unique_ptr<content::IndexedDBObservation> observation) {
+ // TODO(palakj): Modify function for different observation constructors.
+ ::IndexedDBObservation idb_observation;
+ idb_observation.type = observation->type();
+ idb_observation.key_range = observation->key_range();
+ return idb_observation;
+}
+
void IndexedDBDispatcherHost::OnIDBFactoryGetDatabaseNames(
const IndexedDBHostMsg_FactoryGetDatabaseNames_Params& params) {
DCHECK(indexed_db_context_->TaskRunner()->RunsTasksOnCurrentThread());

Powered by Google App Engine
This is Rietveld 408576698