Commit Graph

52 Commits

Author SHA1 Message Date
Kelsey Gilbert
74331bb704 Bug 1909019 - Use ParamTraits_TiedFields/_IsEnumCase in WebRenderMessageUtils instead of PlainOldDataSerializer. (partial) r=gw,mccr8,ahale
Differential Revision: https://phabricator.services.mozilla.com/D217508
2024-07-26 23:51:25 +00:00
Iulian Moraru
fb811cfefc Backed out 2 changesets (bug 1909019) for causing base-toolchains build bustages on Maybe.h. CLOSED TREE
Backed out changeset 6d4968c19bfe (bug 1909019)
Backed out changeset c1c101a0dde5 (bug 1909019)
2024-07-26 22:38:28 +03:00
Kelsey Gilbert
d455fa2c18 Bug 1909019 - Use ParamTraits_TiedFields/_IsEnumCase in WebRenderMessageUtils instead of PlainOldDataSerializer. (partial) r=gw,mccr8,ahale
Differential Revision: https://phabricator.services.mozilla.com/D217508
2024-07-26 16:54:46 +00:00
unknown
41269ebdeb Bug 1885246 - Replace PlainOldDataSerializer with ParamTraits_TiedFields, except for gfx/vr and gfx/layers/wr. r=mccr8
Differential Revision: https://phabricator.services.mozilla.com/D204567
2024-03-23 01:06:45 +00:00
Cristian Tuns
7428a41223 Backed out changeset ebc075fd132d (bug 1885246) for causing bc failures in /EnumSerializer.h CLOSED TREE 2024-03-23 02:08:24 -04:00
unknown
7c6439af2c Bug 1885246 - Replace PlainOldDataSerializer with ParamTraits_TiedFields, except for gfx/vr and gfx/layers/wr. r=mccr8
Differential Revision: https://phabricator.services.mozilla.com/D204567
2024-03-23 01:06:45 +00:00
Iulian Moraru
976d4b928a Backed out changeset 1e8b7f3addc7 (bug 1885246) for causing non-unified build bustages on TCPSocket.cpp. CLOSED TREE 2024-03-21 17:53:50 +02:00
unknown
00bd7adfe7 Bug 1885246 - Replace PlainOldDataSerializer with ParamTraits_TiedFields, except for gfx/vr and gfx/layers/wr. r=mccr8
Differential Revision: https://phabricator.services.mozilla.com/D204567
2024-03-21 14:04:04 +00:00
Narcis Beleuzu
adc79e5c55 Backed out changeset 98564ffc07ca (bug 1885246) for bustages on WebGLIpdl.h 2024-03-20 04:26:20 +02:00
unknown
426ab35b9e Bug 1885246 - Replace PlainOldDataSerializer with ParamTraits_TiedFields, except for gfx/vr and gfx/layers/wr. r=mccr8
Differential Revision: https://phabricator.services.mozilla.com/D204567
2024-03-20 01:56:09 +00:00
Gabriele Svelto
e1e9346196 Bug 1831092 - Use the new pull-based API for all crash annotations and remove the global annotations table r=jgilbert,necko-reviewers,media-playback-reviewers,profiler-reviewers,win-reviewers,padenot,handyman,afranchuk,valentin,alwu,sotaro
This changes comes with several different refactorings all rolled into one,
unfotunately I couldn't find a way to pull them apart:
- First of all annotations now can either recorded (that is, we copy the value
  and have the crash reporting code own the copy) or registered. Several
  annotations are changed to use this functionality so that we don't need to
  update them as their value change.
- The code in the exception handler is modified to read the annotations from
  the mozannotation_client crate. This has the unfortunate side-effect that
  we need three different bits of code to serialize them: one for annotations
  read from a child process, one for reading annotations from the main process
  outside of the exception handler and one for reading annotations from the
  main process within the exception handler. As we move to fully
  out-of-process crash reporting the last two methods will go away.
- The mozannotation_client crate now doesn't record annotation types anymore.
  I realized as I was working on this that storing types at runtime has two
  issues: the first one is that buggy code might change the type of an
  annotation (that is record it under two different types at two different
  moments), the second issue is that types might become corrupt during a
  crash, so better enforce them at annotation-writing time. The end result is
  that the mozannotation_* crates now only store byte buffers, track the
  format the data is stored in (null-terminated string, fixed size buffer,
  etc...) but not the type of data each annotation is supposed to contain.
- Which brings us to the next change: concrete types for annotations are now
  enforced when they're written out. If an annotation doesn't match the
  expected type it's skipped. Storing an annotation with the wrong type will
  also trigger an assertion in debug builds.

Differential Revision: https://phabricator.services.mozilla.com/D195248
2024-03-04 10:24:43 +00:00
Kelsey Gilbert
73a4bedb0b Bug 1878930 - s/RawBuffer/Span/: UniformData. r=gfx-reviewers,lsalzman
Differential Revision: https://phabricator.services.mozilla.com/D202024
2024-02-29 00:37:28 +00:00
Sandor Molnar
d9c4b21b0d Backed out 7 changesets (bug 1878930) for causing build bustages @ dom/canvas/WebGLTypes.h CLOSED TREE
Backed out changeset 631db0feebb4 (bug 1878930)
Backed out changeset 72ab4dbbf8ed (bug 1878930)
Backed out changeset e5119acd8c8f (bug 1878930)
Backed out changeset 3cd4b2423281 (bug 1878930)
Backed out changeset 4a5512ff4424 (bug 1878930)
Backed out changeset 6f5c64075e31 (bug 1878930)
Backed out changeset fb3b3487a529 (bug 1878930)
2024-02-20 21:25:02 +02:00
Kelsey Gilbert
2a1d0926b2 Bug 1878930 - s/RawBuffer/Span/: UniformData. r=gfx-reviewers,lsalzman
Differential Revision: https://phabricator.services.mozilla.com/D202024
2024-02-20 17:59:07 +00:00
Andi-Bogdan Postelnicu
7ca4abd93a Bug 1277372 - Move away from "mozilla/TypeTraits.h". r=geckoview-reviewers,sergesanspaille,m_kato
std::is_pod has been deprecated in C++20, see https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2017/p0767r1.html.
This is equivalent with std::is_trivial_v && std::is_standard_layout.

Differential Revision: https://phabricator.services.mozilla.com/D174128
2023-04-17 13:50:11 +00:00
Kelsey Gilbert
47073a4193 Bug 1798703 - Enforce alignment for UniformData via union rather than overalignment. r=lsalzman
Reverts the overalignment from bug 1794237.

Differential Revision: https://phabricator.services.mozilla.com/D161360
2022-11-07 07:24:43 +00:00
Kelsey Gilbert
a501fff8f7 Bug 1778808 - Trim unused code, particularly in TiedFields.h. r=nika
Differential Revision: https://phabricator.services.mozilla.com/D153828
2022-08-09 21:01:56 +00:00
Kelsey Gilbert
5edd8d5841 Bug 1778808 - Use stricter TiedFields instead of IsTriviallySerializable in WebGL's QueueParamTraits. r=lsalzman,nika
```
// We guarantee our robustness via these requirements:
// * Object.MutTiedFields() gives us a tuple,
// * where the combined sizeofs all field types sums to sizeof(Object),
//   * (thus we know we are exhaustively listing all fields)
// * where feeding each field back into ParamTraits succeeds,
// * and ParamTraits is only automated for BytesAlwaysValidT<T> types.
// (BytesAlwaysValidT rejects bool and enum types, and only accepts int/float
// types, or array or std::arrays of such types)
// (Yes, bit-field fields are rejected by MutTiedFields too)
```

BytesAlwaysValidT<T> is the same as the IsTriviallySerializable<T> that
it replaces, however the emphasis is different, and should discourage
tagging structs as IsTriviallySerializable, since they more clearly
aren't BytesAlwaysValid.

Differential Revision: https://phabricator.services.mozilla.com/D151676
2022-08-09 21:01:55 +00:00
Nika Layzell
cf198bf8ef Bug 1773361 - Remove QueueParamTraits<Shmem>, r=jgilbert
Differential Revision: https://phabricator.services.mozilla.com/D148680
2022-06-09 16:03:25 +00:00
Kagami Sascha Rosylight
16d6c685f3 Bug 1768189 - Part 7: Apply modernize-concat-nested-namespaces to dom/cache/FileUtilsImpl.h ... r=andi
Depends on D145740

Differential Revision: https://phabricator.services.mozilla.com/D145741
2022-05-09 20:41:05 +00:00
Kelsey Gilbert
8312d58153 Bug 1703654 - Deal with Maybe<> not trivially_copyable on build-linux64-base-toolchains. r=gfx-reviewers,lsalzman
Start moving away from manual (risky!) IsTriviallySerializable<>.

Differential Revision: https://phabricator.services.mozilla.com/D145252
2022-05-02 23:54:10 +00:00
Butkovits Atila
20e3a83123 Backed out changeset 0d23532d6a49 (bug 1757802) as requested by dev. CLOSED TREE 2022-04-22 23:20:08 +03:00
Nika Layzell
279b99a010 Bug 1757802 - Don't keep alive Shmem shared memory regions on IProtocol, r=ipc-reviewers,jld
With this new approach, Shmem instances will now have their handles
transferred inline within messages as attachments, rather than being
associated with their actors and sent in separate messages.

This has a few advantages:

* The implementation is much simpler
* Releasing all references to a Shmem will automatically destroy it by
  RAII, rather than leaking the shared memory region until the toplevel
  actor is destroyed, removing the need for types like RaiiShmem.
* This allows re-transmitting Shmem instances to another process, as we
  don't close the shared memory region handle upon receiving it.

But also has a disadvantage that because we keep alive the shared memory
region's handle until the shmem is destroyed, so that it can be
re-transmitted, we may end up using more FDs or HANDLEs while running.

This patch intentionally doesn't change or simplify callsites, removing
APIs like RaiiShmem, in order to make it easier to revert if this causes
issues on platforms like Linux due to FD exhaustion. If we don't run
into increased resource exhaustion problems, we can make these changes
in a follow-up.

Differential Revision: https://phabricator.services.mozilla.com/D140211
2022-04-18 19:26:15 +00:00
Nika Layzell
d163dced99 Bug 1761536 - Part 2: Replace nsTArray::elem_type with value_type, r=mccr8
There weren't that many uses of the existing typedef, so it seemed like
it might be worthwhile to just replace all uses of the previous typedef
with the stl-like one.

Differential Revision: https://phabricator.services.mozilla.com/D142705
2022-04-01 17:00:25 +00:00
Kelsey Gilbert
ba695cd2c2 Bug 1750310 - Centralize and reuse pixelstorei pack/unpack handling. r=lsalzman
* Accept that finding an explicit unpack for a given stride might fail.
* Directly use the logic from the GLES spec for unpacking stride calculations.
* Use structuredSrcSize member.
* Calc explicit unpack based on dstStride, not srcStride.

Differential Revision: https://phabricator.services.mozilla.com/D136052
2022-02-12 02:20:42 +00:00
Kelsey Gilbert
4d978ff74d Bug 1746111 - (Re)serialize WebRTC frame SurfaceDescriptorBuffers for convert-and-upload on WebGLParent. r=gfx-reviewers,nika,lsalzman
Also generally de-inline (WebGLParent::TexImage not DispatchCommand)
TexImage(SurfaceDescriptor).

Differential Revision: https://phabricator.services.mozilla.com/D132851
2021-12-15 01:54:21 +00:00
Andi-Bogdan Postelnicu
13a062f45f Bug 1519636 - First reformat with clang-format 13.0.0. r=firefox-build-system-reviewers,sylvestre,mhentges
Updated with clang-format version 13.0.0 (taskcluster-OgjH5lasS5K_fvefdRcJVg)

Depends on D131114

Differential Revision: https://phabricator.services.mozilla.com/D129119
2021-11-16 08:07:30 +00:00
Jeff Gilbert
da69a4aa02 Bug 1730282 - Cleanup IPC WebGL code. r=gfx-reviewers,lsalzman
* Replace QueueStatus with bool
* Remove unused structs and code
* Add some MOZ_LIKELY to (de)serialization branches

Differential Revision: https://phabricator.services.mozilla.com/D125295
2021-09-11 02:11:11 +00:00
aardgoose
0fe7b824a2 Bug 1367251 - ignore gl.UNPACK_FLIP_Y_WEBGL & UNPACK_PREMULTIPLY_ALPHA for textures uploading ImageBitmap data as per spec. r=jgilbert
***

Differential Revision: https://phabricator.services.mozilla.com/D29469
2021-09-02 00:29:28 +00:00
Kagami Sascha Rosylight
a00f02f0fc Bug 1723050 - Part 6: Replace typedef by using in dom/canvas/ r=jgilbert
Differential Revision: https://phabricator.services.mozilla.com/D121298
2021-07-30 15:30:52 +00:00
Jeff Gilbert
f08bafd495 Bug 1699201 - Wrap shmem for TexUnpackBlobDesc's DataSourceSurface deser. r=lsalzman
+ Add mochitest.

Differential Revision: https://phabricator.services.mozilla.com/D112461
2021-04-17 03:45:11 +00:00
Simon Giesecke
7434af8b0a Bug 1693003 - Remove redundant nullptr checks of return value of infallible new in dom/. r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D105292
2021-02-16 15:52:10 +00:00
Simon Giesecke
9fe615e415 Bug 1689415 - Avoid UB when validating enum values in EnumSerializer. r=mccr8
Previously, there was undefined behaviour when validating enum values in
EnumSerializer, which were actually invalid (which was hit during fuzzing, e.g.),
because the invalid integral value was cast to the enum type for comparison.
This patch changes the comparison to cast the valid values to their integral
values instead and compare those.

Differential Revision: https://phabricator.services.mozilla.com/D103449
2021-02-02 18:04:05 +00:00
Jeff Gilbert
a315d0bc8f Bug 1640607 - Send SurfaceDescriptors for GPU blitting for video-to-webgl. r=lsalzman
Differential Revision: https://phabricator.services.mozilla.com/D101061
2021-01-14 01:23:06 +00:00
Simon Giesecke
111849c749 Bug 1677466 - Move ParamTraits specializations with extra dependencies out of IPCMessageUtils.h. r=mccr8
This moves parts of IPCMessageUtils.h to two new header files and adapts
the include directives as necessary. The new header files are:
- EnumSerializer.h, which defines the templates for enum serializers
- IPCMessageUtilsSpecializations.h, which defines template specializations
  of ParamTraits with extra dependencies (building upon both IPCMessageUtils.h
  and EnumSerializer.h)

This should minimize the dependencies pulled in by every consumer of
IPCMessageUtils.h

Differential Revision: https://phabricator.services.mozilla.com/D94459
2020-12-10 11:09:21 +00:00
Simon Giesecke
46908cfb51 Bug 1660470 - Add missing include directives/forward declarations. r=nika
Differential Revision: https://phabricator.services.mozilla.com/D87865
2020-11-23 16:21:38 +00:00
unknown
563cac58b0 Bug 1665280 - For RawBuffer reads, return a view into the shmem. r=lsalzman
Differential Revision: https://phabricator.services.mozilla.com/D90354
2020-09-16 07:16:48 +00:00
David Parks
389c352b4b Bug 1659523: Secure bool and enum serialization in remote WebGL r=jgilbert
"Validate" bools to guarantee they always (de)serialize to proper values.  Require that all enums use EnumSerializer or their own special handlers.

Differential Revision: https://phabricator.services.mozilla.com/D87367
2020-08-25 16:10:21 +00:00
Jeff Gilbert
6e48f9d1a9 Bug 1607940 - IPC TexImage. r=lsalzman,nika,handyman
Differential Revision: https://phabricator.services.mozilla.com/D83291
2020-07-21 22:57:01 +00:00
Jeff Gilbert
f60d94e923 Bug 1607940 - Stand up webgl.out-of-process:true path. r=handyman,nika,froydnj
* Use clearer pref names.
* Default (and only support) IPDL dispatching.
* Make DispatchCommands async-only.
* Sync ipdl command per sync webgl entrypoint.
  * Eat the boilerplate cost, since there's not too many.
* Run SerializedSize off same path as Serialize.
* All shmem uploads go through normal DispatchCommands.
* Defer pruning of dead code for now so we can iterate quickly.
* Use Read/Write(begin,end) instead of (begin,size).
  * This would have prevented a bug where we read/wrote N*sizeof(T)*sizeof(T).

Differential Revision: https://phabricator.services.mozilla.com/D81495
2020-07-21 22:56:52 +00:00
Simon Giesecke
a69d79b6db Bug 1648010 - Replace uses of NS_LITERAL_STRING/NS_LITERAL_CSTRING macros by _ns literals. r=geckoview-reviewers,jgilbert,agi,hsivonen,froydnj
Differential Revision: https://phabricator.services.mozilla.com/D80860
2020-07-01 08:29:29 +00:00
David Parks
6f5f3502cd Bug 1624726: Part 6 - Eliminate pointers from QueueParamTraits::Read r=jgilbert
Since we are no longer peeking or removing without copying, Read always gets a valid object.  This makes its parameter a reference and removes extraneous null checks.

Differential Revision: https://phabricator.services.mozilla.com/D78544
2020-06-08 23:42:37 +00:00
David Parks
4bc06dd933 Bug 1624726: Part 5 - Eliminate pointers in QueueParamTraits::MinSize r=jgilbert
Since we are no longer peeking or removing without copying, MinSize always gets a valid object.  This converts its parameter to a reference and removes extraneous null checks.

Differential Revision: https://phabricator.services.mozilla.com/D78543
2020-06-08 23:35:56 +00:00
David Parks
65cdf7691d Bug 1624726: Part 4 - Remove peeking and no-copy remove methods from ProducerConsumerQueue r=jgilbert
Peeking or pulling entries from the queue without deserializing them into an object requires making QueueParamTraits more complex.  We don't currently need the functionality; the added complexity isn't worth it.

Differential Revision: https://phabricator.services.mozilla.com/D78542
2020-06-08 23:35:48 +00:00
David Parks
748e560684 Bug 1624726: Part 3 - Add EnumSerializers for WebGL QueueParamTraits r=jgilbert
EnumSerializers allow for easy enum validation in deserialization.  The implementation is taken from IPDL's EnumSerializers and uses the IPDL EnumValidator classes and is used in exactly the same way.

Differential Revision: https://phabricator.services.mozilla.com/D78541
2020-06-08 23:35:46 +00:00
David Parks
d80cdeeb9e Bug 1624726: Part 2 - Clean up some WebGL QueueParamTraits code r=jgilbert
Removing dead code, cleaning up comments, etc.

Differential Revision: https://phabricator.services.mozilla.com/D78540
2020-06-08 23:35:44 +00:00
David Parks
f605d4a36d Bug 1624726: Part 1 - Remove argument type checking in WebGL remoting r=jgilbert
Type checking these queues turned out not to be useful.  It added tokens to the stream that validated the type of the data in the stream against the type of the objects that it would deserialize into.  However, the IPC mechanism is already completely type safe at the source code level so it was not useful in debugging.

Differential Revision: https://phabricator.services.mozilla.com/D78539
2020-06-08 23:35:39 +00:00
David Parks
58cb70c884 Bug 1635956: Part 1 - Refactor WebGL QueueParamTraits to use Push/PopShmem r=jgilbert
The old style of using SharedMemory objects was fine for Windows but was incompatible with Mac and Linux because the objects were not sent to the remote process with the proper socket scheme.  This meant that shared memory could not be read by the destination process.  Shmems are capable of this on all platforms so we use them instead.

Differential Revision: https://phabricator.services.mozilla.com/D74972
2020-06-02 06:16:42 +00:00
Kershaw Chang
546c6c8250 Bug 1539819 - P1: Make TRRService work in socket process r=dragana,necko-reviewers
Differential Revision: https://phabricator.services.mozilla.com/D68880
2020-05-18 20:18:03 +00:00
David Parks
2ef6299d48 Bug 1621762: Part 4 - Move some code from ProducerConsumerQueue.h to QueueParamTraits.h r=jgilbert
Move QueueParamTraits, which are common between PCQ and IpdlQueue, to a file they both include.  This also changes the namespace of a handful of the classes, like the Marshaller.

Differential Revision: https://phabricator.services.mozilla.com/D68260
2020-04-30 22:23:10 +00:00