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

Unified Diff: Source/bindings/modules/v8/V8BindingForModules.cpp

Issue 1021713003: [bindings] Let NativeValueTraits<T>::nativeValue be variadic function and merge various convers… (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: IDB related changes alone. Created 5 years, 9 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: Source/bindings/modules/v8/V8BindingForModules.cpp
diff --git a/Source/bindings/modules/v8/V8BindingForModules.cpp b/Source/bindings/modules/v8/V8BindingForModules.cpp
index c15eb036eee0acd67dc7d832400970072c63b41d..15caa463a86cd16caa0e4f41870a917d26425443 100644
--- a/Source/bindings/modules/v8/V8BindingForModules.cpp
+++ b/Source/bindings/modules/v8/V8BindingForModules.cpp
@@ -303,7 +303,7 @@ static v8::Local<v8::Value> ensureNthValueOnKeyPath(v8::Isolate* isolate, v8::Lo
return currentValue;
}
-static IDBKey* createIDBKeyFromScriptValueAndKeyPathInternal(v8::Isolate* isolate, const ScriptValue& value, const String& keyPath, bool allowExperimentalTypes)
+static IDBKey* createIDBKeyFromScriptValueAndKeyPathInternal(v8::Isolate* isolate, v8::Local<v8::Value> v8Value, const String& keyPath, bool allowExperimentalTypes)
{
Vector<String> keyPathElements;
IDBKeyPathParseError error;
@@ -312,14 +312,13 @@ static IDBKey* createIDBKeyFromScriptValueAndKeyPathInternal(v8::Isolate* isolat
ASSERT(isolate->InContext());
v8::HandleScope handleScope(isolate);
- v8::Local<v8::Value> v8Value(value.v8Value());
v8::Local<v8::Value> v8Key(getNthValueOnKeyPath(isolate, v8Value, keyPathElements, keyPathElements.size()));
if (v8Key.IsEmpty())
return 0;
return createIDBKeyFromValue(isolate, v8Key, allowExperimentalTypes);
}
-static IDBKey* createIDBKeyFromScriptValueAndKeyPathInternal(v8::Isolate* isolate, const ScriptValue& value, const IDBKeyPath& keyPath, bool allowExperimentalTypes = false)
+static IDBKey* createIDBKeyFromScriptValueAndKeyPathInternal(v8::Isolate* isolate, v8::Local<v8::Value> value, const IDBKeyPath& keyPath, bool allowExperimentalTypes = false)
{
ASSERT(!keyPath.isNull());
v8::HandleScope handleScope(isolate);
@@ -339,12 +338,6 @@ static IDBKey* createIDBKeyFromScriptValueAndKeyPathInternal(v8::Isolate* isolat
return createIDBKeyFromScriptValueAndKeyPathInternal(isolate, value, keyPath.string(), allowExperimentalTypes);
}
-IDBKey* createIDBKeyFromScriptValueAndKeyPath(v8::Isolate* isolate, const ScriptValue& value, const IDBKeyPath& keyPath)
-{
- IDB_TRACE("createIDBKeyFromScriptValueAndKeyPath");
- return createIDBKeyFromScriptValueAndKeyPathInternal(isolate, value, keyPath);
-}
-
static v8::Local<v8::Value> deserializeIDBValueBuffer(v8::Isolate* isolate, SharedBuffer* buffer, const Vector<blink::WebBlobInfo>* blobInfo)
{
ASSERT(isolate->InContext());
@@ -440,6 +433,12 @@ IDBKey* NativeValueTraits<IDBKey*>::nativeValue(v8::Isolate* isolate, v8::Local<
return createIDBKeyFromValue(isolate, value);
}
+IDBKey* NativeValueTraits<IDBKey*>::nativeValue(v8::Isolate* isolate, v8::Local<v8::Value> value, ExceptionState& exceptionState, const IDBKeyPath& keyPath)
+{
+ IDB_TRACE("createIDBKeyFromScriptValueAndKeyPath");
+ return createIDBKeyFromScriptValueAndKeyPathInternal(isolate, value, keyPath);
+}
+
IDBKeyRange* NativeValueTraits<IDBKeyRange*>::nativeValue(v8::Isolate* isolate, v8::Local<v8::Value> value, ExceptionState& exceptionState)
{
return V8IDBKeyRange::toImplWithTypeCheck(isolate, value);
@@ -455,7 +454,7 @@ void assertPrimaryKeyValidOrInjectable(ScriptState* scriptState, PassRefPtr<Shar
// This assertion is about already persisted data, so allow experimental types.
const bool allowExperimentalTypes = true;
- IDBKey* expectedKey = createIDBKeyFromScriptValueAndKeyPathInternal(isolate, scriptValue, keyPath, allowExperimentalTypes);
+ IDBKey* expectedKey = createIDBKeyFromScriptValueAndKeyPathInternal(isolate, scriptValue.v8Value(), keyPath, allowExperimentalTypes);
ASSERT(!expectedKey || expectedKey->isEqual(key));
bool injected = injectV8KeyIntoV8Value(isolate, keyValue.v8Value(), scriptValue.v8Value(), keyPath);
« no previous file with comments | « Source/bindings/modules/v8/V8BindingForModules.h ('k') | Source/bindings/modules/v8/V8BindingForModulesTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698