Bug 1234192 - part 2 - Directory should unlink/traverse the OSFileSystem in order to unlink/traverse the window, r=smaug

This commit is contained in:
Andrea Marchesini 2015-12-29 20:42:31 +00:00
Родитель 2a897eff4e
Коммит f49a61e596
4 изменённых файлов: 37 добавлений и 2 удалений

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

@ -34,7 +34,20 @@
namespace mozilla {
namespace dom {
NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE_0(Directory)
NS_IMPL_CYCLE_COLLECTION_CLASS(Directory)
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(Directory)
tmp->mFileSystem->Unlink();
NS_IMPL_CYCLE_COLLECTION_UNLINK_PRESERVED_WRAPPER
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(Directory)
tmp->mFileSystem->Traverse(cb);
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_SCRIPT_OBJECTS
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
NS_IMPL_CYCLE_COLLECTION_TRACE_WRAPPERCACHE(Directory)
NS_IMPL_CYCLE_COLLECTING_ADDREF(Directory)
NS_IMPL_CYCLE_COLLECTING_RELEASE(Directory)
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(Directory)

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

@ -95,6 +95,11 @@ public:
{
return mRequiresPermissionChecks;
}
// CC methods
virtual void Unlink() {}
virtual void Traverse(nsCycleCollectionTraversalCallback &cb) {}
protected:
virtual ~FileSystemBase();

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

@ -76,5 +76,18 @@ OSFileSystem::IsSafeDirectory(Directory* aDir) const
return true;
}
void
OSFileSystem::Unlink()
{
mWindow = nullptr;
}
void
OSFileSystem::Traverse(nsCycleCollectionTraversalCallback &cb)
{
OSFileSystem* tmp = this;
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mWindow);
}
} // namespace dom
} // namespace mozilla

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

@ -12,7 +12,7 @@
namespace mozilla {
namespace dom {
class OSFileSystem : public FileSystemBase
class OSFileSystem final : public FileSystemBase
{
public:
explicit OSFileSystem(const nsAString& aRootDir);
@ -34,6 +34,10 @@ public:
virtual bool
IsSafeDirectory(Directory* aDir) const override;
// CC methods
virtual void Unlink() override;
virtual void Traverse(nsCycleCollectionTraversalCallback &cb) override;
private:
virtual ~OSFileSystem() {}