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

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

Issue 2160163002: [IndexedDB] Propogating Changes to Observer : Browser (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Working Observer 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 51%
copy from third_party/WebKit/Source/modules/indexeddb/IDBObserverChangesRecord.cpp
copy to third_party/WebKit/Source/modules/indexeddb/IDBObservation.cpp
index dba64e326ccd0a400aae60a891b95ee00351004a..e8f3634b4b7384df332290a2c0ceab44b870f53b 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,31 +11,31 @@
#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"
cmumford 2016/07/19 16:00:16 IDBObservation.cpp isn't even being compiled with
palakj1 2016/07/19 18:04:14 Sorry for that. Putting only the renaming changes
#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, v8::Undefined(scriptState->isolate()));
+
+ return ScriptValue::from(scriptState, m_keyRange);
}
-ScriptValue IDBObserverChangesRecord::value(ScriptState* scriptState)
+ScriptValue IDBObservation::value(ScriptState* scriptState)
{
- IDBAny* value;
- if (!m_value) {
- value = IDBAny::createUndefined();
- } else {
- value = IDBAny::create(m_value);
- }
- ScriptValue scriptValue = ScriptValue::from(scriptState, value);
- return scriptValue;
+ if (!m_value)
+ return ScriptValue::from(scriptState, v8::Undefined(scriptState->isolate()));
+
+ return ScriptValue::from(scriptState, IDBAny::create(m_value));
}
-WebIDBOperationType IDBObserverChangesRecord::stringToOperationType(const String& type)
+WebIDBOperationType IDBObservation::stringToOperationType(const String& type)
{
if (type == IndexedDBNames::add)
return WebIDBAdd;
@@ -50,7 +50,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 +71,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