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

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: IDBDatabase weakptr introduced on IDBObserver 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..fcaeda1cf26f8f26b2ce9c7e23e96388e46b3a85 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->set_id(ipc_database_id);
context()->ConnectionOpened(origin, connection);
database_dispatcher_host_->database_origin_map_[ipc_database_id] = origin;
return ipc_database_id;
@@ -317,6 +320,31 @@ IndexedDBCursor* IndexedDBDispatcherHost::GetCursorFromId(
return metadata;
}
+// IndexedDBObservation held by IndexedDBObserverChanges object are freed here.
+IndexedDBMsg_ObserverChanges IndexedDBDispatcherHost::ConvertObserverChanges(
+ std::unique_ptr<IndexedDBObserverChanges> changes) {
+ IndexedDBMsg_ObserverChanges idb_changes;
+ idb_changes.observation_index = changes->observation_index();
+ std::vector<std::unique_ptr<IndexedDBObservation>> observations(
+ std::move(changes->observations()));
Marijn Kruisselbrink 2016/07/11 23:10:39 No need to move the vector out of changes->observa
palakj1 2016/07/13 00:43:50 Done.
+ for (auto& observation : observations) {
+ idb_changes.observations.push_back(
+ ConvertObservation(observation.release()));
Marijn Kruisselbrink 2016/07/11 23:10:39 You probably meant .get() rather than .release() h
palakj1 2016/07/13 00:43:50 Done.
+ }
+ observations.clear();
+ return idb_changes;
+}
+
+IndexedDBMsg_Observation IndexedDBDispatcherHost::ConvertObservation(
+ const IndexedDBObservation* observation) {
+ // TODO(palakj): Modify function for indexed_db_value.
+ IndexedDBMsg_Observation idb_observation;
+ idb_observation.object_store_id = observation->object_store_id();
+ 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