// Copyright 2022 The Chromium Authors // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef CHROME_BROWSER_WEB_APPLICATIONS_LOCKS_NOOP_LOCK_H_ #define CHROME_BROWSER_WEB_APPLICATIONS_LOCKS_NOOP_LOCK_H_ #include <memory> #include "base/memory/weak_ptr.h" #include "chrome/browser/web_applications/locks/lock.h" namespace web_app { struct PartitionedLockHolder; class WebAppLockManager; // This lock essentially doesn't lock anything in the system. However, if a // `AllAppsLock` is used, then that will block the acquisition of this lock. // // Locks can be acquired by using the `WebAppLockManager`. class NoopLockDescription : public LockDescription { … }; // Holding a NoopLock is required when a locked operation needs to be executed, // but there is no explicit resource to be locked yet. If a resource shows up in // the middle of the command, an upgrade from a NoopLock to an AppLock or // SharedWebContentsWithAppLock may occur. // // See `WebAppLockManager` for how to use locks. Destruction of this class will // release the lock or cancel the lock request if it is not acquired yet. class NoopLock : public Lock { … }; } // namespace web_app #endif // CHROME_BROWSER_WEB_APPLICATIONS_LOCKS_NOOP_LOCK_H_