Bug 1164310, part 3 - Allow the DirState of blobs to be set explicitly. r=baku

This commit is contained in:
Jonathan Watt 2015-07-10 18:55:23 +01:00
parent 2b93230bda
commit 512fc2123f
2 changed files with 21 additions and 1 deletions

View File

@ -387,6 +387,7 @@ public:
* calling IsDirectory will MOZ_ASSERT.
*/
virtual void LookupAndCacheIsDirectory() = 0;
virtual void SetIsDirectory(bool aIsDir) = 0;
virtual bool IsDirectory() const = 0;
/**
@ -565,6 +566,14 @@ public:
MOZ_ASSERT(false, "Why is this being called on a non-BlobImplFile?");
}
virtual void SetIsDirectory(bool aIsDir) override
{
MOZ_ASSERT(mIsFile,
"This should only be called when this object has been created "
"from an nsIFile to note that the nsIFile is a directory");
mDirState = aIsDir ? BlobDirState::eIsDir : BlobDirState::eIsNotDir;
}
/**
* Returns true if the nsIFile that this object wraps is a directory.
*/
@ -572,7 +581,8 @@ public:
{
MOZ_ASSERT(mDirState != BlobDirState::eUnknownIfDir,
"Must only be used by callers for whom the code paths are "
"know to call LookupAndCacheIsDirectory()");
"know to call LookupAndCacheIsDirectory() or "
"SetIsDirectory()");
return mDirState == BlobDirState::eIsDir;
}

View File

@ -2154,6 +2154,9 @@ public:
virtual void
LookupAndCacheIsDirectory() override;
virtual void
SetIsDirectory(bool aIsDir) override;
virtual bool
IsDirectory() const override;
@ -2944,6 +2947,13 @@ RemoteBlobImpl::LookupAndCacheIsDirectory()
return mBlobImpl->LookupAndCacheIsDirectory();
}
void
BlobParent::
RemoteBlobImpl::SetIsDirectory(bool aIsDir)
{
return mBlobImpl->SetIsDirectory(aIsDir);
}
bool
BlobParent::
RemoteBlobImpl::IsDirectory() const