OLD | NEW |
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 650 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
661 } | 661 } |
662 } | 662 } |
663 WriteTag(SerializationTag::kEndJSSet); | 663 WriteTag(SerializationTag::kEndJSSet); |
664 WriteVarint<uint32_t>(length); | 664 WriteVarint<uint32_t>(length); |
665 return Just(true); | 665 return Just(true); |
666 } | 666 } |
667 | 667 |
668 Maybe<bool> ValueSerializer::WriteJSArrayBuffer(JSArrayBuffer* array_buffer) { | 668 Maybe<bool> ValueSerializer::WriteJSArrayBuffer(JSArrayBuffer* array_buffer) { |
669 uint32_t* transfer_entry = array_buffer_transfer_map_.Find(array_buffer); | 669 uint32_t* transfer_entry = array_buffer_transfer_map_.Find(array_buffer); |
670 if (transfer_entry) { | 670 if (transfer_entry) { |
671 DCHECK(array_buffer->was_neutered() || array_buffer->is_shared()); | |
672 WriteTag(array_buffer->is_shared() | 671 WriteTag(array_buffer->is_shared() |
673 ? SerializationTag::kSharedArrayBufferTransfer | 672 ? SerializationTag::kSharedArrayBufferTransfer |
674 : SerializationTag::kArrayBufferTransfer); | 673 : SerializationTag::kArrayBufferTransfer); |
675 WriteVarint(*transfer_entry); | 674 WriteVarint(*transfer_entry); |
676 return Just(true); | 675 return Just(true); |
677 } | 676 } |
678 | 677 |
679 if (array_buffer->is_shared()) { | 678 if (array_buffer->is_shared()) { |
680 ThrowDataCloneError( | 679 ThrowDataCloneError( |
681 MessageTemplate::kDataCloneErrorSharedArrayBufferNotTransferred); | 680 MessageTemplate::kDataCloneErrorSharedArrayBufferNotTransferred); |
(...skipping 1052 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1734 if (stack.size() != 1) { | 1733 if (stack.size() != 1) { |
1735 isolate_->Throw(*isolate_->factory()->NewError( | 1734 isolate_->Throw(*isolate_->factory()->NewError( |
1736 MessageTemplate::kDataCloneDeserializationError)); | 1735 MessageTemplate::kDataCloneDeserializationError)); |
1737 return MaybeHandle<Object>(); | 1736 return MaybeHandle<Object>(); |
1738 } | 1737 } |
1739 return scope.CloseAndEscape(stack[0]); | 1738 return scope.CloseAndEscape(stack[0]); |
1740 } | 1739 } |
1741 | 1740 |
1742 } // namespace internal | 1741 } // namespace internal |
1743 } // namespace v8 | 1742 } // namespace v8 |
OLD | NEW |