Manual changes to make all refcounted types be marked as `nullable` after the
changes in part 1a. This was done without any investigation into whether the
actual types want to be nullable, in order to avoid code changes.
Differential Revision: https://phabricator.services.mozilla.com/D168889
These are the IPDL compiler changes to make all refcounted types be considered
NotNull by default, building on the changes from bug 1607634.
Existing uses of IPDL refcounted types will be marked as nullable in part 1b.
Differential Revision: https://phabricator.services.mozilla.com/D168888
The code changes required for this will be in part 4b. The code is designed to
be generic as it will also be used for RefCounted types in a future patch. This
replaces the manual checking which was previously done in struct and union
serializers for non-nullable actor members.
Differential Revision: https://phabricator.services.mozilla.com/D168886
The idea behind this specialization is to provide the members which would be on
SideVariant<..> on NotNull<SideVariant<..>>, similar to how pointer-like
methods are available on `NotNull<T>`. This makes the type more ergonomic to
use from callers.
In the next part, this will be used for non-nullable actor members in IPDL
structs and IPDL unions.
Differential Revision: https://phabricator.services.mozilla.com/D168885
For now, this implementation is based on the implementation of the underlying
type, with extra checking that the value is not null before wrapping and
returning.
We may want to swap things around in the future so that types like RefPtr<T>
are deserialized using NotNull<T*> or similar, so that the unnecessary
serialization overhead of tracking nullness is unnecessary, however that is not
implemented in this patch.
Differential Revision: https://phabricator.services.mozilla.com/D168884
This change allows callers of ReadSequenceParam to return a
Maybe<output_iterator> rather than a T* which will be used to fill the
resulting sequence. Both STL collections and std::array have iterators like
this, which can be returned from these methods without dramatically changing
the signature to support types without default constructors.
For types which support output iterators, they will be used for any type
without a trivial default constructor to avoid unnecessary constructor calls
and initialization when deserializing.
Differential Revision: https://phabricator.services.mozilla.com/D168882
Previously, we would always generate a default constructor for IPDL structs
which explicitly initializes every member. This would require members to have
default initializers statically. With the new approach, each member is
individually wrapped with a template parameter which will try to ensure value
initiaization, and the default constructor is implemented with `= default;`.
The default constructor will produce a warning on clang if it is implicitly
deleted, so that warning is also suppressed.
Differential Revision: https://phabricator.services.mozilla.com/D168881
This builds on top of the work in bug 1775062, by using this new signature
everywhere, including IPDL struct members and in/outparams for IPDL messages.
This is done with relatively minimal changes by using two bindings, one of
which is a reference.
Differential Revision: https://phabricator.services.mozilla.com/D168880
This will be useful after part 3 where it will be used as part of implementing
Read based on Maybe for IPDL structs. Without this change, we'd need to copy to
construct an IPDL struct containing a non-default-constructable type.
Differential Revision: https://phabricator.services.mozilla.com/D169268
This combines the multiple fields or variants which were previously used to
track sided types like protocol types into a single field wrapped with a
SideVariant.
This will be used in the next part to avoid the need for default constructors
for actor types allowing the proper types to be used.
Differential Revision: https://phabricator.services.mozilla.com/D168879
This is semantically similar to the existing available() method, however will
not block, and doesn't need to do the work to actually determine the number of
available bytes.
As part of this patch, I also fixed one available() implementation which was
incorrectly throwing NS_BASE_STREAM_WOULD_BLOCK.
Differential Revision: https://phabricator.services.mozilla.com/D170697
This new method can be used to check if the nsIOutputStream has been
closed without having data available to write. It should avoid blocking
to discover this information.
Differential Revision: https://phabricator.services.mozilla.com/D170696
Manual changes to make all refcounted types be marked as `nullable` after the
changes in part 1a. This was done without any investigation into whether the
actual types want to be nullable, in order to avoid code changes.
Differential Revision: https://phabricator.services.mozilla.com/D168889
These are the IPDL compiler changes to make all refcounted types be considered
NotNull by default, building on the changes from bug 1607634.
Existing uses of IPDL refcounted types will be marked as nullable in part 1b.
Differential Revision: https://phabricator.services.mozilla.com/D168888
The code changes required for this will be in part 4b. The code is designed to
be generic as it will also be used for RefCounted types in a future patch. This
replaces the manual checking which was previously done in struct and union
serializers for non-nullable actor members.
Differential Revision: https://phabricator.services.mozilla.com/D168886
The idea behind this specialization is to provide the members which would be on
SideVariant<..> on NotNull<SideVariant<..>>, similar to how pointer-like
methods are available on `NotNull<T>`. This makes the type more ergonomic to
use from callers.
In the next part, this will be used for non-nullable actor members in IPDL
structs and IPDL unions.
Differential Revision: https://phabricator.services.mozilla.com/D168885
For now, this implementation is based on the implementation of the underlying
type, with extra checking that the value is not null before wrapping and
returning.
We may want to swap things around in the future so that types like RefPtr<T>
are deserialized using NotNull<T*> or similar, so that the unnecessary
serialization overhead of tracking nullness is unnecessary, however that is not
implemented in this patch.
Differential Revision: https://phabricator.services.mozilla.com/D168884
This change allows callers of ReadSequenceParam to return a
Maybe<output_iterator> rather than a T* which will be used to fill the
resulting sequence. Both STL collections and std::array have iterators like
this, which can be returned from these methods without dramatically changing
the signature to support types without default constructors.
For types which support output iterators, they will be used for any type
without a trivial default constructor to avoid unnecessary constructor calls
and initialization when deserializing.
Differential Revision: https://phabricator.services.mozilla.com/D168882
Previously, we would always generate a default constructor for IPDL structs
which explicitly initializes every member. This would require members to have
default initializers statically. With the new approach, each member is
individually wrapped with a template parameter which will try to ensure value
initiaization, and the default constructor is implemented with `= default;`.
The default constructor will produce a warning on clang if it is implicitly
deleted, so that warning is also suppressed.
Differential Revision: https://phabricator.services.mozilla.com/D168881
This builds on top of the work in bug 1775062, by using this new signature
everywhere, including IPDL struct members and in/outparams for IPDL messages.
This is done with relatively minimal changes by using two bindings, one of
which is a reference.
Differential Revision: https://phabricator.services.mozilla.com/D168880
This will be useful after part 3 where it will be used as part of implementing
Read based on Maybe for IPDL structs. Without this change, we'd need to copy to
construct an IPDL struct containing a non-default-constructable type.
Differential Revision: https://phabricator.services.mozilla.com/D169268
This combines the multiple fields or variants which were previously used to
track sided types like protocol types into a single field wrapped with a
SideVariant.
This will be used in the next part to avoid the need for default constructors
for actor types allowing the proper types to be used.
Differential Revision: https://phabricator.services.mozilla.com/D168879