OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "bindings/modules/v8/ScriptValueSerializerForModules.h" | 5 #include "bindings/modules/v8/ScriptValueSerializerForModules.h" |
6 | 6 |
7 #include "bindings/core/v8/SerializationTag.h" | 7 #include "bindings/core/v8/SerializationTag.h" |
8 #include "bindings/core/v8/V8Binding.h" | 8 #include "bindings/core/v8/V8Binding.h" |
9 #include "bindings/modules/v8/V8CryptoKey.h" | 9 #include "bindings/modules/v8/V8CryptoKey.h" |
10 #include "bindings/modules/v8/V8DOMFileSystem.h" | 10 #include "bindings/modules/v8/V8DOMFileSystem.h" |
(...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
335 { | 335 { |
336 uint32_t type; | 336 uint32_t type; |
337 String name; | 337 String name; |
338 String url; | 338 String url; |
339 if (!doReadUint32(&type)) | 339 if (!doReadUint32(&type)) |
340 return false; | 340 return false; |
341 if (!readWebCoreString(&name)) | 341 if (!readWebCoreString(&name)) |
342 return false; | 342 return false; |
343 if (!readWebCoreString(&url)) | 343 if (!readWebCoreString(&url)) |
344 return false; | 344 return false; |
345 DOMFileSystem* fs = DOMFileSystem::create(scriptState()->executionContext(),
name, static_cast<FileSystemType>(type), KURL(ParsedURLString, url)); | 345 DOMFileSystem* fs = DOMFileSystem::create(getScriptState()->getExecutionCont
ext(), name, static_cast<FileSystemType>(type), KURL(ParsedURLString, url)); |
346 *value = toV8(fs, scriptState()->context()->Global(), isolate()); | 346 *value = toV8(fs, getScriptState()->context()->Global(), isolate()); |
347 return !value->IsEmpty(); | 347 return !value->IsEmpty(); |
348 } | 348 } |
349 | 349 |
350 bool SerializedScriptValueReaderForModules::readCryptoKey(v8::Local<v8::Value>*
value) | 350 bool SerializedScriptValueReaderForModules::readCryptoKey(v8::Local<v8::Value>*
value) |
351 { | 351 { |
352 uint32_t rawKeyType; | 352 uint32_t rawKeyType; |
353 if (!doReadUint32(&rawKeyType)) | 353 if (!doReadUint32(&rawKeyType)) |
354 return false; | 354 return false; |
355 | 355 |
356 WebCryptoKeyAlgorithm algorithm; | 356 WebCryptoKeyAlgorithm algorithm; |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
393 if (position() + keyDataLength > length()) | 393 if (position() + keyDataLength > length()) |
394 return false; | 394 return false; |
395 | 395 |
396 const uint8_t* keyData = allocate(keyDataLength); | 396 const uint8_t* keyData = allocate(keyDataLength); |
397 WebCryptoKey key = WebCryptoKey::createNull(); | 397 WebCryptoKey key = WebCryptoKey::createNull(); |
398 if (!Platform::current()->crypto()->deserializeKeyForClone( | 398 if (!Platform::current()->crypto()->deserializeKeyForClone( |
399 algorithm, type, extractable, usages, keyData, keyDataLength, key)) { | 399 algorithm, type, extractable, usages, keyData, keyDataLength, key)) { |
400 return false; | 400 return false; |
401 } | 401 } |
402 | 402 |
403 *value = toV8(CryptoKey::create(key), scriptState()->context()->Global(), is
olate()); | 403 *value = toV8(CryptoKey::create(key), getScriptState()->context()->Global(),
isolate()); |
404 return !value->IsEmpty(); | 404 return !value->IsEmpty(); |
405 } | 405 } |
406 | 406 |
407 bool SerializedScriptValueReaderForModules::doReadHmacKey(WebCryptoKeyAlgorithm&
algorithm, WebCryptoKeyType& type) | 407 bool SerializedScriptValueReaderForModules::doReadHmacKey(WebCryptoKeyAlgorithm&
algorithm, WebCryptoKeyType& type) |
408 { | 408 { |
409 uint32_t lengthBytes; | 409 uint32_t lengthBytes; |
410 if (!doReadUint32(&lengthBytes)) | 410 if (!doReadUint32(&lengthBytes)) |
411 return false; | 411 return false; |
412 WebCryptoAlgorithmId hash; | 412 WebCryptoAlgorithmId hash; |
413 if (!doReadAlgorithmId(hash)) | 413 if (!doReadAlgorithmId(hash)) |
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
627 : ScriptValueDeserializer(reader, messagePorts, arrayBufferContents, imageBi
tmapContents) | 627 : ScriptValueDeserializer(reader, messagePorts, arrayBufferContents, imageBi
tmapContents) |
628 { | 628 { |
629 } | 629 } |
630 | 630 |
631 bool ScriptValueDeserializerForModules::read(v8::Local<v8::Value>* value) | 631 bool ScriptValueDeserializerForModules::read(v8::Local<v8::Value>* value) |
632 { | 632 { |
633 return toSerializedScriptValueReaderForModules(reader()).read(value, *this); | 633 return toSerializedScriptValueReaderForModules(reader()).read(value, *this); |
634 } | 634 } |
635 | 635 |
636 } // namespace blink | 636 } // namespace blink |
OLD | NEW |