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

Unified Diff: third_party/WebKit/Source/modules/indexeddb/IDBObserverChanges.cpp

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: third_party/WebKit/Source/modules/indexeddb/IDBObserverChanges.cpp
diff --git a/third_party/WebKit/Source/modules/indexeddb/IDBObserverChanges.cpp b/third_party/WebKit/Source/modules/indexeddb/IDBObserverChanges.cpp
index abb4042ff9422d42bb4a623c04727b979e96e9ad..e966fb1e3ffab3a93b323e770a937f00c06a0044 100644
--- a/third_party/WebKit/Source/modules/indexeddb/IDBObserverChanges.cpp
+++ b/third_party/WebKit/Source/modules/indexeddb/IDBObserverChanges.cpp
@@ -9,6 +9,9 @@
#include "bindings/modules/v8/ToV8ForModules.h"
#include "bindings/modules/v8/V8BindingForModules.h"
#include "modules/indexeddb/IDBAny.h"
+#include "modules/indexeddb/IDBObservation.h"
+#include "public/platform/modules/indexeddb/WebIDBObservation.h"
+#include "public/platform/modules/indexeddb/WebIDBTypes.h"
namespace blink {
@@ -17,16 +20,25 @@ ScriptValue IDBObserverChanges::records(ScriptState* scriptState)
return ScriptValue::from(scriptState, m_records);
}
-IDBObserverChanges* IDBObserverChanges::create(IDBDatabase* database, IDBTransaction* transaction, IDBAny* records)
+IDBObserverChanges* IDBObserverChanges::create(IDBDatabase* database, const std::vector<WebIDBObservation>& observations, const std::vector<int32_t>& observationIndex)
{
- return new IDBObserverChanges(database, transaction, records);
+ return new IDBObserverChanges(database, observations, observationIndex);
}
-IDBObserverChanges::IDBObserverChanges(IDBDatabase* database, IDBTransaction* transaction, IDBAny* records)
+IDBObserverChanges::IDBObserverChanges(IDBDatabase* database, const std::vector<WebIDBObservation>& observations, const std::vector<int32_t>& observationIndex)
: m_database(database)
- , m_transaction(transaction)
- , m_records(records)
{
+ createMap(observations, observationIndex);
+}
+
+void IDBObserverChanges::createMap(const std::vector<WebIDBObservation>& observations, const std::vector<int32_t>& observationIndex)
+{
+
+ for (const auto& idx : observationIndex) {
+ String objectStoreName = m_database->getObjectStoreName(observations[idx].objectStoreId);
+ // TODO(palakj): Create a map of objectStoreName to observations.
+ m_records.append(IDBObservation::create(observations[idx]));
+ }
}
DEFINE_TRACE(IDBObserverChanges)

Powered by Google App Engine
This is Rietveld 408576698