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

Side by Side Diff: src/api.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 | « include/v8.h ('k') | src/value-serializer.h » ('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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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/api.h" 5 #include "src/api.h"
6 6
7 #include <string.h> // For memcpy, strlen. 7 #include <string.h> // For memcpy, strlen.
8 #ifdef V8_USE_ADDRESS_SANITIZER 8 #ifdef V8_USE_ADDRESS_SANITIZER
9 #include <sanitizer/asan_interface.h> 9 #include <sanitizer/asan_interface.h>
10 #endif // V8_USE_ADDRESS_SANITIZER 10 #endif // V8_USE_ADDRESS_SANITIZER
(...skipping 2957 matching lines...) Expand 10 before | Expand all | Expand 10 after
2968 } 2968 }
2969 2969
2970 void ValueSerializer::WriteUint32(uint32_t value) { 2970 void ValueSerializer::WriteUint32(uint32_t value) {
2971 private_->serializer.WriteUint32(value); 2971 private_->serializer.WriteUint32(value);
2972 } 2972 }
2973 2973
2974 void ValueSerializer::WriteUint64(uint64_t value) { 2974 void ValueSerializer::WriteUint64(uint64_t value) {
2975 private_->serializer.WriteUint64(value); 2975 private_->serializer.WriteUint64(value);
2976 } 2976 }
2977 2977
2978 void ValueSerializer::WriteDouble(double value) {
2979 private_->serializer.WriteDouble(value);
2980 }
2981
2978 void ValueSerializer::WriteRawBytes(const void* source, size_t length) { 2982 void ValueSerializer::WriteRawBytes(const void* source, size_t length) {
2979 private_->serializer.WriteRawBytes(source, length); 2983 private_->serializer.WriteRawBytes(source, length);
2980 } 2984 }
2981 2985
2982 MaybeLocal<Object> ValueDeserializer::Delegate::ReadHostObject( 2986 MaybeLocal<Object> ValueDeserializer::Delegate::ReadHostObject(
2983 Isolate* v8_isolate) { 2987 Isolate* v8_isolate) {
2984 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(v8_isolate); 2988 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(v8_isolate);
2985 isolate->ScheduleThrow(*isolate->factory()->NewError( 2989 isolate->ScheduleThrow(*isolate->factory()->NewError(
2986 isolate->error_function(), 2990 isolate->error_function(),
2987 i::MessageTemplate::kDataCloneDeserializationError)); 2991 i::MessageTemplate::kDataCloneDeserializationError));
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
3092 } 3096 }
3093 3097
3094 bool ValueDeserializer::ReadUint32(uint32_t* value) { 3098 bool ValueDeserializer::ReadUint32(uint32_t* value) {
3095 return private_->deserializer.ReadUint32(value); 3099 return private_->deserializer.ReadUint32(value);
3096 } 3100 }
3097 3101
3098 bool ValueDeserializer::ReadUint64(uint64_t* value) { 3102 bool ValueDeserializer::ReadUint64(uint64_t* value) {
3099 return private_->deserializer.ReadUint64(value); 3103 return private_->deserializer.ReadUint64(value);
3100 } 3104 }
3101 3105
3106 bool ValueDeserializer::ReadDouble(double* value) {
3107 return private_->deserializer.ReadDouble(value);
3108 }
3109
3102 bool ValueDeserializer::ReadRawBytes(size_t length, const void** data) { 3110 bool ValueDeserializer::ReadRawBytes(size_t length, const void** data) {
3103 return private_->deserializer.ReadRawBytes(length, data); 3111 return private_->deserializer.ReadRawBytes(length, data);
3104 } 3112 }
3105 3113
3106 // --- D a t a --- 3114 // --- D a t a ---
3107 3115
3108 bool Value::FullIsUndefined() const { 3116 bool Value::FullIsUndefined() const {
3109 i::Handle<i::Object> object = Utils::OpenHandle(this); 3117 i::Handle<i::Object> object = Utils::OpenHandle(this);
3110 bool result = false; 3118 bool result = false;
3111 if (!object->IsSmi()) { 3119 if (!object->IsSmi()) {
(...skipping 6252 matching lines...) Expand 10 before | Expand all | Expand 10 after
9364 Address callback_address = 9372 Address callback_address =
9365 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); 9373 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback));
9366 VMState<EXTERNAL> state(isolate); 9374 VMState<EXTERNAL> state(isolate);
9367 ExternalCallbackScope call_scope(isolate, callback_address); 9375 ExternalCallbackScope call_scope(isolate, callback_address);
9368 callback(info); 9376 callback(info);
9369 } 9377 }
9370 9378
9371 9379
9372 } // namespace internal 9380 } // namespace internal
9373 } // namespace v8 9381 } // namespace v8
OLDNEW
« no previous file with comments | « include/v8.h ('k') | src/value-serializer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698