class Flatland
Defined at line 54 of file ../../src/ui/scenic/lib/flatland/flatland.h
Implements the `fuchsia.ui.composition.Flatland` protocol. It is intended to run on its own
thread/dispatcher, and communicates with the main/render thread(s) via the UberStruct mechanism,
as well as other interfaces such as FlatlandPresenter. Because `fuchsia.ui.composition.Flatland`
is a stateful protocol, each client is connected to a different Flatland object.
Public Methods
void Flatland (const Flatland & )
Because this object captures its "this" pointer in internal closures, it is unsafe to copy or
move it. Disable all copy and move operations.
Defined at line 95 of file ../../src/ui/scenic/lib/flatland/flatland.h
Flatland & operator= (const Flatland & )
Defined at line 96 of file ../../src/ui/scenic/lib/flatland/flatland.h
void Flatland (Flatland && )
Defined at line 97 of file ../../src/ui/scenic/lib/flatland/flatland.h
Flatland & operator= (Flatland && )
Defined at line 98 of file ../../src/ui/scenic/lib/flatland/flatland.h
std::shared_ptr<Flatland> New (std::shared_ptr<utils::DispatcherHolder>dispatcher_holder,fidl::ServerEnd<fuchsia_ui_composition::Flatland>server_end,scheduling::SessionIdsession_id,std::function<void ()>destroy_instance_function,std::shared_ptr<FlatlandPresenter>flatland_presenter,std::shared_ptr<LinkSystem>link_system,std::shared_ptr<UberStructSystem::UberStructQueue>uber_struct_queue,const std::vector<std::shared_ptr<allocation::BufferCollectionImporter>> &buffer_collection_importers,fit::function<void (fidl::ServerEnd<fuchsia_ui_views::Focuser>, zx_koid_t)>register_view_focuser,fit::function<void (fidl::ServerEnd<fuchsia_ui_views::ViewRefFocused>, zx_koid_t)>register_view_ref_focused,fit::function<void (fidl::ServerEnd<fuchsia_ui_pointer::TouchSource>, zx_koid_t)>register_touch_source,fit::function<void (fidl::ServerEnd<fuchsia_ui_pointer::MouseSource>, zx_koid_t)>register_mouse_source,const FlatlandConfig &config)
Instantiates a new Flatland object and binds it to serve the Flatland protocol over the
`server_end` channel. Method invocations received on this channel will be serviced on
the thread managed by `dispatcher_holder`.
The `destroy_instance_function` is called to notify the instance's manager that the instance
should be destroyed. This function is invoked on the thread owned by `dispatcher_holder`. When
this function is invoked, the client FIDL connection has already been closed. There are two
situations that result in the invocation of `destroy_instance_function`:
- the client closes the FIDL channel
- the client makes illegal use of the API (or associated APIs like ChildViewWatcher)
`flatland_presenter`, `link_system`, `uber_struct_queue`, and `buffer_collection_importers`
allow this Flatland object to access resources shared by all Flatland instances for actions
like frame scheduling, linking, buffer allocation, and presentation to the global scene graph.
Defined at line 116 of file ../../src/ui/scenic/lib/flatland/flatland.cc
void ReplaceChildren (TransformId parent_transform_id, std::initializer_list<TransformId> new_child_transform_ids)
Defined at line 168 of file ../../src/ui/scenic/lib/flatland/flatland.h
void ~Flatland ()
Defined at line 279 of file ../../src/ui/scenic/lib/flatland/flatland.cc
const FlatlandConfig & config ()
Allow others to see how this Flatland session is configured.
Defined at line 312 of file ../../src/ui/scenic/lib/flatland/flatland.h
void Present (PresentRequest & request, PresentCompleter::Sync & completer)
|fuchsia_ui_composition::Flatland|
Defined at line 331 of file ../../src/ui/scenic/lib/flatland/flatland.cc
void Present (fuchsia_ui_composition::PresentArgs args)
Defined at line 335 of file ../../src/ui/scenic/lib/flatland/flatland.cc
void CreateView (CreateViewRequest & request, CreateViewCompleter::Sync & completer)
|fuchsia_ui_composition::Flatland|
Defined at line 661 of file ../../src/ui/scenic/lib/flatland/flatland.cc
void CreateView (fuchsia_ui_views::ViewCreationToken token, fidl::ServerEnd<fuchsia_ui_composition::ParentViewportWatcher> parent_viewport_watcher)
Defined at line 666 of file ../../src/ui/scenic/lib/flatland/flatland.cc
void CreateView2 (CreateView2Request & request, CreateView2Completer::Sync & completer)
Defined at line 673 of file ../../src/ui/scenic/lib/flatland/flatland.cc
void CreateView2 (fuchsia_ui_views::ViewCreationTokentoken,fuchsia_ui_views::ViewIdentityOnCreationview_identity,fuchsia_ui_composition::ViewBoundProtocolsprotocols,fidl::ServerEnd<fuchsia_ui_composition::ParentViewportWatcher>parent_viewport_watcher)
Defined at line 679 of file ../../src/ui/scenic/lib/flatland/flatland.cc
void ReleaseView (ReleaseViewCompleter::Sync & completer)
|fuchsia_ui_composition::Flatland|
TODO(https://fxbug.dev/42162046): Consider returning tokens for re-linking.
Defined at line 792 of file ../../src/ui/scenic/lib/flatland/flatland.cc
void ReleaseView ()
Defined at line 794 of file ../../src/ui/scenic/lib/flatland/flatland.cc
void Clear (ClearCompleter::Sync & completer)
|fuchsia_ui_composition::Flatland|
Defined at line 823 of file ../../src/ui/scenic/lib/flatland/flatland.cc
void Clear ()
Defined at line 825 of file ../../src/ui/scenic/lib/flatland/flatland.cc
void CreateTransform (CreateTransformRequest & request, CreateTransformCompleter::Sync & completer)
|fuchsia_ui_composition::Flatland|
Defined at line 855 of file ../../src/ui/scenic/lib/flatland/flatland.cc
void CreateTransform (TransformId transform_id)
Defined at line 860 of file ../../src/ui/scenic/lib/flatland/flatland.cc
void SetTranslation (SetTranslationRequest & request, SetTranslationCompleter::Sync & completer)
|fuchsia_ui_composition::Flatland|
Defined at line 880 of file ../../src/ui/scenic/lib/flatland/flatland.cc
void SetTranslation (TransformId transform_id, fuchsia_math::Vec translation)
Defined at line 885 of file ../../src/ui/scenic/lib/flatland/flatland.cc
void SetOrientation (SetOrientationRequest & request, SetOrientationCompleter::Sync & completer)
|fuchsia_ui_composition::Flatland|
Defined at line 907 of file ../../src/ui/scenic/lib/flatland/flatland.cc
void SetOrientation (TransformId transform_id, fuchsia_ui_composition::Orientation orientation)
Defined at line 912 of file ../../src/ui/scenic/lib/flatland/flatland.cc
void SetScale (SetScaleRequest & request, SetScaleCompleter::Sync & completer)
|fuchsia_ui_composition::Flatland|
Defined at line 935 of file ../../src/ui/scenic/lib/flatland/flatland.cc
void SetScale (TransformId transform_id, fuchsia_math::VecF scale)
Defined at line 939 of file ../../src/ui/scenic/lib/flatland/flatland.cc
void SetOpacity (SetOpacityRequest & request, SetOpacityCompleter::Sync & completer)
|fuchsia_ui_composition::Flatland|
Defined at line 977 of file ../../src/ui/scenic/lib/flatland/flatland.cc
void SetOpacity (TransformId transform_id, float value)
Defined at line 981 of file ../../src/ui/scenic/lib/flatland/flatland.cc
void SetClipBoundary (SetClipBoundaryRequest & request, SetClipBoundaryCompleter::Sync & completer)
|fuchsia_ui_composition::Flatland|
Defined at line 1019 of file ../../src/ui/scenic/lib/flatland/flatland.cc
void SetClipBoundary (TransformId transform_id, fidl::Box<fuchsia_math::Rect> bounds)
Defined at line 1024 of file ../../src/ui/scenic/lib/flatland/flatland.cc
void AddChild (AddChildRequest & request, AddChildCompleter::Sync & completer)
|fuchsia_ui_composition::Flatland|
Defined at line 1112 of file ../../src/ui/scenic/lib/flatland/flatland.cc
void AddChild (TransformId parent_transform_id, TransformId child_transform_id)
Defined at line 1116 of file ../../src/ui/scenic/lib/flatland/flatland.cc
void RemoveChild (RemoveChildRequest & request, RemoveChildCompleter::Sync & completer)
|fuchsia_ui_composition::Flatland|
Defined at line 1150 of file ../../src/ui/scenic/lib/flatland/flatland.cc
void RemoveChild (TransformId parent_transform_id, TransformId child_transform_id)
Defined at line 1155 of file ../../src/ui/scenic/lib/flatland/flatland.cc
void ReplaceChildren (ReplaceChildrenRequest & request, ReplaceChildrenCompleter::Sync & completer)
|fuchsia_ui_composition::Flatland|
Defined at line 1191 of file ../../src/ui/scenic/lib/flatland/flatland.cc
void ReplaceChildren (TransformId parent_transform_id, std::span<const TransformId> new_child_transform_ids)
Defined at line 1207 of file ../../src/ui/scenic/lib/flatland/flatland.cc
void SetRootTransform (SetRootTransformRequest & request, SetRootTransformCompleter::Sync & completer)
|fuchsia_ui_composition::Flatland|
Defined at line 1266 of file ../../src/ui/scenic/lib/flatland/flatland.cc
void SetRootTransform (TransformId transform_id)
Defined at line 1271 of file ../../src/ui/scenic/lib/flatland/flatland.cc
void CreateViewport (CreateViewportRequest & request, CreateViewportCompleter::Sync & completer)
|fuchsia_ui_composition::Flatland|
Defined at line 1298 of file ../../src/ui/scenic/lib/flatland/flatland.cc
void CreateViewport (ContentIdviewport_id,fuchsia_ui_views::ViewportCreationTokentoken,fuchsia_ui_composition::ViewportPropertiesproperties,fidl::ServerEnd<fuchsia_ui_composition::ChildViewWatcher>child_view_watcher)
Defined at line 1306 of file ../../src/ui/scenic/lib/flatland/flatland.cc
void CreateImage (CreateImageRequest & request, CreateImageCompleter::Sync & completer)
|fuchsia_ui_composition::Flatland|
Defined at line 1432 of file ../../src/ui/scenic/lib/flatland/flatland.cc
void CreateImage (ContentIdimage_id,fuchsia_ui_composition::BufferCollectionImportTokenimport_token,uint32_tvmo_index,fuchsia_ui_composition::ImagePropertiesproperties)
Defined at line 1439 of file ../../src/ui/scenic/lib/flatland/flatland.cc
void SetImageSampleRegion (SetImageSampleRegionRequest & request, SetImageSampleRegionCompleter::Sync & completer)
|fuchsia_ui_composition::Flatland|
Defined at line 1581 of file ../../src/ui/scenic/lib/flatland/flatland.cc
void SetImageSampleRegion (ContentId image_id, types::RectangleF rect)
Defined at line 1586 of file ../../src/ui/scenic/lib/flatland/flatland.cc
void SetImageDestinationSize (SetImageDestinationSizeRequest & request, SetImageDestinationSizeCompleter::Sync & completer)
|fuchsia_ui_composition::Flatland|
Defined at line 1659 of file ../../src/ui/scenic/lib/flatland/flatland.cc
void SetImageDestinationSize (ContentId image_id, fuchsia_math::SizeU size)
Defined at line 1664 of file ../../src/ui/scenic/lib/flatland/flatland.cc
void SetImageBlendingFunction (SetImageBlendingFunctionRequest & request, SetImageBlendingFunctionCompleter::Sync & completer)
|fuchsia_ui_composition::Flatland|
Defined at line 1704 of file ../../src/ui/scenic/lib/flatland/flatland.cc
void SetImageBlendMode (SetImageBlendModeRequest & request, SetImageBlendModeCompleter::Sync & completer)
|fuchsia_ui_composition::Flatland|
Defined at line 1709 of file ../../src/ui/scenic/lib/flatland/flatland.cc
void SetImageBlendMode (ContentId image_id, BlendMode blend_mode)
Defined at line 1714 of file ../../src/ui/scenic/lib/flatland/flatland.cc
void SetImageFlip (SetImageFlipRequest & request, SetImageFlipCompleter::Sync & completer)
|fuchsia_ui_composition::Flatland|
Defined at line 1748 of file ../../src/ui/scenic/lib/flatland/flatland.cc
void SetImageFlip (ContentId image_id, fuchsia_ui_composition::ImageFlip flip)
Defined at line 1752 of file ../../src/ui/scenic/lib/flatland/flatland.cc
void CreateFilledRect (CreateFilledRectRequest & request, CreateFilledRectCompleter::Sync & completer)
|fuchsia_ui_composition::Flatland|
Defined at line 1787 of file ../../src/ui/scenic/lib/flatland/flatland.cc
void CreateFilledRect (ContentId rect_id)
Defined at line 1792 of file ../../src/ui/scenic/lib/flatland/flatland.cc
void SetSolidFill (SetSolidFillRequest & request, SetSolidFillCompleter::Sync & completer)
|fuchsia_ui_composition::Flatland|
Defined at line 1841 of file ../../src/ui/scenic/lib/flatland/flatland.cc
void SetSolidFill (ContentIdrect_id,fuchsia_ui_composition::ColorRgbacolor,fuchsia_math::SizeUsize)
Defined at line 1845 of file ../../src/ui/scenic/lib/flatland/flatland.cc
void ReleaseFilledRect (ReleaseFilledRectRequest & request, ReleaseFilledRectCompleter::Sync & completer)
|fuchsia_ui_composition::Flatland|
Defined at line 1914 of file ../../src/ui/scenic/lib/flatland/flatland.cc
void ReleaseFilledRect (ContentId rect_id)
Defined at line 1919 of file ../../src/ui/scenic/lib/flatland/flatland.cc
void SetImageOpacity (SetImageOpacityRequest & request, SetImageOpacityCompleter::Sync & completer)
|fuchsia_ui_composition::Flatland|
Defined at line 1961 of file ../../src/ui/scenic/lib/flatland/flatland.cc
void SetImageOpacity (ContentId image_id, float opacity)
Defined at line 1966 of file ../../src/ui/scenic/lib/flatland/flatland.cc
void SetHitRegions (SetHitRegionsRequest & request, SetHitRegionsCompleter::Sync & completer)
|fuchsia_ui_composition::Flatland|
Defined at line 2014 of file ../../src/ui/scenic/lib/flatland/flatland.cc
void SetHitRegions (TransformId transform_id, std::vector<fuchsia_ui_composition::HitRegion> regions)
Defined at line 2019 of file ../../src/ui/scenic/lib/flatland/flatland.cc
void SetInfiniteHitRegion (SetInfiniteHitRegionRequest & request, SetInfiniteHitRegionCompleter::Sync & completer)
|fuchsia_ui_composition::Flatland|
Defined at line 2057 of file ../../src/ui/scenic/lib/flatland/flatland.cc
void SetInfiniteHitRegion (TransformId transform_id, fuchsia_ui_composition::HitTestInteraction hit_test)
Defined at line 2062 of file ../../src/ui/scenic/lib/flatland/flatland.cc
void SetContent (SetContentRequest & request, SetContentCompleter::Sync & completer)
|fuchsia_ui_composition::Flatland|
Defined at line 2082 of file ../../src/ui/scenic/lib/flatland/flatland.cc
void SetContent (TransformId transform_id, ContentId content_id)
Defined at line 2086 of file ../../src/ui/scenic/lib/flatland/flatland.cc
void SetViewportProperties (SetViewportPropertiesRequest & request, SetViewportPropertiesCompleter::Sync & completer)
|fuchsia_ui_composition::Flatland|
Defined at line 2126 of file ../../src/ui/scenic/lib/flatland/flatland.cc
void SetViewportProperties (ContentId viewport_id, fuchsia_ui_composition::ViewportProperties properties)
Defined at line 2131 of file ../../src/ui/scenic/lib/flatland/flatland.cc
void ReleaseTransform (ReleaseTransformRequest & request, ReleaseTransformCompleter::Sync & completer)
|fuchsia_ui_composition::Flatland|
Defined at line 2188 of file ../../src/ui/scenic/lib/flatland/flatland.cc
void ReleaseTransform (TransformId transform_id)
Defined at line 2193 of file ../../src/ui/scenic/lib/flatland/flatland.cc
void ReleaseViewport (ReleaseViewportRequest & request, ReleaseViewportCompleter::Sync & completer)
|fuchsia_ui_composition::Flatland|
Defined at line 2214 of file ../../src/ui/scenic/lib/flatland/flatland.cc
void ReleaseViewport (ContentId viewport_id, fit::function<void (fuchsia_ui_views::ViewportCreationToken)> completer)
Defined at line 2223 of file ../../src/ui/scenic/lib/flatland/flatland.cc
void ReleaseImage (ReleaseImageRequest & request, ReleaseImageCompleter::Sync & completer)
|fuchsia_ui_composition::Flatland|
Defined at line 2287 of file ../../src/ui/scenic/lib/flatland/flatland.cc
void ReleaseImage (ContentId image_id)
Defined at line 2291 of file ../../src/ui/scenic/lib/flatland/flatland.cc
void SetDebugName (SetDebugNameRequest & request, SetDebugNameCompleter::Sync & completer)
|fuchsia_ui_composition::Flatland|
Defined at line 2337 of file ../../src/ui/scenic/lib/flatland/flatland.cc
void SetDebugName (std::string name)
Defined at line 2346 of file ../../src/ui/scenic/lib/flatland/flatland.cc
void ReleaseImageImmediately (ReleaseImageImmediatelyRequest & request, ReleaseImageImmediatelyCompleter::Sync & completer)
|fuchsia_ui_composition::TrustedFlatland|
Defined at line 2357 of file ../../src/ui/scenic/lib/flatland/flatland.cc
void ReleaseImageImmediately (ContentId image_id)
Defined at line 2362 of file ../../src/ui/scenic/lib/flatland/flatland.cc
void OnNextFrameBegin (uint32_t additional_present_credits, FuturePresentationInfos presentation_infos)
Called just before the FIDL client receives the event of the same name, indicating that this
Flatland instance should allow a |additional_present_credits| calls to Present().
Defined at line 2424 of file ../../src/ui/scenic/lib/flatland/flatland.cc
void OnFramePresented (const std::map<scheduling::PresentId, zx::time> & latched_times, scheduling::PresentTimestamps present_times)
Called when this Flatland instance should send the OnFramePresented() event to the FIDL
client.
Defined at line 2445 of file ../../src/ui/scenic/lib/flatland/flatland.cc
TransformHandle GetRoot ()
For validating the transform hierarchy in tests only. For the sake of testing, the "root" will
always be the top-most TransformHandle from the TransformGraph owned by this Flatland. If
currently linked to a parent, that means the Link's child_transform_handle. If not, that means
the local_root_.
Defined at line 2479 of file ../../src/ui/scenic/lib/flatland/flatland.cc
std::optional<TransformHandle> GetContentHandle (ContentId content_id)
For validating properties associated with content in tests only. If |content_id| does not
exist for this Flatland instance, returns std::nullopt.
Defined at line 2483 of file ../../src/ui/scenic/lib/flatland/flatland.cc
std::optional<TransformHandle> GetTransformHandle (TransformId transform_id)
For validating properties associated with transforms in tests only. If |transform_id| does not
exist for this Flatland instance, returns std::nullopt.
Defined at line 2493 of file ../../src/ui/scenic/lib/flatland/flatland.cc
void SetErrorReporter (std::unique_ptr<scenic_impl::ErrorReporter> error_reporter)
For validating logs in tests only.
Defined at line 2501 of file ../../src/ui/scenic/lib/flatland/flatland.cc
scheduling::SessionId GetSessionId ()
For using as a unique identifier in tests only.
Defined at line 2505 of file ../../src/ui/scenic/lib/flatland/flatland.cc
LayerHandle CreateLayerObject ()
TODO(https://fxbug.dev/523371761): public for tests. Later, revisit whether any can be
made private (if so, they'll be reordered in the file).
Consider using `friend class FlatlandTest`.
Defined at line 2593 of file ../../src/ui/scenic/lib/flatland/flatland.cc
allocation::GlobalImageId ReleaseLayerObject (LayerHandle handle)
Releases a reference to the internal layer. If this is the last reference
to the layer (ref_count reaches 0), the layer is destroyed.
Returns the ID of the bound image if the layer was destroyed AND it had
an image bound to it; otherwise returns kInvalidImageId.
The returned ID is primarily used by CleanupFlatland2StateForTest() to
verify correct image lifecycle behavior in unit tests.
Defined at line 2601 of file ../../src/ui/scenic/lib/flatland/flatland.cc
TransformHandle CreateLayerStackData (std::vector<LayerHandle> layers)
Defined at line 2636 of file ../../src/ui/scenic/lib/flatland/flatland.cc
std::vector<allocation::GlobalImageId> CleanupFlatland2StateForTest (const std::vector<TransformHandle> & dead_handles)
Test-only accessor/mutators
TODO(https://fxbug.dev/523371761): once everything lands, verify whether these are necessary
to keep, or whether they are well-covered by tests for production callers such as
`CreateImage()` and `ProcessDeadTransforms()`.
Defined at line 2652 of file ../../src/ui/scenic/lib/flatland/flatland.cc
void SetLayerImageForTest (LayerHandle handle, allocation::GlobalImageId image)
Defined at line 2677 of file ../../src/ui/scenic/lib/flatland/flatland.cc
void SetLayerSolidColorForTest (LayerHandle handle)
Defined at line 2690 of file ../../src/ui/scenic/lib/flatland/flatland.cc
LayerObject * GetLayerObjectForTest (LayerHandle handle)
Defined at line 2702 of file ../../src/ui/scenic/lib/flatland/flatland.cc
void ReleaseTransformForTest (TransformHandle handle)
Defined at line 2710 of file ../../src/ui/scenic/lib/flatland/flatland.cc
void SetPriorityChildForTest (TransformId parent, TransformHandle child)
Defined at line 2714 of file ../../src/ui/scenic/lib/flatland/flatland.cc