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 369 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
380 // Deserialize just the value data & blobInfo from the given IDBValue. | 380 // Deserialize just the value data & blobInfo from the given IDBValue. |
381 // Does not deserialize the key & keypath. | 381 // Does not deserialize the key & keypath. |
382 static v8::Local<v8::Value> deserializeIDBValueData(v8::Isolate* isolate, | 382 static v8::Local<v8::Value> deserializeIDBValueData(v8::Isolate* isolate, |
383 const IDBValue* value) { | 383 const IDBValue* value) { |
384 ASSERT(isolate->InContext()); | 384 ASSERT(isolate->InContext()); |
385 if (!value || value->isNull()) | 385 if (!value || value->isNull()) |
386 return v8::Null(isolate); | 386 return v8::Null(isolate); |
387 | 387 |
388 RefPtr<SerializedScriptValue> serializedValue = | 388 RefPtr<SerializedScriptValue> serializedValue = |
389 value->createSerializedValue(); | 389 value->createSerializedValue(); |
390 return serializedValue->deserialize(isolate, nullptr, value->blobInfo()); | 390 SerializedScriptValue::DeserializeOptions options; |
| 391 options.blobInfo = value->blobInfo(); |
| 392 return serializedValue->deserialize(isolate, options); |
391 } | 393 } |
392 | 394 |
393 // Deserialize the entire IDBValue (injecting key & keypath if present). | 395 // Deserialize the entire IDBValue (injecting key & keypath if present). |
394 static v8::Local<v8::Value> deserializeIDBValue( | 396 static v8::Local<v8::Value> deserializeIDBValue( |
395 v8::Isolate* isolate, | 397 v8::Isolate* isolate, |
396 v8::Local<v8::Object> creationContext, | 398 v8::Local<v8::Object> creationContext, |
397 const IDBValue* value) { | 399 const IDBValue* value) { |
398 ASSERT(isolate->InContext()); | 400 ASSERT(isolate->InContext()); |
399 if (!value || value->isNull()) | 401 if (!value || value->isNull()) |
400 return v8::Null(isolate); | 402 return v8::Null(isolate); |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
534 return false; | 536 return false; |
535 } | 537 } |
536 return true; | 538 return true; |
537 } | 539 } |
538 | 540 |
539 ScriptValue deserializeScriptValue(ScriptState* scriptState, | 541 ScriptValue deserializeScriptValue(ScriptState* scriptState, |
540 SerializedScriptValue* serializedValue, | 542 SerializedScriptValue* serializedValue, |
541 const Vector<WebBlobInfo>* blobInfo) { | 543 const Vector<WebBlobInfo>* blobInfo) { |
542 v8::Isolate* isolate = scriptState->isolate(); | 544 v8::Isolate* isolate = scriptState->isolate(); |
543 v8::HandleScope handleScope(isolate); | 545 v8::HandleScope handleScope(isolate); |
544 if (serializedValue) | 546 if (!serializedValue) |
545 return ScriptValue( | 547 return ScriptValue::createNull(scriptState); |
546 scriptState, serializedValue->deserialize(isolate, nullptr, blobInfo)); | 548 |
547 return ScriptValue(scriptState, v8::Null(isolate)); | 549 SerializedScriptValue::DeserializeOptions options; |
| 550 options.blobInfo = blobInfo; |
| 551 return ScriptValue(scriptState, |
| 552 serializedValue->deserialize(isolate, options)); |
548 } | 553 } |
549 | 554 |
550 SQLValue NativeValueTraits<SQLValue>::nativeValue( | 555 SQLValue NativeValueTraits<SQLValue>::nativeValue( |
551 v8::Isolate* isolate, | 556 v8::Isolate* isolate, |
552 v8::Local<v8::Value> value, | 557 v8::Local<v8::Value> value, |
553 ExceptionState& exceptionState) { | 558 ExceptionState& exceptionState) { |
554 if (value.IsEmpty() || value->IsNull()) | 559 if (value.IsEmpty() || value->IsNull()) |
555 return SQLValue(); | 560 return SQLValue(); |
556 if (value->IsNumber()) | 561 if (value->IsNumber()) |
557 return SQLValue(value.As<v8::Number>()->Value()); | 562 return SQLValue(value.As<v8::Number>()->Value()); |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
603 if (expectedKey && expectedKey->isEqual(value->primaryKey())) | 608 if (expectedKey && expectedKey->isEqual(value->primaryKey())) |
604 return; | 609 return; |
605 | 610 |
606 bool injected = injectV8KeyIntoV8Value( | 611 bool injected = injectV8KeyIntoV8Value( |
607 isolate, keyValue.v8Value(), scriptValue.v8Value(), value->keyPath()); | 612 isolate, keyValue.v8Value(), scriptValue.v8Value(), value->keyPath()); |
608 DCHECK(injected); | 613 DCHECK(injected); |
609 } | 614 } |
610 #endif | 615 #endif |
611 | 616 |
612 } // namespace blink | 617 } // namespace blink |
OLD | NEW |