mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1234192 - part 1 - FileSystemBase should not be thread-safe, r=smaug
This commit is contained in:
parent
cfed21018c
commit
db31b0db61
@ -20,7 +20,7 @@ class Directory;
|
||||
|
||||
class FileSystemBase
|
||||
{
|
||||
NS_INLINE_DECL_THREADSAFE_REFCOUNTING(FileSystemBase)
|
||||
NS_INLINE_DECL_REFCOUNTING(FileSystemBase)
|
||||
public:
|
||||
|
||||
// Create file system object from its string representation.
|
||||
|
@ -16,10 +16,33 @@
|
||||
#include "mozilla/dom/PContent.h"
|
||||
#include "mozilla/dom/ipc/BlobParent.h"
|
||||
#include "mozilla/unused.h"
|
||||
#include "nsProxyRelease.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
namespace {
|
||||
|
||||
class FileSystemReleaseRunnable : public nsRunnable
|
||||
{
|
||||
public:
|
||||
explicit FileSystemReleaseRunnable(RefPtr<FileSystemBase>& aDoomed)
|
||||
{
|
||||
aDoomed.swap(mDoomed);
|
||||
}
|
||||
|
||||
NS_IMETHOD Run()
|
||||
{
|
||||
mDoomed->Release();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
private:
|
||||
FileSystemBase* MOZ_OWNING_REF mDoomed;
|
||||
};
|
||||
|
||||
} // anonymous namespace
|
||||
|
||||
FileSystemTaskBase::FileSystemTaskBase(FileSystemBase* aFileSystem)
|
||||
: mErrorValue(NS_OK)
|
||||
, mFileSystem(aFileSystem)
|
||||
@ -43,6 +66,12 @@ FileSystemTaskBase::FileSystemTaskBase(FileSystemBase* aFileSystem,
|
||||
|
||||
FileSystemTaskBase::~FileSystemTaskBase()
|
||||
{
|
||||
if (!NS_IsMainThread()) {
|
||||
RefPtr<FileSystemReleaseRunnable> runnable =
|
||||
new FileSystemReleaseRunnable(mFileSystem);
|
||||
MOZ_ASSERT(!mFileSystem);
|
||||
NS_DispatchToMainThread(runnable);
|
||||
}
|
||||
}
|
||||
|
||||
FileSystemBase*
|
||||
|
Loading…
Reference in New Issue
Block a user