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

Side by Side Diff: src/value-serializer.cc

Issue 2386233002: ValueSerializer: Expose reading/writing doubles to embedder. (Closed)
Patch Set: Created 4 years, 2 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
« no previous file with comments | « src/value-serializer.h ('k') | test/unittests/value-serializer-unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 the V8 project authors. All rights reserved. 1 // Copyright 2016 the V8 project 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 "src/value-serializer.h" 5 #include "src/value-serializer.h"
6 6
7 #include <type_traits> 7 #include <type_traits>
8 8
9 #include "src/base/logging.h" 9 #include "src/base/logging.h"
10 #include "src/conversions.h" 10 #include "src/conversions.h"
(...skipping 885 matching lines...) Expand 10 before | Expand all | Expand 10 after
896 } 896 }
897 897
898 bool ValueDeserializer::ReadUint32(uint32_t* value) { 898 bool ValueDeserializer::ReadUint32(uint32_t* value) {
899 return ReadVarint<uint32_t>().To(value); 899 return ReadVarint<uint32_t>().To(value);
900 } 900 }
901 901
902 bool ValueDeserializer::ReadUint64(uint64_t* value) { 902 bool ValueDeserializer::ReadUint64(uint64_t* value) {
903 return ReadVarint<uint64_t>().To(value); 903 return ReadVarint<uint64_t>().To(value);
904 } 904 }
905 905
906 bool ValueDeserializer::ReadDouble(double* value) {
907 return ReadDouble().To(value);
908 }
909
906 bool ValueDeserializer::ReadRawBytes(size_t length, const void** data) { 910 bool ValueDeserializer::ReadRawBytes(size_t length, const void** data) {
907 if (length > static_cast<size_t>(end_ - position_)) return false; 911 if (length > static_cast<size_t>(end_ - position_)) return false;
908 *data = position_; 912 *data = position_;
909 position_ += length; 913 position_ += length;
910 return true; 914 return true;
911 } 915 }
912 916
913 void ValueDeserializer::TransferArrayBuffer( 917 void ValueDeserializer::TransferArrayBuffer(
914 uint32_t transfer_id, Handle<JSArrayBuffer> array_buffer) { 918 uint32_t transfer_id, Handle<JSArrayBuffer> array_buffer) {
915 if (array_buffer_transfer_map_.is_null()) { 919 if (array_buffer_transfer_map_.is_null()) {
(...skipping 796 matching lines...) Expand 10 before | Expand all | Expand 10 after
1712 if (stack.size() != 1) { 1716 if (stack.size() != 1) {
1713 isolate_->Throw(*isolate_->factory()->NewError( 1717 isolate_->Throw(*isolate_->factory()->NewError(
1714 MessageTemplate::kDataCloneDeserializationError)); 1718 MessageTemplate::kDataCloneDeserializationError));
1715 return MaybeHandle<Object>(); 1719 return MaybeHandle<Object>();
1716 } 1720 }
1717 return scope.CloseAndEscape(stack[0]); 1721 return scope.CloseAndEscape(stack[0]);
1718 } 1722 }
1719 1723
1720 } // namespace internal 1724 } // namespace internal
1721 } // namespace v8 1725 } // namespace v8
OLDNEW
« no previous file with comments | « src/value-serializer.h ('k') | test/unittests/value-serializer-unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698