mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 00:42:44 +00:00 
			
		
		
		
	LibWeb: Move serialize_* methods outside scope of Serializer class
These methods are useful independent of the class Serializer, so let's move their declarations to the header file and and outside the scope of the Serializer class.
This commit is contained in:
		
							parent
							
								
									985d0dd270
								
							
						
					
					
						commit
						dcf5ff5178
					
				
					 2 changed files with 173 additions and 160 deletions
				
			
		|  | @ -1,6 +1,7 @@ | |||
| /*
 | ||||
|  * Copyright (c) 2022, Daniel Ehrenberg <dan@littledan.dev> | ||||
|  * Copyright (c) 2022, Andrew Kaster <akaster@serenityos.org> | ||||
|  * Copyright (c) 2024, Kenneth Myhra <kennethmyhra@serenityos.org> | ||||
|  * | ||||
|  * SPDX-License-Identifier: BSD-2-Clause | ||||
|  */ | ||||
|  | @ -12,6 +13,8 @@ | |||
| #include <AK/Vector.h> | ||||
| #include <LibIPC/Forward.h> | ||||
| #include <LibJS/Forward.h> | ||||
| #include <LibJS/Runtime/DataView.h> | ||||
| #include <LibJS/Runtime/TypedArray.h> | ||||
| #include <LibWeb/WebIDL/ExceptionOr.h> | ||||
| 
 | ||||
| // Structured serialize is an entirely different format from IPC because:
 | ||||
|  | @ -50,6 +53,14 @@ WebIDL::ExceptionOr<SerializationRecord> structured_serialize_internal(JS::VM& v | |||
| 
 | ||||
| WebIDL::ExceptionOr<JS::Value> structured_deserialize(JS::VM& vm, SerializationRecord const& serialized, JS::Realm& target_realm, Optional<DeserializationMemory>); | ||||
| 
 | ||||
| WebIDL::ExceptionOr<void> serialize_bytes(JS::VM& vm, Vector<u32>& vector, ReadonlyBytes bytes); | ||||
| WebIDL::ExceptionOr<void> serialize_string(JS::VM& vm, Vector<u32>& vector, DeprecatedFlyString const& string); | ||||
| WebIDL::ExceptionOr<void> serialize_string(JS::VM& vm, Vector<u32>& vector, String const& string); | ||||
| WebIDL::ExceptionOr<void> serialize_string(JS::VM& vm, Vector<u32>& vector, JS::PrimitiveString const& primitive_string); | ||||
| WebIDL::ExceptionOr<void> serialize_array_buffer(JS::VM& vm, Vector<u32>& vector, JS::ArrayBuffer const& array_buffer, bool for_storage); | ||||
| template<OneOf<JS::TypedArrayBase, JS::DataView> ViewType> | ||||
| WebIDL::ExceptionOr<void> serialize_viewed_array_buffer(JS::VM& vm, Vector<u32>& vector, ViewType const& view, bool for_storage, SerializationMemory& memory); | ||||
| 
 | ||||
| WebIDL::ExceptionOr<ByteBuffer> deserialize_bytes(JS::VM& vm, ReadonlySpan<u32> vector, size_t& position); | ||||
| WebIDL::ExceptionOr<String> deserialize_string(JS::VM& vm, ReadonlySpan<u32> vector, size_t& position); | ||||
| WebIDL::ExceptionOr<JS::NonnullGCPtr<JS::PrimitiveString>> deserialize_string_primitive(JS::VM& vm, ReadonlySpan<u32> vector, size_t& position); | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Kenneth Myhra
						Kenneth Myhra