// Copyright 2017 The Chromium Authors // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef UI_COMPOSITOR_COMPOSITOR_LOCK_H_ #define UI_COMPOSITOR_COMPOSITOR_LOCK_H_ #include <vector> #include "base/functional/callback_forward.h" #include "base/memory/raw_ptr.h" #include "base/memory/weak_ptr.h" #include "base/task/single_thread_task_runner.h" #include "base/time/time.h" #include "ui/compositor/compositor_export.h" namespace ui { class Compositor; class CompositorLock; // Implemented by clients which take compositor lock. Used to notify the client // when their lock times out. class CompositorLockClient { … }; // A helper class used to manage compositor locks. Should be created/used by // classes which want to provide out compositor locking. class COMPOSITOR_EXPORT CompositorLockManager { … }; // This class represents a lock on the compositor, that can be used to prevent // commits to the compositor tree while we're waiting for an asynchronous // event. The typical use case is when waiting for a renderer to produce a frame // at the right size. The caller keeps a reference on this object, and drops the // reference once it desires to release the lock. // By default, the lock will be cancelled after a short timeout to ensure // responsiveness of the UI, so the compositor tree should be kept in a // "reasonable" state while the lock is held. The timeout length, or no timeout, // can be requested at the time the lock is created. // Don't instantiate this class directly, use Compositor::GetCompositorLock. class COMPOSITOR_EXPORT CompositorLock { … }; } // namespace ui #endif // UI_COMPOSITOR_COMPOSITOR_LOCK_H_