Skip to content

Commit 963a7b4

Browse files
tsaichienmeta-codesync[bot]
authored andcommitted
ISerialization methods should take in const jsi::Value& (#56410)
Summary: Pull Request resolved: #56410 Missed when we first added the `ISerialization` interface. In JSI APIs, `Value` is generally passed in as a const reference. This makes it clear that the actual reference, not the referent, is const. Fixing the serialization methods to be consistent with the rest of JSI. Changelog: [Internal] Reviewed By: lavenzg Differential Revision: D100222030
1 parent 81c9968 commit 963a7b4

File tree

1 file changed

+4
-4
lines changed
  • packages/react-native/ReactCommon/jsi/jsi

1 file changed

+4
-4
lines changed

packages/react-native/ReactCommon/jsi/jsi/jsi.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,7 @@ class JSI_EXPORT ISerialization : public ICast {
286286
/// It returns a shared pointer of an opaque Serialized object that can be
287287
/// deserialized multiple times. The lifetime of the Serialized object is not
288288
/// tied to the lifetime of the original object.
289-
virtual std::shared_ptr<Serialized> serialize(Value& value) = 0;
289+
virtual std::shared_ptr<Serialized> serialize(const Value& value) = 0;
290290

291291
/// Given a Serialized object provided by \p serialized, deserialize it using
292292
/// the structured clone algorithm into a JS value in the current runtime.
@@ -302,7 +302,7 @@ class JSI_EXPORT ISerialization : public ICast {
302302
/// deserializeWithTransfer. The lifetime of the Serialized object is not tied
303303
/// to the lifetime of the original object.
304304
virtual std::unique_ptr<Serialized> serializeWithTransfer(
305-
Value& value,
305+
const Value& value,
306306
const Array& transferList) = 0;
307307

308308
/// Using the structure clone algorithm, deserialize the object provided by \p
@@ -313,8 +313,8 @@ class JSI_EXPORT ISerialization : public ICast {
313313
/// serialized data entirely and make the serialized objects in the current
314314
/// runtime. Any transferred values in the serialized object will be owned by
315315
/// the current runtime.
316-
// This method returns an Array containing the deserialized values, where the
317-
// first element is the value passed into serializeWithTransfer,
316+
/// This method returns an Array containing the deserialized values, where
317+
/// the first element is the value passed into serializeWithTransfer,
318318
/// followed by all transferred values.
319319
virtual Array deserializeWithTransfer(
320320
std::unique_ptr<Serialized>& serialized) = 0;

0 commit comments

Comments
 (0)