Backed out changeset 57e78c503c4e (bug 1294450) for build bustage a=backout

This commit is contained in:
Wes Kocher 2016-09-28 17:38:00 -07:00
Родитель a07d259ed7
Коммит 673a0db365
11 изменённых файлов: 3 добавлений и 164 удалений

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

@ -282,18 +282,6 @@ StreamWrapper::Deserialize(const InputStreamParams& aParams,
return false; return false;
} }
Maybe<uint64_t>
StreamWrapper::ExpectedSerializedLength()
{
nsCOMPtr<nsIIPCSerializableInputStream> stream =
do_QueryInterface(mInputStream);
if (stream) {
return stream->ExpectedSerializedLength();
}
return Nothing();
}
NS_IMPL_ISUPPORTS_INHERITED0(StreamWrapper::CloseRunnable, NS_IMPL_ISUPPORTS_INHERITED0(StreamWrapper::CloseRunnable,
Runnable) Runnable)

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

@ -1307,12 +1307,6 @@ RemoteInputStream::Deserialize(const InputStreamParams& /* aParams */,
MOZ_CRASH("RemoteInputStream should never be deserialized"); MOZ_CRASH("RemoteInputStream should never be deserialized");
} }
Maybe<uint64_t>
RemoteInputStream::ExpectedSerializedLength()
{
return Nothing();
}
nsIInputStream* nsIInputStream*
RemoteInputStream::BlockAndGetInternalStream() RemoteInputStream::BlockAndGetInternalStream()
{ {

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

@ -20,9 +20,6 @@
#include "mozilla/ipc/SendStream.h" #include "mozilla/ipc/SendStream.h"
#include "mozilla/Unused.h" #include "mozilla/Unused.h"
#include "nsIAsyncInputStream.h" #include "nsIAsyncInputStream.h"
#include "nsIAsyncOutputStream.h"
#include "nsIPipe.h"
#include "nsStreamUtils.h"
namespace mozilla { namespace mozilla {
namespace ipc { namespace ipc {
@ -125,41 +122,17 @@ SerializeInputStream(nsIInputStream* aStream, IPCStream& aValue, M* aManager)
MOZ_ASSERT(aStream); MOZ_ASSERT(aStream);
MOZ_ASSERT(aManager); MOZ_ASSERT(aManager);
// If a stream is known to be larger than 1MB, prefer sending it in chunks.
const uint64_t kTooLargeStream = 1024 * 1024;
// First attempt simple stream serialization // First attempt simple stream serialization
nsCOMPtr<nsIIPCSerializableInputStream> serializable = nsCOMPtr<nsIIPCSerializableInputStream> serializable =
do_QueryInterface(aStream); do_QueryInterface(aStream);
uint64_t expectedLength = if (serializable) {
serializable ? serializable->ExpectedSerializedLength().valueOr(0) : 0;
if (serializable && expectedLength < kTooLargeStream) {
SerializeInputStreamWithFdsChild(aStream, aValue, aManager); SerializeInputStreamWithFdsChild(aStream, aValue, aManager);
return; return;
} }
// As a fallback, attempt to stream the data across using a SendStream // As a fallback, attempt to stream the data across using a SendStream
// actor. For blocking streams, create a nonblocking pipe instead, // actor. This will fail for blocking streams.
nsCOMPtr<nsIAsyncInputStream> asyncStream = do_QueryInterface(aStream); nsCOMPtr<nsIAsyncInputStream> asyncStream = do_QueryInterface(aStream);
if (!asyncStream) {
const uint32_t kBufferSize = 32768; // matches SendStream buffer size.
nsCOMPtr<nsIAsyncOutputStream> sink;
nsresult rv = NS_NewPipe2(getter_AddRefs(asyncStream),
getter_AddRefs(sink),
true,
false,
kBufferSize,
UINT32_MAX);
MOZ_ASSERT(NS_SUCCEEDED(rv));
nsCOMPtr<nsIEventTarget> target =
do_GetService(NS_STREAMTRANSPORTSERVICE_CONTRACTID);
rv = NS_AsyncCopy(aStream, sink, target, NS_ASYNCCOPY_VIA_READSEGMENTS, kBufferSize);
MOZ_ASSERT(NS_SUCCEEDED(rv));
}
MOZ_ASSERT(asyncStream);
aValue = SendStreamChild::Create(asyncStream, aManager); aValue = SendStreamChild::Create(asyncStream, aManager);
if (!aValue.get_PSendStreamChild()) { if (!aValue.get_PSendStreamChild()) {

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

@ -8,7 +8,6 @@
#define mozilla_ipc_nsIIPCSerializableInputStream_h #define mozilla_ipc_nsIIPCSerializableInputStream_h
#include "mozilla/Attributes.h" #include "mozilla/Attributes.h"
#include "mozilla/Maybe.h"
#include "nsISupports.h" #include "nsISupports.h"
#include "nsTArrayForwardDeclare.h" #include "nsTArrayForwardDeclare.h"
@ -39,17 +38,6 @@ public:
virtual bool virtual bool
Deserialize(const mozilla::ipc::InputStreamParams& aParams, Deserialize(const mozilla::ipc::InputStreamParams& aParams,
const FileDescriptorArray& aFileDescriptors) = 0; const FileDescriptorArray& aFileDescriptors) = 0;
// The number of bytes that are expected to be written when this
// stream is serialized. A value of Some(N) indicates that N bytes
// will be written to the IPC buffer, and will be used to decide
// upon an optimal transmission mechanism. A value of Nothing
// indicates that either serializing this stream will not require
// serializing its contents (eg. a file-backed stream, or a stream
// backed by an IPC actor), or the length of the stream's contents
// cannot be determined.
virtual mozilla::Maybe<uint64_t>
ExpectedSerializedLength() = 0;
}; };
NS_DEFINE_STATIC_IID_ACCESSOR(nsIIPCSerializableInputStream, NS_DEFINE_STATIC_IID_ACCESSOR(nsIIPCSerializableInputStream,
@ -62,10 +50,7 @@ NS_DEFINE_STATIC_IID_ACCESSOR(nsIIPCSerializableInputStream,
\ \
virtual bool \ virtual bool \
Deserialize(const mozilla::ipc::InputStreamParams&, \ Deserialize(const mozilla::ipc::InputStreamParams&, \
const FileDescriptorArray&) override; \ const FileDescriptorArray&) override;
\
virtual mozilla::Maybe<uint64_t> \
ExpectedSerializedLength() override;
#define NS_FORWARD_NSIIPCSERIALIZABLEINPUTSTREAM(_to) \ #define NS_FORWARD_NSIIPCSERIALIZABLEINPUTSTREAM(_to) \
virtual void \ virtual void \
@ -80,12 +65,6 @@ NS_DEFINE_STATIC_IID_ACCESSOR(nsIIPCSerializableInputStream,
const FileDescriptorArray& aFileDescriptors) override \ const FileDescriptorArray& aFileDescriptors) override \
{ \ { \
return _to Deserialize(aParams, aFileDescriptors); \ return _to Deserialize(aParams, aFileDescriptors); \
} \
\
virtual mozilla::Maybe<uint64_t> \
ExpectedSerializedLength() override \
{ \
return _to ExpectedSerializedLength(); \
} }
#define NS_FORWARD_SAFE_NSIIPCSERIALIZABLEINPUTSTREAM(_to) \ #define NS_FORWARD_SAFE_NSIIPCSERIALIZABLEINPUTSTREAM(_to) \
@ -103,12 +82,6 @@ NS_DEFINE_STATIC_IID_ACCESSOR(nsIIPCSerializableInputStream,
const FileDescriptorArray& aFileDescriptors) override \ const FileDescriptorArray& aFileDescriptors) override \
{ \ { \
return _to ? _to->Deserialize(aParams, aFileDescriptors) : false; \ return _to ? _to->Deserialize(aParams, aFileDescriptors) : false; \
} \
\
virtual mozilla::Maybe<uint64_t> \
ExpectedSerializedLength() override \
{ \
return _to ? _to->ExpectedSerializedLength() : Nothing(); \
} }
#endif // mozilla_ipc_nsIIPCSerializableInputStream_h #endif // mozilla_ipc_nsIIPCSerializableInputStream_h

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

@ -38,9 +38,6 @@ static struct {
#endif #endif
using namespace mozilla::ipc; using namespace mozilla::ipc;
using mozilla::Maybe;
using mozilla::Nothing;
using mozilla::Some;
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
// nsBufferedStream // nsBufferedStream
@ -544,16 +541,6 @@ nsBufferedInputStream::Deserialize(const InputStreamParams& aParams,
return true; return true;
} }
Maybe<uint64_t>
nsBufferedInputStream::ExpectedSerializedLength()
{
nsCOMPtr<nsIIPCSerializableInputStream> stream = do_QueryInterface(mStream);
if (stream) {
return stream->ExpectedSerializedLength();
}
return Nothing();
}
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
// nsBufferedOutputStream // nsBufferedOutputStream

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

@ -32,9 +32,6 @@ typedef mozilla::ipc::FileDescriptor::PlatformHandleType FileHandleType;
using namespace mozilla::ipc; using namespace mozilla::ipc;
using mozilla::DebugOnly; using mozilla::DebugOnly;
using mozilla::Maybe;
using mozilla::Nothing;
using mozilla::Some;
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
// nsFileStreamBase // nsFileStreamBase
@ -665,12 +662,6 @@ nsFileInputStream::Deserialize(const InputStreamParams& aParams,
return true; return true;
} }
Maybe<uint64_t>
nsFileInputStream::ExpectedSerializedLength()
{
return Nothing();
}
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
// nsPartialFileInputStream // nsPartialFileInputStream
@ -869,13 +860,6 @@ nsPartialFileInputStream::Deserialize(
return NS_SUCCEEDED(nsFileInputStream::Seek(NS_SEEK_SET, mStart)); return NS_SUCCEEDED(nsFileInputStream::Seek(NS_SEEK_SET, mStart));
} }
Maybe<uint64_t>
nsPartialFileInputStream::ExpectedSerializedLength()
{
return Some(mLength);
}
nsresult nsresult
nsPartialFileInputStream::DoPendingSeek() nsPartialFileInputStream::DoPendingSeek()
{ {

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

@ -23,7 +23,6 @@
#include "mozilla/ipc/InputStreamUtils.h" #include "mozilla/ipc/InputStreamUtils.h"
using namespace mozilla::ipc; using namespace mozilla::ipc;
using mozilla::Maybe;
class nsMIMEInputStream : public nsIMIMEInputStream, class nsMIMEInputStream : public nsIMIMEInputStream,
public nsISeekableStream, public nsISeekableStream,
@ -380,11 +379,3 @@ nsMIMEInputStream::Deserialize(const InputStreamParams& aParams,
return true; return true;
} }
Maybe<uint64_t>
nsMIMEInputStream::ExpectedSerializedLength()
{
nsCOMPtr<nsIIPCSerializableInputStream> serializable = do_QueryInterface(mStream);
return serializable ? serializable->ExpectedSerializedLength() : Nothing();
}

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

@ -239,9 +239,3 @@ nsTemporaryFileInputStream::Deserialize(const InputStreamParams& aParams,
mEndPos = params.endPos(); mEndPos = params.endPos();
return true; return true;
} }
Maybe<uint64_t>
nsTemporaryFileInputStream::ExpectedSerializedLength()
{
return Nothing();
}

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

@ -29,9 +29,6 @@ using namespace mozilla;
using namespace mozilla::ipc; using namespace mozilla::ipc;
using mozilla::DeprecatedAbs; using mozilla::DeprecatedAbs;
using mozilla::Maybe;
using mozilla::Nothing;
using mozilla::Some;
class nsMultiplexInputStream final class nsMultiplexInputStream final
: public nsIMultiplexInputStream : public nsIMultiplexInputStream
@ -750,29 +747,6 @@ nsMultiplexInputStream::Deserialize(const InputStreamParams& aParams,
return true; return true;
} }
Maybe<uint64_t>
nsMultiplexInputStream::ExpectedSerializedLength()
{
MutexAutoLock lock(mLock);
bool lengthValueExists = false;
uint64_t expectedLength = 0;
uint32_t streamCount = mStreams.Length();
for (uint32_t index = 0; index < streamCount; index++) {
nsCOMPtr<nsIIPCSerializableInputStream> stream = do_QueryInterface(mStreams[index]);
if (!stream) {
continue;
}
Maybe<uint64_t> length = stream->ExpectedSerializedLength();
if (length.isNothing()) {
continue;
}
lengthValueExists = true;
expectedLength += length.value();
}
return lengthValueExists ? Some(expectedLength) : Nothing();
}
NS_IMETHODIMP NS_IMETHODIMP
nsMultiplexInputStream::GetCloneable(bool* aCloneable) nsMultiplexInputStream::GetCloneable(bool* aCloneable)
{ {

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

@ -29,8 +29,6 @@
using mozilla::ipc::InputStreamParams; using mozilla::ipc::InputStreamParams;
using mozilla::ipc::StringInputStreamParams; using mozilla::ipc::StringInputStreamParams;
using mozilla::Maybe;
using mozilla::Some;
// //
// Log module for StorageStream logging... // Log module for StorageStream logging...
@ -600,15 +598,6 @@ nsStorageInputStream::Serialize(InputStreamParams& aParams, FileDescriptorArray&
aParams = params; aParams = params;
} }
Maybe<uint64_t>
nsStorageInputStream::ExpectedSerializedLength()
{
uint64_t remaining = 0;
DebugOnly<nsresult> rv = Available(&remaining);
MOZ_ASSERT(NS_SUCCEEDED(rv));
return Some(remaining);
}
bool bool
nsStorageInputStream::Deserialize(const InputStreamParams& aParams, nsStorageInputStream::Deserialize(const InputStreamParams& aParams,
const FileDescriptorArray&) const FileDescriptorArray&)

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

@ -25,8 +25,6 @@
#include "nsIIPCSerializableInputStream.h" #include "nsIIPCSerializableInputStream.h"
using namespace mozilla::ipc; using namespace mozilla::ipc;
using mozilla::Maybe;
using mozilla::Some;
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// nsIStringInputStream implementation // nsIStringInputStream implementation
@ -356,12 +354,6 @@ nsStringInputStream::Deserialize(const InputStreamParams& aParams,
return true; return true;
} }
Maybe<uint64_t>
nsStringInputStream::ExpectedSerializedLength()
{
return Some(static_cast<uint64_t>(Length()));
}
///////// /////////
// nsICloneableInputStream implementation // nsICloneableInputStream implementation
///////// /////////