A framework for building native applications using React
msggen support for cdp previews (#36781)
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/36781 ---- Add support to msggen for types like: * Runtime.CustomPreview * Runtime.EntryPreview * Runtime.ObjectPreview * Runtime.PropertyPreview And their related use as properties. There was quite a gap here. The work involves: * Upgrade devtools-protocol to 0.0.1107588 even pick up the schema definitions in the first place. * Next problem: all the preview stuff is experimental. Had to add support to --include-experimental flag for targeting types AND properties. * Next problem: the protocol schema for previews is cyclical. ObjectPreview refers to PropertyPreview and EntryPreview, which both refer back to ObjectPreview. msggen only allowed for DAGs. Added support for allowing cycles. * Next problem: Forward declarations are not enough to compensate for the cyclical references, because of the incomplete type definitions. This breaks optional, vector, and simple containment. To address this: * In the graph traversal code, where before we would error if the graph had a cycle, we allow for the cycle, but record the cyclical reference from a property on Type B's to Type A. * Whenever we emit the definition of Type B, its references to Type A are not naked, they are now wrapped in a unique_ptr. * However, because the unique_ptr only has a forward declaration, and not a complete type, we need to specify a custom deleter. * Next problem: There are lots of cases where these types that now contain unique_ptrs were being copied, which no longer works. So, make all these codegen'd types move-only, and change a few places where were copying root objects, to move them instead. * Many tests required changes to avoid copy construction/assignment that were occuring. MessageTypes are not copyable construcrtible/assignable now. Changelog: [Internal] Reviewed By: jpporto Differential Revision: D43553742 fbshipit-source-id: 1e4c495aa600feb6f1901e6bc013d517ba8d8a2d
B
Brian Long committed
de35e2881ea7984716ee225b0f5e242a168932cc
Parent: aa15fd4
Committed by Facebook GitHub Bot <[email protected]>
on 4/4/2023, 9:17:43 PM