5#include "flutter/shell/common/pointer_data_dispatcher.h"
7#include "flutter/fml/trace_event.h"
19 std::unique_ptr<PointerDataPacket> packet,
20 uint64_t trace_flow_id) {
22 "DefaultPointerDataDispatcher::DispatchPacket",
29 std::unique_ptr<PointerDataPacket> packet,
30 uint64_t trace_flow_id) {
32 "SmoothPointerDataDispatcher::DispatchPacket",
36 if (is_pointer_data_in_progress_) {
37 if (pending_packet_ !=
nullptr) {
38 DispatchPendingPacket();
40 pending_packet_ = std::move(packet);
41 pending_trace_flow_id_ = trace_flow_id;
47 is_pointer_data_in_progress_ =
true;
48 ScheduleSecondaryVsyncCallback();
51void SmoothPointerDataDispatcher::ScheduleSecondaryVsyncCallback() {
53 reinterpret_cast<uintptr_t
>(
this),
54 [dispatcher = weak_factory_.GetWeakPtr()]() {
55 if (dispatcher && dispatcher->is_pointer_data_in_progress_) {
56 if (dispatcher->pending_packet_ != nullptr) {
57 dispatcher->DispatchPendingPacket();
59 dispatcher->is_pointer_data_in_progress_ = false;
65void SmoothPointerDataDispatcher::DispatchPendingPacket() {
68 DefaultPointerDataDispatcher::DispatchPacket(std::move(pending_packet_),
69 pending_trace_flow_id_);
70 pending_packet_ =
nullptr;
71 pending_trace_flow_id_ = -1;
72 ScheduleSecondaryVsyncCallback();
void DispatchPacket(std::unique_ptr< PointerDataPacket > packet, uint64_t trace_flow_id) override
Signal that PlatformView has a packet to be dispatched.
virtual ~DefaultPointerDataDispatcher()
The interface for Engine to implement.
virtual void DoDispatchPacket(std::unique_ptr< PointerDataPacket > packet, uint64_t trace_flow_id)=0
virtual void ScheduleSecondaryVsyncCallback(uintptr_t id, const fml::closure &callback)=0
Schedule a secondary callback to be executed right after the main VsyncWaiter::AsyncWaitForVsync call...
virtual ~PointerDataDispatcher()
Default destructor.
virtual ~SmoothPointerDataDispatcher()
SmoothPointerDataDispatcher(Delegate &delegate)
void DispatchPacket(std::unique_ptr< PointerDataPacket > packet, uint64_t trace_flow_id) override
Signal that PlatformView has a packet to be dispatched.
#define FML_DCHECK(condition)
#define TRACE_FLOW_STEP(category, name, id)
#define TRACE_EVENT0_WITH_FLOW_IDS(category_group, name, flow_id_count, flow_ids)