mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-24 05:11:16 +00:00
Backed out changeset 8405467ea7ad (bug 1211266) for static analysis bustage. r=backout on a CLOSED TREE
This commit is contained in:
parent
c9ba9a819b
commit
9be17fad9a
@ -558,15 +558,14 @@ EnsureBlobForBackgroundManager(BlobImpl* aBlobImpl,
|
||||
PBackgroundChild* aManager = nullptr)
|
||||
{
|
||||
MOZ_ASSERT(aBlobImpl);
|
||||
RefPtr<BlobImpl> blobImpl = aBlobImpl;
|
||||
|
||||
if (!aManager) {
|
||||
aManager = BackgroundChild::GetForCurrentThread();
|
||||
if (!aManager) {
|
||||
return blobImpl.forget();
|
||||
}
|
||||
MOZ_ASSERT(aManager);
|
||||
}
|
||||
|
||||
RefPtr<BlobImpl> blobImpl = aBlobImpl;
|
||||
|
||||
const nsTArray<RefPtr<BlobImpl>>* subBlobImpls =
|
||||
aBlobImpl->GetSubBlobImpls();
|
||||
|
||||
@ -671,8 +670,6 @@ WriteBlob(JSStructuredCloneWriter* aWriter,
|
||||
RefPtr<BlobImpl> blobImpl = EnsureBlobForBackgroundManager(aBlob->Impl());
|
||||
MOZ_ASSERT(blobImpl);
|
||||
|
||||
MOZ_ALWAYS_TRUE(NS_SUCCEEDED(blobImpl->SetMutable(false)));
|
||||
|
||||
// We store the position of the blobImpl in the array as index.
|
||||
if (JS_WriteUint32Pair(aWriter, SCTAG_DOM_BLOB,
|
||||
aHolder->BlobImpls().Length())) {
|
||||
|
127
dom/ipc/Blob.cpp
127
dom/ipc/Blob.cpp
@ -1753,12 +1753,6 @@ protected:
|
||||
BlobChild* mActor;
|
||||
nsCOMPtr<nsIEventTarget> mActorTarget;
|
||||
|
||||
// We use this pointer to keep a live a blobImpl coming from a different
|
||||
// process until this one is fully created. We set it to null when
|
||||
// SendCreatedFromKnownBlob() is received. This is used only with KnownBlob
|
||||
// params in the CTOR of a IPC BlobImpl.
|
||||
RefPtr<BlobImpl> mDifferentProcessBlobImpl;
|
||||
|
||||
RefPtr<BlobImpl> mSameProcessBlobImpl;
|
||||
|
||||
const bool mIsSlice;
|
||||
@ -1766,20 +1760,31 @@ protected:
|
||||
public:
|
||||
// For File.
|
||||
RemoteBlobImpl(BlobChild* aActor,
|
||||
BlobImpl* aRemoteBlobImpl,
|
||||
const nsAString& aName,
|
||||
const nsAString& aContentType,
|
||||
uint64_t aLength,
|
||||
int64_t aModDate,
|
||||
BlobDirState aDirState,
|
||||
bool aIsSameProcessBlob);
|
||||
BlobDirState aDirState);
|
||||
|
||||
// For Blob.
|
||||
RemoteBlobImpl(BlobChild* aActor,
|
||||
BlobImpl* aRemoteBlobImpl,
|
||||
const nsAString& aContentType,
|
||||
uint64_t aLength);
|
||||
|
||||
// For same-process blobs.
|
||||
RemoteBlobImpl(BlobChild* aActor,
|
||||
BlobImpl* aSameProcessBlobImpl,
|
||||
const nsAString& aName,
|
||||
const nsAString& aContentType,
|
||||
uint64_t aLength,
|
||||
bool aIsSameProcessBlob);
|
||||
int64_t aModDate,
|
||||
BlobDirState aDirState);
|
||||
|
||||
// For same-process blobs.
|
||||
RemoteBlobImpl(BlobChild* aActor,
|
||||
BlobImpl* aSameProcessBlobImpl,
|
||||
const nsAString& aContentType,
|
||||
uint64_t aLength);
|
||||
|
||||
// For mystery blobs.
|
||||
explicit
|
||||
@ -1852,13 +1857,6 @@ public:
|
||||
virtual BlobParent*
|
||||
GetBlobParent() override;
|
||||
|
||||
void
|
||||
NullifyDifferentProcessBlobImpl()
|
||||
{
|
||||
MOZ_ASSERT(mDifferentProcessBlobImpl);
|
||||
mDifferentProcessBlobImpl = nullptr;
|
||||
}
|
||||
|
||||
protected:
|
||||
// For SliceImpl.
|
||||
RemoteBlobImpl(const nsAString& aContentType, uint64_t aLength);
|
||||
@ -2088,43 +2086,56 @@ private:
|
||||
|
||||
BlobChild::
|
||||
RemoteBlobImpl::RemoteBlobImpl(BlobChild* aActor,
|
||||
BlobImpl* aRemoteBlobImpl,
|
||||
const nsAString& aName,
|
||||
const nsAString& aContentType,
|
||||
uint64_t aLength,
|
||||
int64_t aModDate,
|
||||
BlobDirState aDirState,
|
||||
bool aIsSameProcessBlob)
|
||||
BlobDirState aDirState)
|
||||
: BlobImplBase(aName, aContentType, aLength, aModDate, aDirState)
|
||||
, mIsSlice(false)
|
||||
{
|
||||
if (aIsSameProcessBlob) {
|
||||
MOZ_ASSERT(aRemoteBlobImpl);
|
||||
mSameProcessBlobImpl = aRemoteBlobImpl;
|
||||
MOZ_ASSERT(gProcessType == GeckoProcessType_Default);
|
||||
} else {
|
||||
mDifferentProcessBlobImpl = aRemoteBlobImpl;
|
||||
}
|
||||
CommonInit(aActor);
|
||||
}
|
||||
|
||||
BlobChild::
|
||||
RemoteBlobImpl::RemoteBlobImpl(BlobChild* aActor,
|
||||
const nsAString& aContentType,
|
||||
uint64_t aLength)
|
||||
: BlobImplBase(aContentType, aLength)
|
||||
, mIsSlice(false)
|
||||
{
|
||||
CommonInit(aActor);
|
||||
}
|
||||
|
||||
BlobChild::
|
||||
RemoteBlobImpl::RemoteBlobImpl(BlobChild* aActor,
|
||||
BlobImpl* aSameProcessBlobImpl,
|
||||
const nsAString& aName,
|
||||
const nsAString& aContentType,
|
||||
uint64_t aLength,
|
||||
int64_t aModDate,
|
||||
BlobDirState aDirState)
|
||||
: BlobImplBase(aName, aContentType, aLength, aModDate, aDirState)
|
||||
, mSameProcessBlobImpl(aSameProcessBlobImpl)
|
||||
, mIsSlice(false)
|
||||
{
|
||||
MOZ_ASSERT(aSameProcessBlobImpl);
|
||||
MOZ_ASSERT(gProcessType == GeckoProcessType_Default);
|
||||
|
||||
CommonInit(aActor);
|
||||
}
|
||||
|
||||
BlobChild::
|
||||
RemoteBlobImpl::RemoteBlobImpl(BlobChild* aActor,
|
||||
BlobImpl* aRemoteBlobImpl,
|
||||
BlobImpl* aSameProcessBlobImpl,
|
||||
const nsAString& aContentType,
|
||||
uint64_t aLength,
|
||||
bool aIsSameProcessBlob)
|
||||
uint64_t aLength)
|
||||
: BlobImplBase(aContentType, aLength)
|
||||
, mSameProcessBlobImpl(aSameProcessBlobImpl)
|
||||
, mIsSlice(false)
|
||||
{
|
||||
if (aIsSameProcessBlob) {
|
||||
MOZ_ASSERT(aRemoteBlobImpl);
|
||||
mSameProcessBlobImpl = aRemoteBlobImpl;
|
||||
MOZ_ASSERT(gProcessType == GeckoProcessType_Default);
|
||||
} else {
|
||||
mDifferentProcessBlobImpl = aRemoteBlobImpl;
|
||||
}
|
||||
MOZ_ASSERT(aSameProcessBlobImpl);
|
||||
MOZ_ASSERT(gProcessType == GeckoProcessType_Default);
|
||||
|
||||
CommonInit(aActor);
|
||||
}
|
||||
@ -3030,19 +3041,12 @@ BlobChild::CommonInit(BlobChild* aOther, BlobImpl* aBlobImpl)
|
||||
int64_t modDate = otherImpl->GetLastModified(rv);
|
||||
MOZ_ASSERT(!rv.Failed());
|
||||
|
||||
remoteBlob = new RemoteBlobImpl(this, otherImpl, name, contentType, length,
|
||||
modDate, otherImpl->GetDirState(),
|
||||
false /* SameProcessBlobImpl */);
|
||||
remoteBlob = new RemoteBlobImpl(this, name, contentType, length, modDate,
|
||||
otherImpl->GetDirState());
|
||||
} else {
|
||||
remoteBlob = new RemoteBlobImpl(this, otherImpl, contentType, length,
|
||||
false /* SameProcessBlobImpl */);
|
||||
remoteBlob = new RemoteBlobImpl(this, contentType, length);
|
||||
}
|
||||
|
||||
// This RemoteBlob must be kept alive untill RecvCreatedFromKnownBlob is
|
||||
// called because the parent will send this notification and we must be able
|
||||
// to manage it.
|
||||
remoteBlob->AddRef();
|
||||
|
||||
CommonInit(aOther->ParentID(), remoteBlob);
|
||||
}
|
||||
|
||||
@ -3069,8 +3073,7 @@ BlobChild::CommonInit(const ChildBlobConstructorParams& aParams)
|
||||
const NormalBlobConstructorParams& params =
|
||||
blobParams.get_NormalBlobConstructorParams();
|
||||
remoteBlob =
|
||||
new RemoteBlobImpl(this, nullptr, params.contentType(), params.length(),
|
||||
false /* SameProcessBlobImpl */);
|
||||
new RemoteBlobImpl(this, params.contentType(), params.length());
|
||||
break;
|
||||
}
|
||||
|
||||
@ -3078,13 +3081,11 @@ BlobChild::CommonInit(const ChildBlobConstructorParams& aParams)
|
||||
const FileBlobConstructorParams& params =
|
||||
blobParams.get_FileBlobConstructorParams();
|
||||
remoteBlob = new RemoteBlobImpl(this,
|
||||
nullptr,
|
||||
params.name(),
|
||||
params.contentType(),
|
||||
params.length(),
|
||||
params.modDate(),
|
||||
BlobDirState(params.dirState()),
|
||||
false /* SameProcessBlobImpl */);
|
||||
BlobDirState(params.dirState()));
|
||||
break;
|
||||
}
|
||||
|
||||
@ -3119,11 +3120,9 @@ BlobChild::CommonInit(const ChildBlobConstructorParams& aParams)
|
||||
contentType,
|
||||
size,
|
||||
lastModifiedDate,
|
||||
blobImpl->GetDirState(),
|
||||
true /* SameProcessBlobImpl */);
|
||||
blobImpl->GetDirState());
|
||||
} else {
|
||||
remoteBlob = new RemoteBlobImpl(this, blobImpl, contentType, size,
|
||||
true /* SameProcessBlobImpl */);
|
||||
remoteBlob = new RemoteBlobImpl(this, blobImpl, contentType, size);
|
||||
}
|
||||
|
||||
break;
|
||||
@ -3593,20 +3592,6 @@ BlobChild::DeallocPBlobStreamChild(PBlobStreamChild* aActor)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
BlobChild::RecvCreatedFromKnownBlob()
|
||||
{
|
||||
MOZ_ASSERT(mRemoteBlobImpl);
|
||||
|
||||
// Releasing the other blob now that this blob is fully created.
|
||||
mRemoteBlobImpl->NullifyDifferentProcessBlobImpl();
|
||||
|
||||
// Release the additional reference to ourself that was added in order to
|
||||
// receive this RecvCreatedFromKnownBlob.
|
||||
mRemoteBlobImpl->Release();
|
||||
return true;
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
* BlobParent
|
||||
******************************************************************************/
|
||||
|
@ -220,9 +220,6 @@ private:
|
||||
|
||||
virtual bool
|
||||
DeallocPBlobStreamChild(PBlobStreamChild* aActor) override;
|
||||
|
||||
virtual bool
|
||||
RecvCreatedFromKnownBlob() override;
|
||||
};
|
||||
|
||||
// Only let ContentChild call BlobChild::Startup() and ensure that
|
||||
|
@ -3515,18 +3515,6 @@ ContentParent::DeallocPBlobParent(PBlobParent* aActor)
|
||||
return nsIContentParent::DeallocPBlobParent(aActor);
|
||||
}
|
||||
|
||||
bool
|
||||
ContentParent::RecvPBlobConstructor(PBlobParent* aActor,
|
||||
const BlobConstructorParams& aParams)
|
||||
{
|
||||
const ParentBlobConstructorParams& params = aParams.get_ParentBlobConstructorParams();
|
||||
if (params.blobParams().type() == AnyBlobConstructorParams::TKnownBlobConstructorParams) {
|
||||
return aActor->SendCreatedFromKnownBlob();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
mozilla::PRemoteSpellcheckEngineParent *
|
||||
ContentParent::AllocPRemoteSpellcheckEngineParent()
|
||||
{
|
||||
|
@ -648,9 +648,6 @@ private:
|
||||
override;
|
||||
virtual bool DeallocPBlobParent(PBlobParent* aActor) override;
|
||||
|
||||
virtual bool RecvPBlobConstructor(PBlobParent* aActor,
|
||||
const BlobConstructorParams& params) override;
|
||||
|
||||
virtual bool DeallocPCrashReporterParent(PCrashReporterParent* crashreporter) override;
|
||||
|
||||
virtual bool RecvGetRandomValues(const uint32_t& length,
|
||||
|
@ -45,11 +45,6 @@ parent:
|
||||
// Use only for testing!
|
||||
sync GetFilePath()
|
||||
returns (nsString filePath);
|
||||
|
||||
child:
|
||||
// This method must be called by the parent when the PBlobParent is fully
|
||||
// created in order to release the known blob.
|
||||
CreatedFromKnownBlob();
|
||||
};
|
||||
|
||||
} // namespace dom
|
||||
|
@ -13,7 +13,6 @@
|
||||
#include "mozilla/AppProcessChecker.h"
|
||||
#include "mozilla/Assertions.h"
|
||||
#include "mozilla/dom/ContentParent.h"
|
||||
#include "mozilla/dom/DOMTypes.h"
|
||||
#include "mozilla/dom/NuwaParent.h"
|
||||
#include "mozilla/dom/PBlobParent.h"
|
||||
#include "mozilla/dom/MessagePortParent.h"
|
||||
@ -244,18 +243,6 @@ BackgroundParentImpl::DeallocPBlobParent(PBlobParent* aActor)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
BackgroundParentImpl::RecvPBlobConstructor(PBlobParent* aActor,
|
||||
const BlobConstructorParams& aParams)
|
||||
{
|
||||
const ParentBlobConstructorParams& params = aParams;
|
||||
if (params.blobParams().type() == AnyBlobConstructorParams::TKnownBlobConstructorParams) {
|
||||
return aActor->SendCreatedFromKnownBlob();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
PFileDescriptorSetParent*
|
||||
BackgroundParentImpl::AllocPFileDescriptorSetParent(
|
||||
const FileDescriptor& aFileDescriptor)
|
||||
|
@ -64,10 +64,6 @@ protected:
|
||||
virtual bool
|
||||
DeallocPBlobParent(PBlobParent* aActor) override;
|
||||
|
||||
virtual bool
|
||||
RecvPBlobConstructor(PBlobParent* aActor,
|
||||
const BlobConstructorParams& params) override;
|
||||
|
||||
virtual PFileDescriptorSetParent*
|
||||
AllocPFileDescriptorSetParent(const FileDescriptor& aFileDescriptor)
|
||||
override;
|
||||
|
Loading…
Reference in New Issue
Block a user