diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-15 03:34:42 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-15 03:34:42 +0000 |
commit | da4c7e7ed675c3bf405668739c3012d140856109 (patch) | |
tree | cdd868dba063fecba609a1d819de271f0d51b23e /dom/fs/child | |
parent | Adding upstream version 125.0.3. (diff) | |
download | firefox-da4c7e7ed675c3bf405668739c3012d140856109.tar.xz firefox-da4c7e7ed675c3bf405668739c3012d140856109.zip |
Adding upstream version 126.0.upstream/126.0
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'dom/fs/child')
-rw-r--r-- | dom/fs/child/FileSystemShutdownBlocker.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/dom/fs/child/FileSystemShutdownBlocker.cpp b/dom/fs/child/FileSystemShutdownBlocker.cpp index bddbf18c6b..e6301e52ea 100644 --- a/dom/fs/child/FileSystemShutdownBlocker.cpp +++ b/dom/fs/child/FileSystemShutdownBlocker.cpp @@ -36,6 +36,8 @@ class FileSystemWritableBlocker : public FileSystemShutdownBlocker { public: FileSystemWritableBlocker() : mName(CreateBlockerName()) {} + void SetCallback(std::function<void()>&& aCallback) override; + NS_DECL_ISUPPORTS_INHERITED NS_DECL_NSIASYNCSHUTDOWNBLOCKER @@ -50,8 +52,13 @@ class FileSystemWritableBlocker : public FileSystemShutdownBlocker { private: const nsString mName; + std::function<void()> mCallback; }; +void FileSystemWritableBlocker::SetCallback(std::function<void()>&& aCallback) { + mCallback = std::move(aCallback); +} + NS_IMPL_ISUPPORTS_INHERITED(FileSystemWritableBlocker, FileSystemShutdownBlocker, nsIAsyncShutdownBlocker) @@ -112,11 +119,18 @@ FileSystemWritableBlocker::BlockShutdown( nsIAsyncShutdownClient* /* aBarrier */) { MOZ_ASSERT(NS_IsMainThread()); + if (mCallback) { + auto callback = std::move(mCallback); + callback(); + } + return NS_OK; } class FileSystemNullBlocker : public FileSystemShutdownBlocker { public: + void SetCallback(std::function<void()>&& aCallback) override {} + NS_IMETHODIMP Block() override { return NS_OK; } NS_IMETHODIMP Unblock() override { return NS_OK; } |