Lines Matching refs:isolate

58 static v8::Handle<v8::Value> toV8(const IDBKeyPath& value, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
62 return v8::Null(isolate);
64 return v8String(isolate, value.string());
69 return toV8(keyPaths.release(), creationContext, isolate);
72 return v8::Undefined(isolate);
75 static v8::Handle<v8::Value> toV8(const IDBKey* key, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
89 return v8::Number::New(isolate, key->number());
91 return v8String(isolate, key->string());
93 return toV8(Uint8Array::create(reinterpret_cast<const unsigned char*>(key->binary()->data()), key->binary()->size()), creationContext, isolate);
95 return v8::Date::New(isolate, key->date());
98 v8::Local<v8::Array> array = v8::Array::New(isolate, key->array().size());
100 array->Set(i, toV8(key->array()[i].get(), creationContext, isolate));
109 static v8::Handle<v8::Value> toV8(const IDBAny* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
112 return v8::Null(isolate);
116 return v8::Undefined(isolate);
118 return v8::Null(isolate);
120 return toV8(impl->domStringList(), creationContext, isolate);
124 v8::Handle<v8::Value> cursor = toV8(impl->idbCursor(), creationContext, isolate);
125 v8::Handle<v8::Value> request = toV8(impl->idbCursor()->request(), creationContext, isolate);
126 V8HiddenValue::setHiddenValue(isolate, cursor->ToObject(), V8HiddenValue::idbCursorRequest(isolate), request);
132 v8::Handle<v8::Value> cursor = toV8(impl->idbCursorWithValue(), creationContext, isolate);
133 v8::Handle<v8::Value> request = toV8(impl->idbCursorWithValue()->request(), creationContext, isolate);
134 V8HiddenValue::setHiddenValue(isolate, cursor->ToObject(), V8HiddenValue::idbCursorRequest(isolate), request);
138 return toV8(impl->idbDatabase(), creationContext, isolate);
140 return toV8(impl->idbIndex(), creationContext, isolate);
142 return toV8(impl->idbObjectStore(), creationContext, isolate);
144 return toV8(impl->idbTransaction(), creationContext, isolate);
146 return deserializeIDBValueBuffer(isolate, impl->buffer(), impl->blobInfo());
148 return v8String(isolate, impl->string());
150 return v8::Number::New(isolate, impl->integer());
152 return toV8(impl->key(), creationContext, isolate);
154 return toV8(impl->keyPath(), creationContext, isolate);
156 v8::Handle<v8::Value> value = deserializeIDBValueBuffer(isolate, impl->buffer(), impl->blobInfo());
157 v8::Handle<v8::Value> key = toV8(impl->key(), creationContext, isolate);
158 bool injected = injectV8KeyIntoV8Value(isolate, key, value, impl->keyPath());
165 return v8::Undefined(isolate);
170 static IDBKey* createIDBKeyFromValue(v8::Isolate* isolate, v8::Handle<v8::Value> value, Vector<v8::Handle<v8::Array> >& stack, bool allowExperimentalTypes = false)
198 v8::Local<v8::Value> item = array->Get(v8::Int32::New(isolate, i));
199 IDBKey* subkey = createIDBKeyFromValue(isolate, item, stack, allowExperimentalTypes);
212 static IDBKey* createIDBKeyFromValue(v8::Isolate* isolate, v8::Handle<v8::Value> value, bool allowExperimentalTypes = false)
215 if (IDBKey* key = createIDBKeyFromValue(isolate, value, stack, allowExperimentalTypes))
237 static bool get(v8::Isolate* isolate, v8::Handle<v8::Value>& object, const String& keyPathElement, v8::Handle<v8::Value>& result)
241 result = v8::Number::New(isolate, length);
244 return object->IsObject() && getValueFrom(v8String(isolate, keyPathElement), result);
252 static bool set(v8::Isolate* isolate, v8::Handle<v8::Value>& object, const String& keyPathElement, const v8::Handle<v8::Value>& v8Value)
254 return canSet(object, keyPathElement) && setValue(object, v8String(isolate, keyPathElement), v8Value);
257 static v8::Handle<v8::Value> getNthValueOnKeyPath(v8::Isolate* isolate, v8::Handle<v8::Value>& rootValue, const Vector<String>& keyPathElements, size_t index)
263 if (!get(isolate, parentValue, keyPathElements[i], currentValue))
270 static bool canInjectNthValueOnKeyPath(v8::Isolate* isolate, v8::Handle<v8::Value>& rootValue, const Vector<String>& keyPathElements, size_t index)
281 if (!get(isolate, parentValue, keyPathElement, currentValue))
288 static v8::Handle<v8::Value> ensureNthValueOnKeyPath(v8::Isolate* isolate, v8::Handle<v8::Value>& rootValue, const Vector<String>& keyPathElements, size_t index)
296 if (!get(isolate, parentValue, keyPathElement, currentValue)) {
297 v8::Handle<v8::Object> object = v8::Object::New(isolate);
298 if (!set(isolate, parentValue, keyPathElement, object))
307 static IDBKey* createIDBKeyFromScriptValueAndKeyPathInternal(v8::Isolate* isolate, const ScriptValue& value, const String& keyPath, bool allowExperimentalTypes)
313 ASSERT(isolate->InContext());
315 v8::HandleScope handleScope(isolate);
317 v8::Handle<v8::Value> v8Key(getNthValueOnKeyPath(isolate, v8Value, keyPathElements, keyPathElements.size()));
320 return createIDBKeyFromValue(isolate, v8Key, allowExperimentalTypes);
323 static IDBKey* createIDBKeyFromScriptValueAndKeyPathInternal(v8::Isolate* isolate, const ScriptValue& value, const IDBKeyPath& keyPath, bool allowExperimentalTypes = false)
326 v8::HandleScope handleScope(isolate);
331 IDBKey* key = createIDBKeyFromScriptValueAndKeyPathInternal(isolate, value, array[i], allowExperimentalTypes);
340 return createIDBKeyFromScriptValueAndKeyPathInternal(isolate, value, keyPath.string(), allowExperimentalTypes);
343 IDBKey* createIDBKeyFromScriptValueAndKeyPath(v8::Isolate* isolate, const ScriptValue& value, const IDBKeyPath& keyPath)
346 return createIDBKeyFromScriptValueAndKeyPathInternal(isolate, value, keyPath);
349 static v8::Handle<v8::Value> deserializeIDBValueBuffer(v8::Isolate* isolate, SharedBuffer* buffer, const Vector<blink::WebBlobInfo>* blobInfo)
351 ASSERT(isolate->InContext());
353 return v8::Null(isolate);
359 return serializedValue->deserialize(isolate, 0, blobInfo);
362 bool injectV8KeyIntoV8Value(v8::Isolate* isolate, v8::Handle<v8::Value> key, v8::Handle<v8::Value> value, const IDBKeyPath& keyPath)
365 ASSERT(isolate->InContext());
376 v8::HandleScope handleScope(isolate);
377 v8::Handle<v8::Value> parent(ensureNthValueOnKeyPath(isolate, value, keyPathElements, keyPathElements.size() - 1));
381 if (!set(isolate, parent, keyPathElements.last(), key))
387 bool canInjectIDBKeyIntoScriptValue(v8::Isolate* isolate, const ScriptValue& scriptValue, const IDBKeyPath& keyPath)
400 return canInjectNthValueOnKeyPath(isolate, v8Value, keyPathElements, keyPathElements.size() - 1);
405 v8::Isolate* isolate = scriptState->isolate();
406 v8::HandleScope handleScope(isolate);
407 v8::Handle<v8::Value> v8Value(toV8(any, scriptState->context()->Global(), isolate));
413 v8::Isolate* isolate = scriptState->isolate();
414 v8::HandleScope handleScope(isolate);
415 v8::Handle<v8::Value> v8Value(toV8(key, scriptState->context()->Global(), isolate));
419 IDBKey* scriptValueToIDBKey(v8::Isolate* isolate, const ScriptValue& scriptValue)
421 ASSERT(isolate->InContext());
422 v8::HandleScope handleScope(isolate);
424 return createIDBKeyFromValue(isolate, v8Value);
427 IDBKeyRange* scriptValueToIDBKeyRange(v8::Isolate* isolate, const ScriptValue& scriptValue)
429 v8::HandleScope handleScope(isolate);
431 return V8IDBKeyRange::toImplWithTypeCheck(isolate, value);
436 v8::Isolate* isolate = scriptState->isolate();
437 v8::HandleScope handleScope(isolate);
439 return ScriptValue(scriptState, serializedValue->deserialize(isolate, 0, blobInfo));
440 return ScriptValue(scriptState, v8::Null(isolate));
447 v8::Isolate* isolate = scriptState->isolate();
449 ScriptValue scriptValue(scriptState, deserializeIDBValueBuffer(isolate, buffer.get(), blobInfo));
453 IDBKey* expectedKey = createIDBKeyFromScriptValueAndKeyPathInternal(isolate, scriptValue, keyPath, allowExperimentalTypes);
456 bool injected = injectV8KeyIntoV8Value(isolate, keyValue.v8Value(), scriptValue.v8Value(), keyPath);