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

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

Issue 2125213002: [IndexedDB] Propogating changes to observers : Renderer (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@lifetime
Patch Set: Minor bugs fixed 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/IDBObservation.cpp
diff --git a/third_party/WebKit/Source/modules/indexeddb/IDBObserverChangesRecord.cpp b/third_party/WebKit/Source/modules/indexeddb/IDBObservation.cpp
similarity index 60%
rename from third_party/WebKit/Source/modules/indexeddb/IDBObserverChangesRecord.cpp
rename to third_party/WebKit/Source/modules/indexeddb/IDBObservation.cpp
index dba64e326ccd0a400aae60a891b95ee00351004a..4098e9f024b2b07441d5a14afb6849ba2da30819 100644
--- a/third_party/WebKit/Source/modules/indexeddb/IDBObserverChangesRecord.cpp
+++ b/third_party/WebKit/Source/modules/indexeddb/IDBObservation.cpp
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "modules/indexeddb/IDBObserverChangesRecord.h"
+#include "modules/indexeddb/IDBObservation.h"
#include "bindings/core/v8/ExceptionState.h"
#include "bindings/core/v8/ScriptState.h"
@@ -11,19 +11,23 @@
#include "bindings/modules/v8/V8BindingForModules.h"
#include "modules/IndexedDBNames.h"
#include "modules/indexeddb/IDBAny.h"
-#include "modules/indexeddb/IDBKey.h"
+#include "modules/indexeddb/IDBKeyRange.h"
#include "modules/indexeddb/IDBValue.h"
+#include "public/platform/modules/indexeddb/WebIDBObservation.h"
namespace blink {
-IDBObserverChangesRecord::~IDBObserverChangesRecord() {}
+IDBObservation::~IDBObservation() {}
-ScriptValue IDBObserverChangesRecord::key(ScriptState* scriptState)
+ScriptValue IDBObservation::key(ScriptState* scriptState)
{
- return ScriptValue::from(scriptState, m_key);
+ if (!m_keyRange)
+ return ScriptValue::from(scriptState, IDBAny::createUndefined());
jsbell 2016/07/14 20:08:14 I'd lean towards: return ScriptValue(scriptState,
palakj1 2016/07/15 20:16:05 Was looking for something like that. Thanks for po
+
+ return ScriptValue::from(scriptState, m_keyRange);
}
-ScriptValue IDBObserverChangesRecord::value(ScriptState* scriptState)
+ScriptValue IDBObservation::value(ScriptState* scriptState)
{
IDBAny* value;
if (!m_value) {
jsbell 2016/07/14 20:08:14 Not this CL but: don't need {} if every branch of
palakj1 2016/07/15 20:16:05 Done.
@@ -35,7 +39,7 @@ ScriptValue IDBObserverChangesRecord::value(ScriptState* scriptState)
return scriptValue;
}
-WebIDBOperationType IDBObserverChangesRecord::stringToOperationType(const String& type)
+WebIDBOperationType IDBObservation::stringToOperationType(const String& type)
{
if (type == IndexedDBNames::add)
return WebIDBAdd;
@@ -50,7 +54,7 @@ WebIDBOperationType IDBObserverChangesRecord::stringToOperationType(const String
return WebIDBAdd;
}
-const String& IDBObserverChangesRecord::type() const
+const String& IDBObservation::type() const
{
switch (m_operationType) {
case WebIDBAdd:
@@ -71,21 +75,21 @@ const String& IDBObserverChangesRecord::type() const
}
}
-IDBObserverChangesRecord* IDBObserverChangesRecord::create(IDBKey* key, PassRefPtr<IDBValue> value, WebIDBOperationType type)
+IDBObservation* IDBObservation::create(const WebIDBObservation& observation)
{
- return new IDBObserverChangesRecord(key, value, type);
+ return new IDBObservation(observation);
}
-IDBObserverChangesRecord::IDBObserverChangesRecord(IDBKey* key, PassRefPtr<IDBValue> value, WebIDBOperationType type)
- : m_key(key)
- , m_value(value)
- , m_operationType(type)
+IDBObservation::IDBObservation(const WebIDBObservation& observation)
+ : m_keyRange(observation.keyRange)
+ , m_value(IDBValue::create(observation.value))
+ , m_operationType(observation.type)
{
}
-DEFINE_TRACE(IDBObserverChangesRecord)
+DEFINE_TRACE(IDBObservation)
{
- visitor->trace(m_key);
+ visitor->trace(m_keyRange);
}
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698