Flutter Engine
The Flutter Engine
|
#include <pointer_data_dispatcher.h>
Classes | |
class | Delegate |
The interface for Engine to implement. More... | |
Public Member Functions | |
virtual void | DispatchPacket (std::unique_ptr< PointerDataPacket > packet, uint64_t trace_flow_id)=0 |
Signal that PlatformView has a packet to be dispatched. More... | |
virtual | ~PointerDataDispatcher () |
Default destructor. More... | |
The Engine
pointer data dispatcher that forwards the packet received from PlatformView::DispatchPointerDataPacket
on the platform thread, to Window::DispatchPointerDataPacket
on the UI thread.
This class is used to filter the packets so the Flutter framework on the UI thread will receive packets with some desired properties. See SmoothPointerDataDispatcher
for an example which filters irregularly delivered packets, and dispatches them in sync with the VSYNC signal.
This object will be owned by the engine because it relies on the engine's Animator
(which owns VsyncWaiter
) and RuntimeController
to do the filtering. This object is currently designed to be only called from the UI thread (no thread safety is guaranteed).
The PlatformView
decides which subclass of PointerDataDispatcher
is constructed by sending a PointerDataDispatcherMaker
to the engine's constructor in Shell::CreateShellOnPlatformThread
. This is needed because: (1) Different platforms (e.g., Android, iOS) have different dispatchers so the decision has to be made per PlatformView
. (2) The PlatformView
can only be accessed from the PlatformThread while this class (as owned by engine) can only be accessed in the UI thread. Hence PlatformView
creates a PointerDataDispatchMaker
on the platform thread, and sends it to the UI thread for the final construction of the PointerDataDispatcher
.
Definition at line 40 of file pointer_data_dispatcher.h.
|
virtualdefault |
Default destructor.
|
pure virtual |
Signal that PlatformView
has a packet to be dispatched.
[in] | packet | The PointerDataPacket to be dispatched. |
[in] | trace_flow_id | The id for Animator::EnqueueTraceFlowId . |
Implemented in flutter::DefaultPointerDataDispatcher, and flutter::SmoothPointerDataDispatcher.