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

This commit is contained in:
Ben Kelly 2015-09-14 12:12:00 -07:00
parent dd919e9cdf
commit e9a2668b96
2 changed files with 17 additions and 0 deletions

View File

@ -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)

View File

@ -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