// Copyright 2019 The Chromium Authors // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef CC_TREES_PRESENTATION_TIME_CALLBACK_BUFFER_H_ #define CC_TREES_PRESENTATION_TIME_CALLBACK_BUFFER_H_ #include <vector> #include "base/containers/circular_deque.h" #include "base/functional/callback_forward.h" #include "base/sequence_checker.h" #include "base/time/time.h" #include "cc/cc_export.h" #include "components/viz/common/frame_timing_details.h" #include "ui/gfx/presentation_feedback.h" namespace cc { // Maintains a queue of callbacks and compositor frame times that we want to // buffer until a relevant frame is presented. // // Callbacks are queued through `RegisterMainThreadCallbacks()` or // `RegisterMainThreadSuccessfulCallbacks()` if the they are to be run on the // main thread and `RegisterCompositorThreadSuccessfulCallbacks()` if they are // to be run on the compositor thread. // // Once a frame is presented, users of this class can call // `PopPendingCallbacks()` to get their callbacks back. This class never runs // callbacks itself so it's up to calling code to `PostTask()` or call `Run()` // as needed. // // This class is thread unsafe so concurrent access would require external // synchronization. In practice, however, instances of this class are only used // on the compositor thread even though some of the buffered callbacks are // intended to be run on the renderer main thread. // // CC_EXPORT is only needed for testing. class CC_EXPORT PresentationTimeCallbackBuffer { … }; } // namespace cc #endif // CC_TREES_PRESENTATION_TIME_CALLBACK_BUFFER_H_