Chromium Code Reviews| 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" |
| #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())); |
|
haraken
2016/07/19 01:47:40
Can we just return ScriptValue()?
|
| + |
| + 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())); |
|
haraken
2016/07/19 01:47:40
Can we just return ScriptValue()?
|
| + |
| + 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 |