2 * Copyright (c) 2021-present Samsung Electronics Co., Ltd
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
20 #if defined(ENABLE_THREADING)
22 #ifndef __EscargotSerializedSharedArrayBufferObjectValue__
23 #define __EscargotSerializedSharedArrayBufferObjectValue__
25 #include "runtime/serialization/SerializedValue.h"
26 #include "runtime/SharedArrayBufferObject.h"
30 class SerializedSharedArrayBufferObjectValue : public SerializedValue {
31 friend class Serializer;
34 virtual Type type() override
36 return SerializedValue::SharedArrayBufferObject;
39 virtual Value toValue(ExecutionState& state) override
41 return Value(new ::Escargot::SharedArrayBufferObject(state, state.context()->globalObject()->sharedArrayBufferPrototype(), m_bufferData));
45 virtual void serializeValueData(std::ostringstream& outputStream) override
47 size_t ptr = reinterpret_cast<size_t>(m_bufferData);
49 outputStream << std::endl;
52 static std::unique_ptr<SerializedValue> deserializeFrom(std::istringstream& inputStream)
56 SharedArrayBufferObjectBackingStoreData* data = reinterpret_cast<SharedArrayBufferObjectBackingStoreData*>(ptr);
57 return std::unique_ptr<SerializedValue>(new SerializedSharedArrayBufferObjectValue(data));
60 SerializedSharedArrayBufferObjectValue(SharedArrayBufferObjectBackingStoreData* bufferData)
61 : m_bufferData(bufferData)
66 ~SerializedSharedArrayBufferObjectValue()
68 m_bufferData->deref();
71 SharedArrayBufferObjectBackingStoreData* m_bufferData;
74 } // namespace Escargot