Bug 1203680 P2 Implement an NS_InputStreamIsCloneable() method. r=froydnj

This commit is contained in:
Ben Kelly 2015-09-15 10:15:45 -07:00
Родитель bc6fd423a1
Коммит 02126738d3
2 изменённых файлов: 17 добавлений и 0 удалений

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

@ -857,6 +857,17 @@ NS_FillArray(FallibleTArray<char>& aDest, nsIInputStream* aInput,
return rv;
}
bool
NS_InputStreamIsCloneable(nsIInputStream* aSource)
{
if (!aSource) {
return false;
}
nsCOMPtr<nsICloneableInputStream> cloneable = do_QueryInterface(aSource);
return cloneable && cloneable->GetCloneable();
}
nsresult
NS_CloneInputStream(nsIInputStream* aSource, nsIInputStream** aCloneOut,
nsIInputStream** aReplacementOut)

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

@ -264,6 +264,12 @@ extern NS_METHOD
NS_FillArray(FallibleTArray<char>& aDest, nsIInputStream* aInput,
uint32_t aKeep, uint32_t* aNewBytes);
/**
* Return true if the given stream can be directly cloned.
*/
extern bool
NS_InputStreamIsCloneable(nsIInputStream* aSource);
/**
* Clone the provided source stream in the most efficient way possible. This
* first attempts to QI to nsICloneableInputStream to use Clone(). If that is