OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * | 7 * |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 405 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
416 | 416 |
417 ScriptValue deserializeScriptValue(ScriptState* scriptState, SerializedScriptVal
ue* serializedValue, const Vector<blink::WebBlobInfo>* blobInfo) | 417 ScriptValue deserializeScriptValue(ScriptState* scriptState, SerializedScriptVal
ue* serializedValue, const Vector<blink::WebBlobInfo>* blobInfo) |
418 { | 418 { |
419 v8::Isolate* isolate = scriptState->isolate(); | 419 v8::Isolate* isolate = scriptState->isolate(); |
420 v8::HandleScope handleScope(isolate); | 420 v8::HandleScope handleScope(isolate); |
421 if (serializedValue) | 421 if (serializedValue) |
422 return ScriptValue(scriptState, serializedValue->deserialize(isolate, 0,
blobInfo)); | 422 return ScriptValue(scriptState, serializedValue->deserialize(isolate, 0,
blobInfo)); |
423 return ScriptValue(scriptState, v8::Null(isolate)); | 423 return ScriptValue(scriptState, v8::Null(isolate)); |
424 } | 424 } |
425 | 425 |
426 SQLValue NativeValueTraits<SQLValue>::nativeValue(v8::Local<v8::Value> value, v8
::Isolate* isolate, ExceptionState& exceptionState) | 426 SQLValue NativeValueTraits<SQLValue>::nativeValue(v8::Isolate* isolate, v8::Loca
l<v8::Value> value, ExceptionState& exceptionState) |
427 { | 427 { |
428 if (value.IsEmpty() || value->IsNull()) | 428 if (value.IsEmpty() || value->IsNull()) |
429 return SQLValue(); | 429 return SQLValue(); |
430 if (value->IsNumber()) | 430 if (value->IsNumber()) |
431 return SQLValue(value->NumberValue()); | 431 return SQLValue(value->NumberValue()); |
432 V8StringResource<> stringValue(value); | 432 V8StringResource<> stringValue(value); |
433 if (!stringValue.prepare(exceptionState)) | 433 if (!stringValue.prepare(exceptionState)) |
434 return SQLValue(); | 434 return SQLValue(); |
435 return SQLValue(stringValue); | 435 return SQLValue(stringValue); |
436 } | 436 } |
437 | 437 |
438 IDBKey* NativeValueTraits<IDBKey*>::nativeValue(v8::Local<v8::Value> value, v8::
Isolate* isolate, ExceptionState& exceptionState) | 438 IDBKey* NativeValueTraits<IDBKey*>::nativeValue(v8::Isolate* isolate, v8::Local<
v8::Value> value, ExceptionState& exceptionState) |
439 { | 439 { |
440 return createIDBKeyFromValue(isolate, value); | 440 return createIDBKeyFromValue(isolate, value); |
441 } | 441 } |
442 | 442 |
443 IDBKeyRange* NativeValueTraits<IDBKeyRange*>::nativeValue(v8::Local<v8::Value> v
alue, v8::Isolate* isolate, ExceptionState& exceptionState) | 443 IDBKeyRange* NativeValueTraits<IDBKeyRange*>::nativeValue(v8::Isolate* isolate,
v8::Local<v8::Value> value, ExceptionState& exceptionState) |
444 { | 444 { |
445 return V8IDBKeyRange::toImplWithTypeCheck(isolate, value); | 445 return V8IDBKeyRange::toImplWithTypeCheck(isolate, value); |
446 } | 446 } |
447 | 447 |
448 #if ENABLE(ASSERT) | 448 #if ENABLE(ASSERT) |
449 void assertPrimaryKeyValidOrInjectable(ScriptState* scriptState, PassRefPtr<Shar
edBuffer> buffer, const Vector<blink::WebBlobInfo>* blobInfo, IDBKey* key, const
IDBKeyPath& keyPath) | 449 void assertPrimaryKeyValidOrInjectable(ScriptState* scriptState, PassRefPtr<Shar
edBuffer> buffer, const Vector<blink::WebBlobInfo>* blobInfo, IDBKey* key, const
IDBKeyPath& keyPath) |
450 { | 450 { |
451 ScriptState::Scope scope(scriptState); | 451 ScriptState::Scope scope(scriptState); |
452 v8::Isolate* isolate = scriptState->isolate(); | 452 v8::Isolate* isolate = scriptState->isolate(); |
453 ScriptValue keyValue = ScriptValue::from(scriptState, key); | 453 ScriptValue keyValue = ScriptValue::from(scriptState, key); |
454 ScriptValue scriptValue(scriptState, deserializeIDBValueBuffer(isolate, buff
er.get(), blobInfo)); | 454 ScriptValue scriptValue(scriptState, deserializeIDBValueBuffer(isolate, buff
er.get(), blobInfo)); |
455 | 455 |
456 // This assertion is about already persisted data, so allow experimental typ
es. | 456 // This assertion is about already persisted data, so allow experimental typ
es. |
457 const bool allowExperimentalTypes = true; | 457 const bool allowExperimentalTypes = true; |
458 IDBKey* expectedKey = createIDBKeyFromScriptValueAndKeyPathInternal(isolate,
scriptValue, keyPath, allowExperimentalTypes); | 458 IDBKey* expectedKey = createIDBKeyFromScriptValueAndKeyPathInternal(isolate,
scriptValue, keyPath, allowExperimentalTypes); |
459 ASSERT(!expectedKey || expectedKey->isEqual(key)); | 459 ASSERT(!expectedKey || expectedKey->isEqual(key)); |
460 | 460 |
461 bool injected = injectV8KeyIntoV8Value(isolate, keyValue.v8Value(), scriptVa
lue.v8Value(), keyPath); | 461 bool injected = injectV8KeyIntoV8Value(isolate, keyValue.v8Value(), scriptVa
lue.v8Value(), keyPath); |
462 ASSERT_UNUSED(injected, injected); | 462 ASSERT_UNUSED(injected, injected); |
463 } | 463 } |
464 #endif | 464 #endif |
465 | 465 |
466 } // namespace blink | 466 } // namespace blink |
OLD | NEW |