mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-15 14:25:52 +00:00
Bug 1397627 - IPCBlobInputStream doesn't need to be seekable, r=smaug
This commit is contained in:
parent
e3a43a94a2
commit
ab022130c2
@ -69,7 +69,6 @@ NS_INTERFACE_MAP_BEGIN(IPCBlobInputStream)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIInputStreamCallback)
|
||||
NS_INTERFACE_MAP_ENTRY(nsICloneableInputStream)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIIPCSerializableInputStream)
|
||||
NS_INTERFACE_MAP_ENTRY_CONDITIONAL(nsISeekableStream, IsSeekableStream())
|
||||
NS_INTERFACE_MAP_ENTRY_CONDITIONAL(nsIFileMetadata, IsFileMetadata())
|
||||
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIInputStream)
|
||||
NS_INTERFACE_MAP_END
|
||||
@ -415,45 +414,5 @@ IPCBlobInputStream::GetFileDescriptor(PRFileDesc** aRetval)
|
||||
return fileMetadata->GetFileDescriptor(aRetval);
|
||||
}
|
||||
|
||||
// nsISeekableStream
|
||||
|
||||
bool
|
||||
IPCBlobInputStream::IsSeekableStream() const
|
||||
{
|
||||
// We are nsISeekableStream only if we have the remote stream and that is a
|
||||
// nsISeekableStream.
|
||||
nsCOMPtr<nsISeekableStream> seekableStream = do_QueryInterface(mRemoteStream);
|
||||
return !!seekableStream;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
IPCBlobInputStream::Seek(int32_t aWhence, int64_t aOffset)
|
||||
{
|
||||
nsCOMPtr<nsISeekableStream> seekableStream = do_QueryInterface(mRemoteStream);
|
||||
if (!seekableStream) {
|
||||
return mState == eClosed ? NS_BASE_STREAM_CLOSED : NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
return seekableStream->Seek(aWhence, aOffset);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
IPCBlobInputStream::Tell(int64_t *aResult)
|
||||
{
|
||||
nsCOMPtr<nsISeekableStream> seekableStream = do_QueryInterface(mRemoteStream);
|
||||
if (!seekableStream) {
|
||||
return mState == eClosed ? NS_BASE_STREAM_CLOSED : NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
return seekableStream->Tell(aResult);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
IPCBlobInputStream::SetEOF()
|
||||
{
|
||||
// This is a read-only stream.
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
|
@ -11,7 +11,6 @@
|
||||
#include "nsICloneableInputStream.h"
|
||||
#include "nsIFileStreams.h"
|
||||
#include "nsIIPCSerializableInputStream.h"
|
||||
#include "nsISeekableStream.h"
|
||||
#include "nsCOMPtr.h"
|
||||
|
||||
namespace mozilla {
|
||||
@ -23,7 +22,6 @@ class IPCBlobInputStream final : public nsIAsyncInputStream
|
||||
, public nsIInputStreamCallback
|
||||
, public nsICloneableInputStream
|
||||
, public nsIIPCSerializableInputStream
|
||||
, public nsISeekableStream
|
||||
, public nsIFileMetadata
|
||||
{
|
||||
public:
|
||||
@ -33,7 +31,6 @@ public:
|
||||
NS_DECL_NSIINPUTSTREAMCALLBACK
|
||||
NS_DECL_NSICLONEABLEINPUTSTREAM
|
||||
NS_DECL_NSIIPCSERIALIZABLEINPUTSTREAM
|
||||
NS_DECL_NSISEEKABLESTREAM
|
||||
NS_DECL_NSIFILEMETADATA
|
||||
|
||||
explicit IPCBlobInputStream(IPCBlobInputStreamChild* aActor);
|
||||
@ -48,9 +45,6 @@ private:
|
||||
MaybeExecuteCallback(nsIInputStreamCallback* aCallback,
|
||||
nsIEventTarget* aEventTarget);
|
||||
|
||||
bool
|
||||
IsSeekableStream() const;
|
||||
|
||||
bool
|
||||
IsFileMetadata() const;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user