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

Side by Side Diff: third_party/WebKit/Source/bindings/modules/v8/ScriptValueSerializerForModules.cpp

Issue 2595543003: Rename toV8(...) function in Blink to ToV8(...). (Closed)
Patch Set: Rebasing... Created 3 years, 11 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 unified diff | Download patch
OLDNEW
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 318 matching lines...) Expand 10 before | Expand all | Expand 10 after
329 String url; 329 String url;
330 if (!doReadUint32(&type)) 330 if (!doReadUint32(&type))
331 return false; 331 return false;
332 if (!readWebCoreString(&name)) 332 if (!readWebCoreString(&name))
333 return false; 333 return false;
334 if (!readWebCoreString(&url)) 334 if (!readWebCoreString(&url))
335 return false; 335 return false;
336 DOMFileSystem* fs = DOMFileSystem::create( 336 DOMFileSystem* fs = DOMFileSystem::create(
337 getScriptState()->getExecutionContext(), name, 337 getScriptState()->getExecutionContext(), name,
338 static_cast<FileSystemType>(type), KURL(ParsedURLString, url)); 338 static_cast<FileSystemType>(type), KURL(ParsedURLString, url));
339 *value = toV8(fs, getScriptState()->context()->Global(), isolate()); 339 *value = ToV8(fs, getScriptState()->context()->Global(), isolate());
340 return !value->IsEmpty(); 340 return !value->IsEmpty();
341 } 341 }
342 342
343 bool SerializedScriptValueReaderForModules::readCryptoKey( 343 bool SerializedScriptValueReaderForModules::readCryptoKey(
344 v8::Local<v8::Value>* value) { 344 v8::Local<v8::Value>* value) {
345 uint32_t rawKeyType; 345 uint32_t rawKeyType;
346 if (!doReadUint32(&rawKeyType)) 346 if (!doReadUint32(&rawKeyType))
347 return false; 347 return false;
348 348
349 WebCryptoKeyAlgorithm algorithm; 349 WebCryptoKeyAlgorithm algorithm;
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
386 if (position() + keyDataLength > length()) 386 if (position() + keyDataLength > length())
387 return false; 387 return false;
388 388
389 const uint8_t* keyData = allocate(keyDataLength); 389 const uint8_t* keyData = allocate(keyDataLength);
390 WebCryptoKey key = WebCryptoKey::createNull(); 390 WebCryptoKey key = WebCryptoKey::createNull();
391 if (!Platform::current()->crypto()->deserializeKeyForClone( 391 if (!Platform::current()->crypto()->deserializeKeyForClone(
392 algorithm, type, extractable, usages, keyData, keyDataLength, key)) { 392 algorithm, type, extractable, usages, keyData, keyDataLength, key)) {
393 return false; 393 return false;
394 } 394 }
395 395
396 *value = toV8(CryptoKey::create(key), getScriptState()->context()->Global(), 396 *value = ToV8(CryptoKey::create(key), getScriptState()->context()->Global(),
397 isolate()); 397 isolate());
398 return !value->IsEmpty(); 398 return !value->IsEmpty();
399 } 399 }
400 400
401 bool SerializedScriptValueReaderForModules::readRTCCertificate( 401 bool SerializedScriptValueReaderForModules::readRTCCertificate(
402 v8::Local<v8::Value>* value) { 402 v8::Local<v8::Value>* value) {
403 String pemPrivateKey; 403 String pemPrivateKey;
404 if (!readWebCoreString(&pemPrivateKey)) 404 if (!readWebCoreString(&pemPrivateKey))
405 return false; 405 return false;
406 String pemCertificate; 406 String pemCertificate;
407 if (!readWebCoreString(&pemCertificate)) 407 if (!readWebCoreString(&pemCertificate))
408 return false; 408 return false;
409 409
410 std::unique_ptr<WebRTCCertificateGenerator> certificateGenerator = 410 std::unique_ptr<WebRTCCertificateGenerator> certificateGenerator =
411 WTF::wrapUnique(Platform::current()->createRTCCertificateGenerator()); 411 WTF::wrapUnique(Platform::current()->createRTCCertificateGenerator());
412 412
413 std::unique_ptr<WebRTCCertificate> certificate( 413 std::unique_ptr<WebRTCCertificate> certificate(
414 certificateGenerator->fromPEM(pemPrivateKey, pemCertificate)); 414 certificateGenerator->fromPEM(pemPrivateKey, pemCertificate));
415 if (!certificate) 415 if (!certificate)
416 return false; 416 return false;
417 RTCCertificate* jsCertificate = new RTCCertificate(std::move(certificate)); 417 RTCCertificate* jsCertificate = new RTCCertificate(std::move(certificate));
418 418
419 *value = 419 *value =
420 toV8(jsCertificate, getScriptState()->context()->Global(), isolate()); 420 ToV8(jsCertificate, getScriptState()->context()->Global(), isolate());
421 return !value->IsEmpty(); 421 return !value->IsEmpty();
422 } 422 }
423 423
424 bool SerializedScriptValueReaderForModules::doReadHmacKey( 424 bool SerializedScriptValueReaderForModules::doReadHmacKey(
425 WebCryptoKeyAlgorithm& algorithm, 425 WebCryptoKeyAlgorithm& algorithm,
426 WebCryptoKeyType& type) { 426 WebCryptoKeyType& type) {
427 uint32_t lengthBytes; 427 uint32_t lengthBytes;
428 if (!doReadUint32(&lengthBytes)) 428 if (!doReadUint32(&lengthBytes))
429 return false; 429 return false;
430 WebCryptoAlgorithmId hash; 430 WebCryptoAlgorithmId hash;
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after
658 : ScriptValueDeserializer(reader, 658 : ScriptValueDeserializer(reader,
659 messagePorts, 659 messagePorts,
660 arrayBufferContents, 660 arrayBufferContents,
661 imageBitmapContents) {} 661 imageBitmapContents) {}
662 662
663 bool ScriptValueDeserializerForModules::read(v8::Local<v8::Value>* value) { 663 bool ScriptValueDeserializerForModules::read(v8::Local<v8::Value>* value) {
664 return toSerializedScriptValueReaderForModules(reader()).read(value, *this); 664 return toSerializedScriptValueReaderForModules(reader()).read(value, *this);
665 } 665 }
666 666
667 } // namespace blink 667 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698