Bug 1858225 - [9/9] remove async-to-sync code from Windows build r=win-reviewers,mhowell

This is no longer needed on Windows, so #ifdef it out.

Differential Revision: https://phabricator.services.mozilla.com/D193741
This commit is contained in:
Ray Kraesig 2023-11-30 19:59:18 +00:00
Родитель dd8e0cf059
Коммит 402c2dcacb
2 изменённых файлов: 10 добавлений и 0 удалений

Просмотреть файл

@ -63,9 +63,12 @@ nsresult LocalFileToDirectoryOrBlob(nsPIDOMWindowInner* aWindow,
} // anonymous namespace
#ifndef XP_WIN
/**
* A runnable to dispatch from the main thread to the main thread to display
* the file picker while letting the showAsync method return right away.
*
* Not needed on Windows, where nsFilePicker::Open() is fully async.
*/
class nsBaseFilePicker::AsyncShowFilePicker : public mozilla::Runnable {
public:
@ -98,6 +101,7 @@ class nsBaseFilePicker::AsyncShowFilePicker : public mozilla::Runnable {
RefPtr<nsBaseFilePicker> mFilePicker;
RefPtr<nsIFilePickerShownCallback> mCallback;
};
#endif
class nsBaseFilePickerEnumerator : public nsSimpleEnumerator {
public:
@ -190,12 +194,14 @@ nsBaseFilePicker::IsModeSupported(nsIFilePicker::Mode aMode, JSContext* aCx,
return NS_OK;
}
#ifndef XP_WIN
NS_IMETHODIMP
nsBaseFilePicker::Open(nsIFilePickerShownCallback* aCallback) {
nsCOMPtr<nsIRunnable> filePickerEvent =
new AsyncShowFilePicker(this, aCallback);
return NS_DispatchToMainThread(filePickerEvent);
}
#endif
NS_IMETHODIMP
nsBaseFilePicker::AppendFilters(int32_t aFilterMask) {

Просмотреть файл

@ -19,7 +19,9 @@ class nsPIDOMWindowOuter;
class nsIWidget;
class nsBaseFilePicker : public nsIFilePicker {
#ifndef XP_WIN
class AsyncShowFilePicker;
#endif
public:
nsBaseFilePicker();
@ -29,7 +31,9 @@ class nsBaseFilePicker : public nsIFilePicker {
nsIFilePicker::Mode aMode) override;
NS_IMETHOD IsModeSupported(nsIFilePicker::Mode aMode, JSContext* aCx,
mozilla::dom::Promise** aPromise) override;
#ifndef XP_WIN
NS_IMETHOD Open(nsIFilePickerShownCallback* aCallback) override;
#endif
NS_IMETHOD AppendFilters(int32_t filterMask) override;
NS_IMETHOD AppendRawFilter(const nsAString& aFilter) override;
NS_IMETHOD GetCapture(nsIFilePicker::CaptureTarget* aCapture) override;