зеркало из https://github.com/mozilla/gecko-dev.git
Backed out changeset c3251f5022dd (bug 1359718)
This commit is contained in:
Родитель
d64f9c87d8
Коммит
4ac10ab053
|
@ -20,6 +20,7 @@
|
|||
#include "mozilla/dom/ImageBitmapBinding.h"
|
||||
#include "mozilla/dom/ImageData.h"
|
||||
#include "mozilla/dom/ImageDataBinding.h"
|
||||
#include "mozilla/dom/ipc/BlobChild.h"
|
||||
#include "mozilla/dom/StructuredClone.h"
|
||||
#include "mozilla/dom/MessagePort.h"
|
||||
#include "mozilla/dom/MessagePortBinding.h"
|
||||
|
|
|
@ -42,6 +42,8 @@
|
|||
#include "mozilla/dom/ProcessGlobal.h"
|
||||
#include "mozilla/dom/SameProcessMessageQueue.h"
|
||||
#include "mozilla/dom/ScriptSettings.h"
|
||||
#include "mozilla/dom/ipc/BlobChild.h"
|
||||
#include "mozilla/dom/ipc/BlobParent.h"
|
||||
#include "mozilla/dom/ipc/StructuredCloneData.h"
|
||||
#include "mozilla/dom/DOMStringList.h"
|
||||
#include "mozilla/jsipc/CrossProcessObjectWrappers.h"
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
#include "BroadcastChannelChild.h"
|
||||
#include "BroadcastChannel.h"
|
||||
#include "jsapi.h"
|
||||
#include "mozilla/dom/ipc/BlobChild.h"
|
||||
#include "mozilla/dom/File.h"
|
||||
#include "mozilla/dom/MessageEvent.h"
|
||||
#include "mozilla/dom/MessageEventBinding.h"
|
||||
|
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -0,0 +1,238 @@
|
|||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#ifndef mozilla_dom_ipc_BlobChild_h
|
||||
#define mozilla_dom_ipc_BlobChild_h
|
||||
|
||||
#include "mozilla/Attributes.h"
|
||||
#include "mozilla/dom/PBlobChild.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsID.h"
|
||||
|
||||
class nsIEventTarget;
|
||||
class nsIRemoteBlob;
|
||||
class nsString;
|
||||
|
||||
namespace mozilla {
|
||||
namespace ipc {
|
||||
|
||||
class PBackgroundChild;
|
||||
|
||||
} // namespace ipc
|
||||
|
||||
namespace dom {
|
||||
|
||||
class Blob;
|
||||
class BlobImpl;
|
||||
class ContentChild;
|
||||
class nsIContentChild;
|
||||
|
||||
class BlobChild final
|
||||
: public PBlobChild
|
||||
{
|
||||
typedef mozilla::ipc::PBackgroundChild PBackgroundChild;
|
||||
|
||||
class RemoteBlobImpl;
|
||||
friend class RemoteBlobImpl;
|
||||
|
||||
class RemoteBlobSliceImpl;
|
||||
friend class RemoteBlobSliceImpl;
|
||||
|
||||
BlobImpl* mBlobImpl;
|
||||
RemoteBlobImpl* mRemoteBlobImpl;
|
||||
|
||||
// One of these will be null and the other non-null.
|
||||
PBackgroundChild* mBackgroundManager;
|
||||
nsCOMPtr<nsIContentChild> mContentManager;
|
||||
|
||||
nsCOMPtr<nsIEventTarget> mEventTarget;
|
||||
|
||||
nsID mParentID;
|
||||
|
||||
bool mOwnsBlobImpl;
|
||||
|
||||
public:
|
||||
class FriendKey;
|
||||
|
||||
static void
|
||||
Startup(const FriendKey& aKey);
|
||||
|
||||
// These create functions are called on the sending side.
|
||||
static BlobChild*
|
||||
GetOrCreate(nsIContentChild* aManager, BlobImpl* aBlobImpl);
|
||||
|
||||
static BlobChild*
|
||||
GetOrCreate(PBackgroundChild* aManager, BlobImpl* aBlobImpl);
|
||||
|
||||
// These create functions are called on the receiving side.
|
||||
static BlobChild*
|
||||
Create(nsIContentChild* aManager, const ChildBlobConstructorParams& aParams);
|
||||
|
||||
static BlobChild*
|
||||
Create(PBackgroundChild* aManager,
|
||||
const ChildBlobConstructorParams& aParams);
|
||||
|
||||
static void
|
||||
Destroy(PBlobChild* aActor)
|
||||
{
|
||||
delete static_cast<BlobChild*>(aActor);
|
||||
}
|
||||
|
||||
bool
|
||||
HasManager() const
|
||||
{
|
||||
return mBackgroundManager || mContentManager;
|
||||
}
|
||||
|
||||
PBackgroundChild*
|
||||
GetBackgroundManager() const
|
||||
{
|
||||
return mBackgroundManager;
|
||||
}
|
||||
|
||||
nsIContentChild*
|
||||
GetContentManager() const
|
||||
{
|
||||
return mContentManager;
|
||||
}
|
||||
|
||||
const nsID&
|
||||
ParentID() const;
|
||||
|
||||
// Get the BlobImpl associated with this actor. This may always be called
|
||||
// on the sending side. It may also be called on the receiving side unless
|
||||
// this is a "mystery" blob that has not yet received a SetMysteryBlobInfo()
|
||||
// call.
|
||||
already_AddRefed<BlobImpl>
|
||||
GetBlobImpl();
|
||||
|
||||
// Use this for files.
|
||||
bool
|
||||
SetMysteryBlobInfo(const nsString& aName,
|
||||
const nsString& aContentType,
|
||||
uint64_t aLength,
|
||||
int64_t aLastModifiedDate);
|
||||
|
||||
// Use this for non-file blobs.
|
||||
bool
|
||||
SetMysteryBlobInfo(const nsString& aContentType, uint64_t aLength);
|
||||
|
||||
void
|
||||
AssertIsOnOwningThread() const
|
||||
#ifdef DEBUG
|
||||
;
|
||||
#else
|
||||
{ }
|
||||
#endif
|
||||
|
||||
private:
|
||||
// These constructors are called on the sending side.
|
||||
BlobChild(nsIContentChild* aManager, BlobImpl* aBlobImpl);
|
||||
|
||||
BlobChild(PBackgroundChild* aManager, BlobImpl* aBlobImpl);
|
||||
|
||||
BlobChild(nsIContentChild* aManager, BlobChild* aOther);
|
||||
|
||||
BlobChild(PBackgroundChild* aManager, BlobChild* aOther, BlobImpl* aBlobImpl);
|
||||
|
||||
// These constructors are called on the receiving side.
|
||||
BlobChild(nsIContentChild* aManager,
|
||||
const ChildBlobConstructorParams& aParams);
|
||||
|
||||
BlobChild(PBackgroundChild* aManager,
|
||||
const ChildBlobConstructorParams& aParams);
|
||||
|
||||
// These constructors are called for slices.
|
||||
BlobChild(nsIContentChild* aManager,
|
||||
const nsID& aParentID,
|
||||
RemoteBlobSliceImpl* aRemoteBlobSliceImpl);
|
||||
|
||||
BlobChild(PBackgroundChild* aManager,
|
||||
const nsID& aParentID,
|
||||
RemoteBlobSliceImpl* aRemoteBlobSliceImpl);
|
||||
|
||||
// Only called by Destroy().
|
||||
~BlobChild();
|
||||
|
||||
void
|
||||
CommonInit(BlobImpl* aBlobImpl);
|
||||
|
||||
void
|
||||
CommonInit(BlobChild* aOther, BlobImpl* aBlobImpl);
|
||||
|
||||
void
|
||||
CommonInit(const ChildBlobConstructorParams& aParams);
|
||||
|
||||
void
|
||||
CommonInit(const nsID& aParentID, RemoteBlobImpl* aRemoteBlobImpl);
|
||||
|
||||
template <class ChildManagerType>
|
||||
static BlobChild*
|
||||
GetOrCreateFromImpl(ChildManagerType* aManager, BlobImpl* aBlobImpl);
|
||||
|
||||
template <class ChildManagerType>
|
||||
static BlobChild*
|
||||
CreateFromParams(ChildManagerType* aManager,
|
||||
const ChildBlobConstructorParams& aParams);
|
||||
|
||||
template <class ChildManagerType>
|
||||
static BlobChild*
|
||||
SendSliceConstructor(ChildManagerType* aManager,
|
||||
RemoteBlobSliceImpl* aRemoteBlobSliceImpl,
|
||||
const ParentBlobConstructorParams& aParams);
|
||||
|
||||
static BlobChild*
|
||||
MaybeGetActorFromRemoteBlob(nsIRemoteBlob* aRemoteBlob,
|
||||
nsIContentChild* aManager,
|
||||
BlobImpl* aBlobImpl);
|
||||
|
||||
static BlobChild*
|
||||
MaybeGetActorFromRemoteBlob(nsIRemoteBlob* aRemoteBlob,
|
||||
PBackgroundChild* aManager,
|
||||
BlobImpl* aBlobImpl);
|
||||
|
||||
void
|
||||
NoteDyingRemoteBlobImpl();
|
||||
|
||||
nsIEventTarget*
|
||||
EventTarget() const
|
||||
{
|
||||
return mEventTarget;
|
||||
}
|
||||
|
||||
bool
|
||||
IsOnOwningThread() const;
|
||||
|
||||
// These methods are only called by the IPDL message machinery.
|
||||
virtual void
|
||||
ActorDestroy(ActorDestroyReason aWhy) override;
|
||||
|
||||
virtual mozilla::ipc::IPCResult
|
||||
RecvCreatedFromKnownBlob() override;
|
||||
};
|
||||
|
||||
// Only let ContentChild call BlobChild::Startup() and ensure that
|
||||
// ContentChild can't access any other BlobChild internals.
|
||||
class BlobChild::FriendKey final
|
||||
{
|
||||
friend class ContentChild;
|
||||
|
||||
private:
|
||||
FriendKey()
|
||||
{ }
|
||||
|
||||
FriendKey(const FriendKey& /* aOther */)
|
||||
{ }
|
||||
|
||||
public:
|
||||
~FriendKey()
|
||||
{ }
|
||||
};
|
||||
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
|
||||
#endif // mozilla_dom_ipc_BlobChild_h
|
|
@ -0,0 +1,226 @@
|
|||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#ifndef mozilla_dom_ipc_BlobParent_h
|
||||
#define mozilla_dom_ipc_BlobParent_h
|
||||
|
||||
#include "mozilla/Attributes.h"
|
||||
#include "mozilla/StaticPtr.h"
|
||||
#include "mozilla/dom/PBlobParent.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsTArray.h"
|
||||
|
||||
template <class, class> class nsDataHashtable;
|
||||
class nsIDHashKey;
|
||||
class nsIEventTarget;
|
||||
class nsIRemoteBlob;
|
||||
template <class> class nsRevocableEventPtr;
|
||||
class nsString;
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
class Mutex;
|
||||
|
||||
namespace ipc {
|
||||
|
||||
class PBackgroundParent;
|
||||
|
||||
} // namespace ipc
|
||||
|
||||
namespace dom {
|
||||
|
||||
class ContentParent;
|
||||
class BlobImpl;
|
||||
class nsIContentParent;
|
||||
|
||||
class BlobParent final
|
||||
: public PBlobParent
|
||||
{
|
||||
typedef mozilla::ipc::PBackgroundParent PBackgroundParent;
|
||||
|
||||
class IDTableEntry;
|
||||
typedef nsDataHashtable<nsIDHashKey, IDTableEntry*> IDTable;
|
||||
|
||||
class RemoteBlobImpl;
|
||||
|
||||
struct CreateBlobImplMetadata;
|
||||
|
||||
static StaticAutoPtr<IDTable> sIDTable;
|
||||
static StaticAutoPtr<Mutex> sIDTableMutex;
|
||||
|
||||
BlobImpl* mBlobImpl;
|
||||
RemoteBlobImpl* mRemoteBlobImpl;
|
||||
|
||||
// One of these will be null and the other non-null.
|
||||
PBackgroundParent* mBackgroundManager;
|
||||
nsCOMPtr<nsIContentParent> mContentManager;
|
||||
|
||||
nsCOMPtr<nsIEventTarget> mEventTarget;
|
||||
|
||||
RefPtr<IDTableEntry> mIDTableEntry;
|
||||
|
||||
bool mOwnsBlobImpl;
|
||||
|
||||
public:
|
||||
class FriendKey;
|
||||
|
||||
static void
|
||||
Startup(const FriendKey& aKey);
|
||||
|
||||
// These create functions are called on the sending side.
|
||||
static BlobParent*
|
||||
GetOrCreate(nsIContentParent* aManager, BlobImpl* aBlobImpl);
|
||||
|
||||
static BlobParent*
|
||||
GetOrCreate(PBackgroundParent* aManager, BlobImpl* aBlobImpl);
|
||||
|
||||
// These create functions are called on the receiving side.
|
||||
static BlobParent*
|
||||
Create(nsIContentParent* aManager,
|
||||
const ParentBlobConstructorParams& aParams);
|
||||
|
||||
static BlobParent*
|
||||
Create(PBackgroundParent* aManager,
|
||||
const ParentBlobConstructorParams& aParams);
|
||||
|
||||
static void
|
||||
Destroy(PBlobParent* aActor)
|
||||
{
|
||||
delete static_cast<BlobParent*>(aActor);
|
||||
}
|
||||
|
||||
static already_AddRefed<BlobImpl>
|
||||
GetBlobImplForID(const nsID& aID);
|
||||
|
||||
bool
|
||||
HasManager() const
|
||||
{
|
||||
return mBackgroundManager || mContentManager;
|
||||
}
|
||||
|
||||
PBackgroundParent*
|
||||
GetBackgroundManager() const
|
||||
{
|
||||
return mBackgroundManager;
|
||||
}
|
||||
|
||||
nsIContentParent*
|
||||
GetContentManager() const
|
||||
{
|
||||
return mContentManager;
|
||||
}
|
||||
|
||||
// Get the BlobImpl associated with this actor.
|
||||
already_AddRefed<BlobImpl>
|
||||
GetBlobImpl();
|
||||
|
||||
void
|
||||
AssertIsOnOwningThread() const
|
||||
#ifdef DEBUG
|
||||
;
|
||||
#else
|
||||
{ }
|
||||
#endif
|
||||
|
||||
private:
|
||||
// These constructors are called on the sending side.
|
||||
BlobParent(nsIContentParent* aManager, IDTableEntry* aIDTableEntry);
|
||||
|
||||
BlobParent(PBackgroundParent* aManager, IDTableEntry* aIDTableEntry);
|
||||
|
||||
// These constructors are called on the receiving side.
|
||||
BlobParent(nsIContentParent* aManager,
|
||||
BlobImpl* aBlobImpl,
|
||||
IDTableEntry* aIDTableEntry);
|
||||
|
||||
BlobParent(PBackgroundParent* aManager,
|
||||
BlobImpl* aBlobImpl,
|
||||
IDTableEntry* aIDTableEntry);
|
||||
|
||||
// Only destroyed by BackgroundParentImpl and ContentParent.
|
||||
~BlobParent();
|
||||
|
||||
void
|
||||
CommonInit(IDTableEntry* aIDTableEntry);
|
||||
|
||||
void
|
||||
CommonInit(BlobImpl* aBlobImpl, IDTableEntry* aIDTableEntry);
|
||||
|
||||
template <class ParentManagerType>
|
||||
static BlobParent*
|
||||
GetOrCreateFromImpl(ParentManagerType* aManager,
|
||||
BlobImpl* aBlobImpl);
|
||||
|
||||
template <class ParentManagerType>
|
||||
static BlobParent*
|
||||
CreateFromParams(ParentManagerType* aManager,
|
||||
const ParentBlobConstructorParams& aParams);
|
||||
|
||||
template <class ParentManagerType>
|
||||
static BlobParent*
|
||||
SendSliceConstructor(ParentManagerType* aManager,
|
||||
const ParentBlobConstructorParams& aParams,
|
||||
const ChildBlobConstructorParams& aOtherSideParams);
|
||||
|
||||
static BlobParent*
|
||||
MaybeGetActorFromRemoteBlob(nsIRemoteBlob* aRemoteBlob,
|
||||
nsIContentParent* aManager);
|
||||
|
||||
static BlobParent*
|
||||
MaybeGetActorFromRemoteBlob(nsIRemoteBlob* aRemoteBlob,
|
||||
PBackgroundParent* aManager);
|
||||
|
||||
void
|
||||
NoteDyingRemoteBlobImpl();
|
||||
|
||||
nsIEventTarget*
|
||||
EventTarget() const
|
||||
{
|
||||
return mEventTarget;
|
||||
}
|
||||
|
||||
bool
|
||||
IsOnOwningThread() const;
|
||||
|
||||
// These methods are only called by the IPDL message machinery.
|
||||
virtual void
|
||||
ActorDestroy(ActorDestroyReason aWhy) override;
|
||||
|
||||
virtual mozilla::ipc::IPCResult
|
||||
RecvResolveMystery(const ResolveMysteryParams& aParams) override;
|
||||
|
||||
virtual mozilla::ipc::IPCResult
|
||||
RecvWaitForSliceCreation() override;
|
||||
|
||||
virtual mozilla::ipc::IPCResult
|
||||
RecvGetFileId(int64_t* aFileId) override;
|
||||
|
||||
virtual mozilla::ipc::IPCResult
|
||||
RecvGetFilePath(nsString* aFilePath) override;
|
||||
};
|
||||
|
||||
// Only let ContentParent call BlobParent::Startup() and ensure that
|
||||
// ContentParent can't access any other BlobParent internals.
|
||||
class BlobParent::FriendKey final
|
||||
{
|
||||
friend class ContentParent;
|
||||
|
||||
private:
|
||||
FriendKey()
|
||||
{ }
|
||||
|
||||
FriendKey(const FriendKey& /* aOther */)
|
||||
{ }
|
||||
|
||||
public:
|
||||
~FriendKey()
|
||||
{ }
|
||||
};
|
||||
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
|
||||
#endif // mozilla_dom_ipc_BlobParent_h
|
|
@ -10,15 +10,9 @@
|
|||
#include "IPCBlobInputStreamParent.h"
|
||||
#include "IPCBlobInputStreamStorage.h"
|
||||
#include "mozilla/dom/IPCBlob.h"
|
||||
#include "mozilla/dom/nsIContentParent.h"
|
||||
#include "mozilla/ipc/IPCStreamUtils.h"
|
||||
#include "StreamBlobImpl.h"
|
||||
#include "prtime.h"
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
using namespace ipc;
|
||||
|
||||
namespace dom {
|
||||
namespace IPCBlobUtils {
|
||||
|
||||
|
|
|
@ -140,7 +140,6 @@ class PBackgroundParent;
|
|||
|
||||
namespace dom {
|
||||
|
||||
class IPCBlob;
|
||||
class nsIContentChild;
|
||||
class nsIContentParent;
|
||||
|
||||
|
|
|
@ -0,0 +1,51 @@
|
|||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
||||
* You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
include protocol PBackground;
|
||||
include protocol PContent;
|
||||
include protocol PContentBridge;
|
||||
include protocol PFileDescriptorSet;
|
||||
include protocol PChildToParentStream;
|
||||
include protocol PParentToChildStream;
|
||||
|
||||
include BlobTypes;
|
||||
include DOMTypes;
|
||||
include InputStreamParams;
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
union ResolveMysteryParams
|
||||
{
|
||||
NormalBlobConstructorParams;
|
||||
FileBlobConstructorParams;
|
||||
};
|
||||
|
||||
sync protocol PBlob
|
||||
{
|
||||
manager PBackground or PContent or PContentBridge;
|
||||
|
||||
both:
|
||||
async __delete__();
|
||||
|
||||
parent:
|
||||
async ResolveMystery(ResolveMysteryParams params);
|
||||
|
||||
sync WaitForSliceCreation();
|
||||
|
||||
// Use only for testing!
|
||||
sync GetFileId()
|
||||
returns (int64_t fileId);
|
||||
|
||||
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.
|
||||
async CreatedFromKnownBlob();
|
||||
};
|
||||
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
|
@ -5,7 +5,6 @@
|
|||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "PendingIPCBlobParent.h"
|
||||
#include "mozilla/ipc/PBackgroundParent.h"
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
|
|
|
@ -5,6 +5,8 @@
|
|||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
EXPORTS.mozilla.dom.ipc += [
|
||||
'BlobChild.h',
|
||||
'BlobParent.h',
|
||||
'IPCBlobInputStream.h',
|
||||
'IPCBlobInputStreamChild.h',
|
||||
'IPCBlobInputStreamParent.h',
|
||||
|
@ -19,6 +21,7 @@ EXPORTS.mozilla.dom += [
|
|||
]
|
||||
|
||||
UNIFIED_SOURCES += [
|
||||
'Blob.cpp',
|
||||
'IPCBlobInputStream.cpp',
|
||||
'IPCBlobInputStreamChild.cpp',
|
||||
'IPCBlobInputStreamParent.cpp',
|
||||
|
@ -31,6 +34,7 @@ UNIFIED_SOURCES += [
|
|||
IPDL_SOURCES += [
|
||||
'BlobTypes.ipdlh',
|
||||
'IPCBlob.ipdlh',
|
||||
'PBlob.ipdl',
|
||||
'PIPCBlobInputStream.ipdl',
|
||||
'PPendingIPCBlob.ipdl',
|
||||
]
|
||||
|
|
|
@ -18,13 +18,26 @@
|
|||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
class BlobChild;
|
||||
class BlobParent;
|
||||
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
|
||||
class NS_NO_VTABLE nsIRemoteBlob : public nsISupports
|
||||
{
|
||||
public:
|
||||
typedef mozilla::dom::BlobChild BlobChild;
|
||||
typedef mozilla::dom::BlobParent BlobParent;
|
||||
|
||||
NS_DECLARE_STATIC_IID_ACCESSOR(NS_IREMOTEBLOB_IID)
|
||||
|
||||
virtual BlobChild*
|
||||
GetBlobChild() = 0;
|
||||
|
||||
virtual BlobParent*
|
||||
GetBlobParent() = 0;
|
||||
};
|
||||
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(nsIRemoteBlob, NS_IREMOTEBLOB_IID)
|
||||
|
|
|
@ -38,6 +38,7 @@
|
|||
#include "mozilla/dom/StructuredCloneHolder.h"
|
||||
#include "mozilla/dom/StructuredCloneTags.h"
|
||||
#include "mozilla/dom/indexedDB/PBackgroundIDBSharedTypes.h"
|
||||
#include "mozilla/dom/ipc/BlobChild.h"
|
||||
#include "mozilla/ipc/BackgroundChild.h"
|
||||
#include "mozilla/ipc/PBackgroundSharedTypes.h"
|
||||
#include "nsCOMPtr.h"
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
#include "mozilla/dom/ContentChild.h"
|
||||
#include "mozilla/dom/File.h"
|
||||
#include "mozilla/dom/TabChild.h"
|
||||
#include "mozilla/dom/ipc/BlobChild.h"
|
||||
#include "mozilla/jsipc/CrossProcessObjectWrappers.h"
|
||||
#include "mozilla/ipc/InputStreamUtils.h"
|
||||
#include "base/task.h"
|
||||
|
@ -60,6 +61,13 @@ ContentBridgeChild::RecvAsyncMessage(const nsString& aMsg,
|
|||
return nsIContentChild::RecvAsyncMessage(aMsg, Move(aCpows), aPrincipal, aData);
|
||||
}
|
||||
|
||||
PBlobChild*
|
||||
ContentBridgeChild::SendPBlobConstructor(PBlobChild* actor,
|
||||
const BlobConstructorParams& params)
|
||||
{
|
||||
return PContentBridgeChild::SendPBlobConstructor(actor, params);
|
||||
}
|
||||
|
||||
bool
|
||||
ContentBridgeChild::SendPBrowserConstructor(PBrowserChild* aActor,
|
||||
const TabId& aTabId,
|
||||
|
@ -154,6 +162,18 @@ ContentBridgeChild::RecvPBrowserConstructor(PBrowserChild* aActor,
|
|||
aIsForBrowser);
|
||||
}
|
||||
|
||||
PBlobChild*
|
||||
ContentBridgeChild::AllocPBlobChild(const BlobConstructorParams& aParams)
|
||||
{
|
||||
return nsIContentChild::AllocPBlobChild(aParams);
|
||||
}
|
||||
|
||||
bool
|
||||
ContentBridgeChild::DeallocPBlobChild(PBlobChild* aActor)
|
||||
{
|
||||
return nsIContentChild::DeallocPBlobChild(aActor);
|
||||
}
|
||||
|
||||
PIPCBlobInputStreamChild*
|
||||
ContentBridgeChild::AllocPIPCBlobInputStreamChild(const nsID& aID,
|
||||
const uint64_t& aSize)
|
||||
|
|
|
@ -32,6 +32,10 @@ public:
|
|||
const IPC::Principal& aPrincipal,
|
||||
const ClonedMessageData& aData) override;
|
||||
|
||||
virtual PBlobChild*
|
||||
SendPBlobConstructor(PBlobChild* actor,
|
||||
const BlobConstructorParams& aParams) override;
|
||||
|
||||
jsipc::CPOWManager* GetCPOWManager() override;
|
||||
|
||||
virtual bool SendPBrowserConstructor(PBrowserChild* aActor,
|
||||
|
@ -78,6 +82,9 @@ protected:
|
|||
virtual mozilla::jsipc::PJavaScriptChild* AllocPJavaScriptChild() override;
|
||||
virtual bool DeallocPJavaScriptChild(mozilla::jsipc::PJavaScriptChild*) override;
|
||||
|
||||
virtual PBlobChild* AllocPBlobChild(const BlobConstructorParams& aParams) override;
|
||||
virtual bool DeallocPBlobChild(PBlobChild*) override;
|
||||
|
||||
virtual PIPCBlobInputStreamChild*
|
||||
AllocPIPCBlobInputStreamChild(const nsID& aID,
|
||||
const uint64_t& aSize) override;
|
||||
|
|
|
@ -87,6 +87,13 @@ ContentBridgeParent::RecvAsyncMessage(const nsString& aMsg,
|
|||
aPrincipal, aData);
|
||||
}
|
||||
|
||||
PBlobParent*
|
||||
ContentBridgeParent::SendPBlobConstructor(PBlobParent* actor,
|
||||
const BlobConstructorParams& params)
|
||||
{
|
||||
return PContentBridgeParent::SendPBlobConstructor(actor, params);
|
||||
}
|
||||
|
||||
PBrowserParent*
|
||||
ContentBridgeParent::SendPBrowserConstructor(PBrowserParent* aActor,
|
||||
const TabId& aTabId,
|
||||
|
@ -111,6 +118,18 @@ ContentBridgeParent::SendPParentToChildStreamConstructor(PParentToChildStreamPar
|
|||
return PContentBridgeParent::SendPParentToChildStreamConstructor(aActor);
|
||||
}
|
||||
|
||||
PBlobParent*
|
||||
ContentBridgeParent::AllocPBlobParent(const BlobConstructorParams& aParams)
|
||||
{
|
||||
return nsIContentParent::AllocPBlobParent(aParams);
|
||||
}
|
||||
|
||||
bool
|
||||
ContentBridgeParent::DeallocPBlobParent(PBlobParent* aActor)
|
||||
{
|
||||
return nsIContentParent::DeallocPBlobParent(aActor);
|
||||
}
|
||||
|
||||
PIPCBlobInputStreamParent*
|
||||
ContentBridgeParent::SendPIPCBlobInputStreamConstructor(PIPCBlobInputStreamParent* aActor,
|
||||
const nsID& aID,
|
||||
|
|
|
@ -33,6 +33,10 @@ public:
|
|||
static ContentBridgeParent*
|
||||
Create(Endpoint<PContentBridgeParent>&& aEndpoint);
|
||||
|
||||
virtual PBlobParent*
|
||||
SendPBlobConstructor(PBlobParent* actor,
|
||||
const BlobConstructorParams& params) override;
|
||||
|
||||
virtual PBrowserParent*
|
||||
SendPBrowserConstructor(PBrowserParent* aActor,
|
||||
const TabId& aTabId,
|
||||
|
@ -129,6 +133,11 @@ protected:
|
|||
|
||||
virtual bool DeallocPBrowserParent(PBrowserParent*) override;
|
||||
|
||||
virtual PBlobParent*
|
||||
AllocPBlobParent(const BlobConstructorParams& aParams) override;
|
||||
|
||||
virtual bool DeallocPBlobParent(PBlobParent*) override;
|
||||
|
||||
virtual PIPCBlobInputStreamParent*
|
||||
SendPIPCBlobInputStreamConstructor(PIPCBlobInputStreamParent* aActor,
|
||||
const nsID& aID,
|
||||
|
|
|
@ -41,6 +41,7 @@
|
|||
#include "mozilla/dom/workers/ServiceWorkerManager.h"
|
||||
#include "mozilla/dom/nsIContentChild.h"
|
||||
#include "mozilla/dom/URLClassifierChild.h"
|
||||
#include "mozilla/dom/ipc/BlobChild.h"
|
||||
#include "mozilla/gfx/gfxVars.h"
|
||||
#include "mozilla/psm/PSMContentListener.h"
|
||||
#include "mozilla/hal_sandbox/PHalChild.h"
|
||||
|
@ -988,6 +989,8 @@ ContentChild::InitXPCOM(const XPCOMInitData& aXPCOMInit,
|
|||
MOZ_CRASH("Failed to create PBackgroundChild!");
|
||||
}
|
||||
|
||||
BlobChild::Startup(BlobChild::FriendKey());
|
||||
|
||||
nsCOMPtr<nsIConsoleService> svc(do_GetService(NS_CONSOLESERVICE_CONTRACTID));
|
||||
if (!svc) {
|
||||
NS_WARNING("Couldn't acquire console service");
|
||||
|
@ -1643,6 +1646,12 @@ ContentChild::DeallocPIPCBlobInputStreamChild(PIPCBlobInputStreamChild* aActor)
|
|||
return nsIContentChild::DeallocPIPCBlobInputStreamChild(aActor);
|
||||
}
|
||||
|
||||
PBlobChild*
|
||||
ContentChild::AllocPBlobChild(const BlobConstructorParams& aParams)
|
||||
{
|
||||
return nsIContentChild::AllocPBlobChild(aParams);
|
||||
}
|
||||
|
||||
mozilla::PRemoteSpellcheckEngineChild *
|
||||
ContentChild::AllocPRemoteSpellcheckEngineChild()
|
||||
{
|
||||
|
@ -1657,6 +1666,23 @@ ContentChild::DeallocPRemoteSpellcheckEngineChild(PRemoteSpellcheckEngineChild *
|
|||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
ContentChild::DeallocPBlobChild(PBlobChild* aActor)
|
||||
{
|
||||
return nsIContentChild::DeallocPBlobChild(aActor);
|
||||
}
|
||||
|
||||
PBlobChild*
|
||||
ContentChild::SendPBlobConstructor(PBlobChild* aActor,
|
||||
const BlobConstructorParams& aParams)
|
||||
{
|
||||
if (IsShuttingDown()) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return PContentChild::SendPBlobConstructor(aActor, aParams);
|
||||
}
|
||||
|
||||
PPresentationChild*
|
||||
ContentChild::AllocPPresentationChild()
|
||||
{
|
||||
|
|
|
@ -184,6 +184,11 @@ public:
|
|||
|
||||
virtual bool DeallocPBrowserChild(PBrowserChild*) override;
|
||||
|
||||
virtual PBlobChild*
|
||||
AllocPBlobChild(const BlobConstructorParams& aParams) override;
|
||||
|
||||
virtual bool DeallocPBlobChild(PBlobChild* aActor) override;
|
||||
|
||||
virtual PIPCBlobInputStreamChild*
|
||||
AllocPIPCBlobInputStreamChild(const nsID& aID,
|
||||
const uint64_t& aSize) override;
|
||||
|
@ -508,6 +513,10 @@ public:
|
|||
|
||||
bool IsForBrowser() const { return mIsForBrowser; }
|
||||
|
||||
virtual PBlobChild*
|
||||
SendPBlobConstructor(PBlobChild* actor,
|
||||
const BlobConstructorParams& params) override;
|
||||
|
||||
virtual PFileDescriptorSetChild*
|
||||
SendPFileDescriptorSetConstructor(const FileDescriptor&) override;
|
||||
|
||||
|
|
|
@ -66,6 +66,7 @@
|
|||
#include "mozilla/dom/quota/QuotaManagerService.h"
|
||||
#include "mozilla/dom/time/DateCacheCleaner.h"
|
||||
#include "mozilla/dom/URLClassifierParent.h"
|
||||
#include "mozilla/dom/ipc/BlobParent.h"
|
||||
#include "mozilla/embedding/printingui/PrintingParent.h"
|
||||
#include "mozilla/gfx/gfxVars.h"
|
||||
#include "mozilla/gfx/GPUProcessManager.h"
|
||||
|
@ -630,6 +631,8 @@ ContentParent::StartUp()
|
|||
|
||||
mozilla::dom::time::InitializeDateCacheCleaner();
|
||||
|
||||
BlobParent::Startup(BlobParent::FriendKey());
|
||||
|
||||
BackgroundChild::Startup();
|
||||
|
||||
sDisableUnsafeCPOWWarnings = PR_GetEnv("DISABLE_UNSAFE_CPOW_WARNINGS");
|
||||
|
@ -2835,6 +2838,18 @@ ContentParent::DeallocPBrowserParent(PBrowserParent* frame)
|
|||
return nsIContentParent::DeallocPBrowserParent(frame);
|
||||
}
|
||||
|
||||
PBlobParent*
|
||||
ContentParent::AllocPBlobParent(const BlobConstructorParams& aParams)
|
||||
{
|
||||
return nsIContentParent::AllocPBlobParent(aParams);
|
||||
}
|
||||
|
||||
bool
|
||||
ContentParent::DeallocPBlobParent(PBlobParent* aActor)
|
||||
{
|
||||
return nsIContentParent::DeallocPBlobParent(aActor);
|
||||
}
|
||||
|
||||
PIPCBlobInputStreamParent*
|
||||
ContentParent::AllocPIPCBlobInputStreamParent(const nsID& aID,
|
||||
const uint64_t& aSize)
|
||||
|
@ -2848,6 +2863,21 @@ ContentParent::DeallocPIPCBlobInputStreamParent(PIPCBlobInputStreamParent* aActo
|
|||
return nsIContentParent::DeallocPIPCBlobInputStreamParent(aActor);
|
||||
}
|
||||
|
||||
mozilla::ipc::IPCResult
|
||||
ContentParent::RecvPBlobConstructor(PBlobParent* aActor,
|
||||
const BlobConstructorParams& aParams)
|
||||
{
|
||||
const ParentBlobConstructorParams& params = aParams.get_ParentBlobConstructorParams();
|
||||
if (params.blobParams().type() == AnyBlobConstructorParams::TKnownBlobConstructorParams) {
|
||||
if (!aActor->SendCreatedFromKnownBlob()) {
|
||||
return IPC_FAIL_NO_REASON(this);
|
||||
}
|
||||
return IPC_OK();
|
||||
}
|
||||
|
||||
return IPC_OK();
|
||||
}
|
||||
|
||||
mozilla::PRemoteSpellcheckEngineParent *
|
||||
ContentParent::AllocPRemoteSpellcheckEngineParent()
|
||||
{
|
||||
|
@ -3836,6 +3866,13 @@ ContentParent::DoSendAsyncMessage(JSContext* aCx,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
PBlobParent*
|
||||
ContentParent::SendPBlobConstructor(PBlobParent* aActor,
|
||||
const BlobConstructorParams& aParams)
|
||||
{
|
||||
return PContentParent::SendPBlobConstructor(aActor, aParams);
|
||||
}
|
||||
|
||||
PIPCBlobInputStreamParent*
|
||||
ContentParent::SendPIPCBlobInputStreamConstructor(PIPCBlobInputStreamParent* aActor,
|
||||
const nsID& aID,
|
||||
|
|
|
@ -482,6 +482,10 @@ public:
|
|||
nsICycleCollectorLogSink* aSink,
|
||||
nsIDumpGCAndCCLogsCallback* aCallback);
|
||||
|
||||
virtual PBlobParent*
|
||||
SendPBlobConstructor(PBlobParent* aActor,
|
||||
const BlobConstructorParams& aParams) override;
|
||||
|
||||
virtual mozilla::ipc::IPCResult RecvUnregisterRemoteFrame(const TabId& aTabId,
|
||||
const ContentParentId& aCpId,
|
||||
const bool& aMarkedDestroying) override;
|
||||
|
@ -840,6 +844,11 @@ private:
|
|||
|
||||
virtual bool DeallocPBrowserParent(PBrowserParent* frame) override;
|
||||
|
||||
virtual PBlobParent*
|
||||
AllocPBlobParent(const BlobConstructorParams& aParams) override;
|
||||
|
||||
virtual bool DeallocPBlobParent(PBlobParent* aActor) override;
|
||||
|
||||
virtual PIPCBlobInputStreamParent*
|
||||
SendPIPCBlobInputStreamConstructor(PIPCBlobInputStreamParent* aActor,
|
||||
const nsID& aID,
|
||||
|
@ -852,6 +861,10 @@ private:
|
|||
virtual bool
|
||||
DeallocPIPCBlobInputStreamParent(PIPCBlobInputStreamParent* aActor) override;
|
||||
|
||||
virtual mozilla::ipc::IPCResult
|
||||
RecvPBlobConstructor(PBlobParent* aActor,
|
||||
const BlobConstructorParams& params) override;
|
||||
|
||||
virtual mozilla::ipc::IPCResult RecvNSSU2FTokenIsCompatibleVersion(const nsString& aVersion,
|
||||
bool* aIsCompatible) override;
|
||||
|
||||
|
|
|
@ -4,6 +4,8 @@
|
|||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
include protocol PBlob;
|
||||
|
||||
include IPCBlob;
|
||||
include IPCStream;
|
||||
include ProtocolTypes;
|
||||
|
@ -94,7 +96,7 @@ struct FileBlobConstructorParams
|
|||
|
||||
struct SlicedBlobConstructorParams
|
||||
{
|
||||
// broken structure: PBlob source;
|
||||
PBlob source;
|
||||
nsID id;
|
||||
uint64_t begin;
|
||||
uint64_t end;
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
include protocol PBlob;
|
||||
include protocol PColorPicker;
|
||||
include protocol PContent;
|
||||
include protocol PContentBridge;
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
include protocol PBackground;
|
||||
include protocol PBlob;
|
||||
include protocol PBrowser;
|
||||
include protocol PCompositorBridge;
|
||||
include protocol PContentBridge;
|
||||
|
@ -281,6 +282,7 @@ struct XPCOMInitData
|
|||
*/
|
||||
nested(upto inside_cpow) sync protocol PContent
|
||||
{
|
||||
manages PBlob;
|
||||
manages PBrowser;
|
||||
manages PContentPermissionRequest;
|
||||
manages PCycleCollectWithLogs;
|
||||
|
@ -337,6 +339,8 @@ both:
|
|||
IPCTabContext context, uint32_t chromeFlags,
|
||||
ContentParentId cpId, bool isForBrowser);
|
||||
|
||||
async PBlob(BlobConstructorParams params);
|
||||
|
||||
async PFileDescriptorSet(FileDescriptor fd);
|
||||
|
||||
// For parent->child, aBrowser must be non-null; aOuterWindowID can
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
||||
* You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
include protocol PBlob;
|
||||
include protocol PBrowser;
|
||||
include protocol PContent;
|
||||
include protocol PJavaScript;
|
||||
|
@ -36,6 +37,7 @@ namespace dom {
|
|||
*/
|
||||
nested(upto inside_cpow) sync protocol PContentBridge
|
||||
{
|
||||
manages PBlob;
|
||||
manages PBrowser;
|
||||
manages PFileDescriptorSet;
|
||||
manages PJavaScript;
|
||||
|
@ -74,6 +76,8 @@ both:
|
|||
IPCTabContext context, uint32_t chromeFlags,
|
||||
ContentParentId cpId, bool isForBrowser);
|
||||
|
||||
async PBlob(BlobConstructorParams params);
|
||||
|
||||
async PFileDescriptorSet(FileDescriptor fd);
|
||||
|
||||
async AsyncMessage(nsString aMessage, CpowEntry[] aCpows,
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
#include "mozilla/dom/File.h"
|
||||
#include "mozilla/dom/PermissionMessageUtils.h"
|
||||
#include "mozilla/dom/TabChild.h"
|
||||
#include "mozilla/dom/ipc/BlobChild.h"
|
||||
#include "mozilla/dom/ipc/StructuredCloneData.h"
|
||||
#include "mozilla/ipc/FileDescriptorSetChild.h"
|
||||
#include "mozilla/ipc/InputStreamUtils.h"
|
||||
|
@ -125,6 +126,43 @@ nsIContentChild::DeallocPIPCBlobInputStreamChild(PIPCBlobInputStreamChild* aActo
|
|||
return true;
|
||||
}
|
||||
|
||||
PBlobChild*
|
||||
nsIContentChild::AllocPBlobChild(const BlobConstructorParams& aParams)
|
||||
{
|
||||
return BlobChild::Create(this, aParams);
|
||||
}
|
||||
|
||||
bool
|
||||
nsIContentChild::DeallocPBlobChild(PBlobChild* aActor)
|
||||
{
|
||||
BlobChild::Destroy(aActor);
|
||||
return true;
|
||||
}
|
||||
|
||||
BlobChild*
|
||||
nsIContentChild::GetOrCreateActorForBlob(Blob* aBlob)
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
MOZ_ASSERT(aBlob);
|
||||
|
||||
RefPtr<BlobImpl> blobImpl = aBlob->Impl();
|
||||
MOZ_ASSERT(blobImpl);
|
||||
|
||||
return GetOrCreateActorForBlobImpl(blobImpl);
|
||||
}
|
||||
|
||||
BlobChild*
|
||||
nsIContentChild::GetOrCreateActorForBlobImpl(BlobImpl* aImpl)
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
MOZ_ASSERT(aImpl);
|
||||
|
||||
BlobChild* actor = BlobChild::GetOrCreate(this, aImpl);
|
||||
NS_ENSURE_TRUE(actor, nullptr);
|
||||
|
||||
return actor;
|
||||
}
|
||||
|
||||
PChildToParentStreamChild*
|
||||
nsIContentChild::AllocPChildToParentStreamChild()
|
||||
{
|
||||
|
|
|
@ -42,10 +42,12 @@ class CpowEntry;
|
|||
namespace dom {
|
||||
|
||||
class Blob;
|
||||
class BlobChild;
|
||||
class BlobImpl;
|
||||
class BlobConstructorParams;
|
||||
class ClonedMessageData;
|
||||
class IPCTabContext;
|
||||
class PBlobChild;
|
||||
class PBrowserChild;
|
||||
|
||||
class nsIContentChild : public nsISupports
|
||||
|
@ -55,6 +57,13 @@ class nsIContentChild : public nsISupports
|
|||
public:
|
||||
NS_DECLARE_STATIC_IID_ACCESSOR(NS_ICONTENTCHILD_IID)
|
||||
|
||||
BlobChild* GetOrCreateActorForBlob(Blob* aBlob);
|
||||
BlobChild* GetOrCreateActorForBlobImpl(BlobImpl* aImpl);
|
||||
|
||||
virtual PBlobChild*
|
||||
SendPBlobConstructor(PBlobChild* aActor,
|
||||
const BlobConstructorParams& aParams) = 0;
|
||||
|
||||
virtual bool
|
||||
SendPBrowserConstructor(PBrowserChild* aActor,
|
||||
const TabId& aTabId,
|
||||
|
@ -90,6 +99,10 @@ protected:
|
|||
const ContentParentId& aCpID,
|
||||
const bool& aIsForBrowse);
|
||||
|
||||
virtual PBlobChild* AllocPBlobChild(const BlobConstructorParams& aParams);
|
||||
|
||||
virtual bool DeallocPBlobChild(PBlobChild* aActor);
|
||||
|
||||
virtual mozilla::ipc::PIPCBlobInputStreamChild*
|
||||
AllocPIPCBlobInputStreamChild(const nsID& aID, const uint64_t& aSize);
|
||||
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
#include "mozilla/dom/PTabContext.h"
|
||||
#include "mozilla/dom/PermissionMessageUtils.h"
|
||||
#include "mozilla/dom/TabParent.h"
|
||||
#include "mozilla/dom/ipc/BlobParent.h"
|
||||
#include "mozilla/dom/ipc/IPCBlobInputStreamParent.h"
|
||||
#include "mozilla/dom/ipc/StructuredCloneData.h"
|
||||
#include "mozilla/jsipc/CrossProcessObjectWrappers.h"
|
||||
|
@ -204,6 +205,19 @@ nsIContentParent::DeallocPBrowserParent(PBrowserParent* aFrame)
|
|||
return true;
|
||||
}
|
||||
|
||||
PBlobParent*
|
||||
nsIContentParent::AllocPBlobParent(const BlobConstructorParams& aParams)
|
||||
{
|
||||
return BlobParent::Create(this, aParams);
|
||||
}
|
||||
|
||||
bool
|
||||
nsIContentParent::DeallocPBlobParent(PBlobParent* aActor)
|
||||
{
|
||||
BlobParent::Destroy(aActor);
|
||||
return true;
|
||||
}
|
||||
|
||||
PIPCBlobInputStreamParent*
|
||||
nsIContentParent::AllocPIPCBlobInputStreamParent(const nsID& aID,
|
||||
const uint64_t& aSize)
|
||||
|
@ -219,6 +233,30 @@ nsIContentParent::DeallocPIPCBlobInputStreamParent(PIPCBlobInputStreamParent* aA
|
|||
return true;
|
||||
}
|
||||
|
||||
BlobParent*
|
||||
nsIContentParent::GetOrCreateActorForBlob(Blob* aBlob)
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
MOZ_ASSERT(aBlob);
|
||||
|
||||
RefPtr<BlobImpl> blobImpl = aBlob->Impl();
|
||||
MOZ_ASSERT(blobImpl);
|
||||
|
||||
return GetOrCreateActorForBlobImpl(blobImpl);
|
||||
}
|
||||
|
||||
BlobParent*
|
||||
nsIContentParent::GetOrCreateActorForBlobImpl(BlobImpl* aImpl)
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
MOZ_ASSERT(aImpl);
|
||||
|
||||
BlobParent* actor = BlobParent::GetOrCreate(this, aImpl);
|
||||
NS_ENSURE_TRUE(actor, nullptr);
|
||||
|
||||
return actor;
|
||||
}
|
||||
|
||||
mozilla::ipc::IPCResult
|
||||
nsIContentParent::RecvSyncMessage(const nsString& aMsg,
|
||||
const ClonedMessageData& aData,
|
||||
|
|
|
@ -44,9 +44,11 @@ namespace dom {
|
|||
class Blob;
|
||||
class BlobConstructorParams;
|
||||
class BlobImpl;
|
||||
class BlobParent;
|
||||
class ContentParent;
|
||||
class ContentBridgeParent;
|
||||
class IPCTabContext;
|
||||
class PBlobParent;
|
||||
class PBrowserParent;
|
||||
|
||||
class nsIContentParent : public nsISupports
|
||||
|
@ -59,9 +61,16 @@ public:
|
|||
|
||||
nsIContentParent();
|
||||
|
||||
BlobParent* GetOrCreateActorForBlob(Blob* aBlob);
|
||||
BlobParent* GetOrCreateActorForBlobImpl(BlobImpl* aImpl);
|
||||
|
||||
virtual ContentParentId ChildID() const = 0;
|
||||
virtual bool IsForBrowser() const = 0;
|
||||
|
||||
MOZ_MUST_USE virtual PBlobParent*
|
||||
SendPBlobConstructor(PBlobParent* aActor,
|
||||
const BlobConstructorParams& aParams) = 0;
|
||||
|
||||
virtual mozilla::ipc::PIPCBlobInputStreamParent*
|
||||
SendPIPCBlobInputStreamConstructor(mozilla::ipc::PIPCBlobInputStreamParent* aActor,
|
||||
const nsID& aID,
|
||||
|
@ -116,6 +125,10 @@ protected: // IPDL methods
|
|||
const bool& aIsForBrowser);
|
||||
virtual bool DeallocPBrowserParent(PBrowserParent* frame);
|
||||
|
||||
virtual PBlobParent* AllocPBlobParent(const BlobConstructorParams& aParams);
|
||||
|
||||
virtual bool DeallocPBlobParent(PBlobParent* aActor);
|
||||
|
||||
virtual mozilla::ipc::PIPCBlobInputStreamParent*
|
||||
AllocPIPCBlobInputStreamParent(const nsID& aID, const uint64_t& aSize);
|
||||
|
||||
|
|
|
@ -7,6 +7,8 @@
|
|||
#include "MessagePort.h"
|
||||
#include "MessagePortChild.h"
|
||||
#include "MessagePortParent.h"
|
||||
#include "mozilla/dom/ipc/BlobChild.h"
|
||||
#include "mozilla/dom/ipc/BlobParent.h"
|
||||
#include "mozilla/dom/File.h"
|
||||
#include "mozilla/dom/PMessagePort.h"
|
||||
#include "mozilla/ipc/BackgroundChild.h"
|
||||
|
|
|
@ -20,6 +20,7 @@ namespace dom {
|
|||
class BlobImpl;
|
||||
class ContentChild;
|
||||
class ContentParent;
|
||||
class PBlobChild;
|
||||
|
||||
} // namespace dom
|
||||
|
||||
|
@ -70,6 +71,14 @@ public:
|
|||
static PBackgroundChild*
|
||||
SynchronouslyCreateForCurrentThread();
|
||||
|
||||
static mozilla::dom::PBlobChild*
|
||||
GetOrCreateActorForBlob(PBackgroundChild* aBackgroundActor,
|
||||
nsIDOMBlob* aBlob);
|
||||
|
||||
static mozilla::dom::PBlobChild*
|
||||
GetOrCreateActorForBlobImpl(PBackgroundChild* aBackgroundActor,
|
||||
mozilla::dom::BlobImpl* aBlobImpl);
|
||||
|
||||
// See above.
|
||||
static void
|
||||
CloseForCurrentThread();
|
||||
|
|
|
@ -16,12 +16,14 @@
|
|||
#include "mozilla/media/MediaChild.h"
|
||||
#include "mozilla/Assertions.h"
|
||||
#include "mozilla/SchedulerGroup.h"
|
||||
#include "mozilla/dom/PBlobChild.h"
|
||||
#include "mozilla/dom/PFileSystemRequestChild.h"
|
||||
#include "mozilla/dom/FileSystemTaskBase.h"
|
||||
#include "mozilla/dom/asmjscache/AsmJSCache.h"
|
||||
#include "mozilla/dom/cache/ActorUtils.h"
|
||||
#include "mozilla/dom/indexedDB/PBackgroundIDBFactoryChild.h"
|
||||
#include "mozilla/dom/indexedDB/PBackgroundIndexedDBUtilsChild.h"
|
||||
#include "mozilla/dom/ipc/BlobChild.h"
|
||||
#include "mozilla/dom/ipc/IPCBlobInputStreamChild.h"
|
||||
#include "mozilla/dom/ipc/PendingIPCBlobChild.h"
|
||||
#include "mozilla/dom/quota/PQuotaChild.h"
|
||||
|
@ -201,6 +203,24 @@ BackgroundChildImpl::DeallocPBackgroundIndexedDBUtilsChild(
|
|||
return true;
|
||||
}
|
||||
|
||||
auto
|
||||
BackgroundChildImpl::AllocPBlobChild(const BlobConstructorParams& aParams)
|
||||
-> PBlobChild*
|
||||
{
|
||||
MOZ_ASSERT(aParams.type() != BlobConstructorParams::T__None);
|
||||
|
||||
return mozilla::dom::BlobChild::Create(this, aParams);
|
||||
}
|
||||
|
||||
bool
|
||||
BackgroundChildImpl::DeallocPBlobChild(PBlobChild* aActor)
|
||||
{
|
||||
MOZ_ASSERT(aActor);
|
||||
|
||||
mozilla::dom::BlobChild::Destroy(aActor);
|
||||
return true;
|
||||
}
|
||||
|
||||
PPendingIPCBlobChild*
|
||||
BackgroundChildImpl::AllocPPendingIPCBlobChild(const IPCBlob& aBlob)
|
||||
{
|
||||
|
|
|
@ -70,6 +70,12 @@ protected:
|
|||
DeallocPBackgroundIndexedDBUtilsChild(PBackgroundIndexedDBUtilsChild* aActor)
|
||||
override;
|
||||
|
||||
virtual PBlobChild*
|
||||
AllocPBlobChild(const BlobConstructorParams& aParams) override;
|
||||
|
||||
virtual bool
|
||||
DeallocPBlobChild(PBlobChild* aActor) override;
|
||||
|
||||
virtual PPendingIPCBlobChild*
|
||||
AllocPPendingIPCBlobChild(const IPCBlob& aBlob) override;
|
||||
|
||||
|
|
|
@ -24,6 +24,8 @@
|
|||
#include "mozilla/dom/ContentChild.h"
|
||||
#include "mozilla/dom/ContentParent.h"
|
||||
#include "mozilla/dom/File.h"
|
||||
#include "mozilla/dom/ipc/BlobChild.h"
|
||||
#include "mozilla/dom/ipc/BlobParent.h"
|
||||
#include "mozilla/ipc/ProtocolTypes.h"
|
||||
#include "nsAutoPtr.h"
|
||||
#include "nsCOMPtr.h"
|
||||
|
@ -808,6 +810,24 @@ BackgroundParent::GetContentParent(PBackgroundParent* aBackgroundActor)
|
|||
return ParentImpl::GetContentParent(aBackgroundActor);
|
||||
}
|
||||
|
||||
// static
|
||||
PBlobParent*
|
||||
BackgroundParent::GetOrCreateActorForBlobImpl(
|
||||
PBackgroundParent* aBackgroundActor,
|
||||
BlobImpl* aBlobImpl)
|
||||
{
|
||||
AssertIsOnBackgroundThread();
|
||||
MOZ_ASSERT(aBackgroundActor);
|
||||
MOZ_ASSERT(aBlobImpl);
|
||||
|
||||
BlobParent* actor = BlobParent::GetOrCreate(aBackgroundActor, aBlobImpl);
|
||||
if (NS_WARN_IF(!actor)) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return actor;
|
||||
}
|
||||
|
||||
// static
|
||||
intptr_t
|
||||
BackgroundParent::GetRawContentParentForComparison(
|
||||
|
@ -857,6 +877,39 @@ BackgroundChild::SynchronouslyCreateForCurrentThread()
|
|||
return ChildImpl::SynchronouslyCreateForCurrentThread();
|
||||
}
|
||||
|
||||
// static
|
||||
PBlobChild*
|
||||
BackgroundChild::GetOrCreateActorForBlob(PBackgroundChild* aBackgroundActor,
|
||||
nsIDOMBlob* aBlob)
|
||||
{
|
||||
MOZ_ASSERT(aBlob);
|
||||
|
||||
RefPtr<BlobImpl> blobImpl = static_cast<Blob*>(aBlob)->Impl();
|
||||
MOZ_ASSERT(blobImpl);
|
||||
|
||||
return GetOrCreateActorForBlobImpl(aBackgroundActor, blobImpl);
|
||||
}
|
||||
|
||||
// static
|
||||
PBlobChild*
|
||||
BackgroundChild::GetOrCreateActorForBlobImpl(PBackgroundChild* aBackgroundActor,
|
||||
BlobImpl* aBlobImpl)
|
||||
{
|
||||
MOZ_ASSERT(aBackgroundActor);
|
||||
MOZ_ASSERT(aBlobImpl);
|
||||
MOZ_ASSERT(GetForCurrentThread(),
|
||||
"BackgroundChild not created on this thread yet!");
|
||||
MOZ_ASSERT(aBackgroundActor == GetForCurrentThread(),
|
||||
"BackgroundChild is bound to a different thread!");
|
||||
|
||||
BlobChild* actor = BlobChild::GetOrCreate(aBackgroundActor, aBlobImpl);
|
||||
if (NS_WARN_IF(!actor)) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return actor;
|
||||
}
|
||||
|
||||
// static
|
||||
void
|
||||
BackgroundChild::CloseForCurrentThread()
|
||||
|
|
|
@ -18,6 +18,7 @@ namespace dom {
|
|||
|
||||
class BlobImpl;
|
||||
class ContentParent;
|
||||
class PBlobParent;
|
||||
|
||||
} // namespace dom
|
||||
|
||||
|
@ -57,6 +58,10 @@ public:
|
|||
static already_AddRefed<ContentParent>
|
||||
GetContentParent(PBackgroundParent* aBackgroundActor);
|
||||
|
||||
static mozilla::dom::PBlobParent*
|
||||
GetOrCreateActorForBlobImpl(PBackgroundParent* aBackgroundActor,
|
||||
BlobImpl* aBlobImpl);
|
||||
|
||||
// Get a value that represents the ContentParent associated with the parent
|
||||
// actor for comparison. The value is not guaranteed to uniquely identify the
|
||||
// ContentParent after the ContentParent has died. This function may only be
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
#include "mozilla/dom/FileSystemRequestParent.h"
|
||||
#include "mozilla/dom/GamepadEventChannelParent.h"
|
||||
#include "mozilla/dom/GamepadTestChannelParent.h"
|
||||
#include "mozilla/dom/PBlobParent.h"
|
||||
#include "mozilla/dom/PGamepadEventChannelParent.h"
|
||||
#include "mozilla/dom/PGamepadTestChannelParent.h"
|
||||
#include "mozilla/dom/MessagePortParent.h"
|
||||
|
@ -26,6 +27,7 @@
|
|||
#include "mozilla/dom/asmjscache/AsmJSCache.h"
|
||||
#include "mozilla/dom/cache/ActorUtils.h"
|
||||
#include "mozilla/dom/indexedDB/ActorsParent.h"
|
||||
#include "mozilla/dom/ipc/BlobParent.h"
|
||||
#include "mozilla/dom/ipc/IPCBlobInputStreamParent.h"
|
||||
#include "mozilla/dom/ipc/PendingIPCBlobParent.h"
|
||||
#include "mozilla/dom/quota/ActorsParent.h"
|
||||
|
@ -241,6 +243,33 @@ BackgroundParentImpl::RecvFlushPendingFileDeletions()
|
|||
return IPC_OK();
|
||||
}
|
||||
|
||||
auto
|
||||
BackgroundParentImpl::AllocPBlobParent(const BlobConstructorParams& aParams)
|
||||
-> PBlobParent*
|
||||
{
|
||||
AssertIsInMainProcess();
|
||||
AssertIsOnBackgroundThread();
|
||||
|
||||
if (NS_WARN_IF(aParams.type() !=
|
||||
BlobConstructorParams::TParentBlobConstructorParams)) {
|
||||
ASSERT_UNLESS_FUZZING();
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return mozilla::dom::BlobParent::Create(this, aParams);
|
||||
}
|
||||
|
||||
bool
|
||||
BackgroundParentImpl::DeallocPBlobParent(PBlobParent* aActor)
|
||||
{
|
||||
AssertIsInMainProcess();
|
||||
AssertIsOnBackgroundThread();
|
||||
MOZ_ASSERT(aActor);
|
||||
|
||||
mozilla::dom::BlobParent::Destroy(aActor);
|
||||
return true;
|
||||
}
|
||||
|
||||
PPendingIPCBlobParent*
|
||||
BackgroundParentImpl::AllocPPendingIPCBlobParent(const IPCBlob& aBlob)
|
||||
{
|
||||
|
@ -276,6 +305,21 @@ BackgroundParentImpl::DeallocPIPCBlobInputStreamParent(PIPCBlobInputStreamParent
|
|||
return true;
|
||||
}
|
||||
|
||||
mozilla::ipc::IPCResult
|
||||
BackgroundParentImpl::RecvPBlobConstructor(PBlobParent* aActor,
|
||||
const BlobConstructorParams& aParams)
|
||||
{
|
||||
const ParentBlobConstructorParams& params = aParams;
|
||||
if (params.blobParams().type() == AnyBlobConstructorParams::TKnownBlobConstructorParams) {
|
||||
if (!aActor->SendCreatedFromKnownBlob()) {
|
||||
return IPC_FAIL_NO_REASON(this);
|
||||
}
|
||||
return IPC_OK();
|
||||
}
|
||||
|
||||
return IPC_OK();
|
||||
}
|
||||
|
||||
PFileDescriptorSetParent*
|
||||
BackgroundParentImpl::AllocPFileDescriptorSetParent(
|
||||
const FileDescriptor& aFileDescriptor)
|
||||
|
|
|
@ -63,6 +63,12 @@ protected:
|
|||
virtual mozilla::ipc::IPCResult
|
||||
RecvFlushPendingFileDeletions() override;
|
||||
|
||||
virtual PBlobParent*
|
||||
AllocPBlobParent(const BlobConstructorParams& aParams) override;
|
||||
|
||||
virtual bool
|
||||
DeallocPBlobParent(PBlobParent* aActor) override;
|
||||
|
||||
virtual PPendingIPCBlobParent*
|
||||
AllocPPendingIPCBlobParent(const IPCBlob& aBlob) override;
|
||||
|
||||
|
@ -76,6 +82,10 @@ protected:
|
|||
virtual bool
|
||||
DeallocPIPCBlobInputStreamParent(PIPCBlobInputStreamParent* aActor) override;
|
||||
|
||||
virtual mozilla::ipc::IPCResult
|
||||
RecvPBlobConstructor(PBlobParent* aActor,
|
||||
const BlobConstructorParams& params) override;
|
||||
|
||||
virtual PFileDescriptorSetParent*
|
||||
AllocPFileDescriptorSetParent(const FileDescriptor& aFileDescriptor)
|
||||
override;
|
||||
|
|
|
@ -10,6 +10,8 @@
|
|||
|
||||
#include "mozilla/Assertions.h"
|
||||
#include "mozilla/dom/File.h"
|
||||
#include "mozilla/dom/ipc/BlobChild.h"
|
||||
#include "mozilla/dom/ipc/BlobParent.h"
|
||||
#include "mozilla/dom/ipc/IPCBlobInputStream.h"
|
||||
#include "mozilla/dom/ipc/IPCBlobInputStreamStorage.h"
|
||||
#include "nsComponentManagerUtils.h"
|
||||
|
@ -101,9 +103,28 @@ InputStreamHelper::DeserializeInputStream(const InputStreamParams& aParams,
|
|||
|
||||
// When the input stream already exists in this process, all we need to do
|
||||
// is retrieve the original instead of sending any data over the wire.
|
||||
case InputStreamParams::TRemoteInputStreamParams:
|
||||
// Thi is broken!
|
||||
return nullptr;
|
||||
case InputStreamParams::TRemoteInputStreamParams: {
|
||||
if (NS_WARN_IF(!XRE_IsParentProcess())) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
const nsID& id = aParams.get_RemoteInputStreamParams().id();
|
||||
|
||||
RefPtr<BlobImpl> blobImpl = BlobParent::GetBlobImplForID(id);
|
||||
|
||||
MOZ_ASSERT(blobImpl, "Invalid blob contents");
|
||||
|
||||
// If fetching the internal stream fails, we ignore it and return a
|
||||
// null stream.
|
||||
ErrorResult rv;
|
||||
nsCOMPtr<nsIInputStream> stream;
|
||||
blobImpl->GetInternalStream(getter_AddRefs(stream), rv);
|
||||
if (NS_WARN_IF(rv.Failed()) || !stream) {
|
||||
NS_WARNING("Couldn't obtain a valid stream from the blob");
|
||||
rv.SuppressException();
|
||||
}
|
||||
return stream.forget();
|
||||
}
|
||||
|
||||
case InputStreamParams::TSameProcessInputStreamParams: {
|
||||
MOZ_ASSERT(aFileDescriptors.IsEmpty());
|
||||
|
|
|
@ -6,6 +6,7 @@ include protocol PAsmJSCacheEntry;
|
|||
include protocol PBackgroundIDBFactory;
|
||||
include protocol PBackgroundIndexedDBUtils;
|
||||
include protocol PBackgroundTest;
|
||||
include protocol PBlob;
|
||||
include protocol PBroadcastChannel;
|
||||
include protocol PCache;
|
||||
include protocol PCacheStorage;
|
||||
|
@ -53,6 +54,7 @@ sync protocol PBackground
|
|||
manages PBackgroundIDBFactory;
|
||||
manages PBackgroundIndexedDBUtils;
|
||||
manages PBackgroundTest;
|
||||
manages PBlob;
|
||||
manages PBroadcastChannel;
|
||||
manages PCache;
|
||||
manages PCacheStorage;
|
||||
|
@ -128,6 +130,8 @@ child:
|
|||
async PPendingIPCBlob(IPCBlob blob);
|
||||
|
||||
both:
|
||||
async PBlob(BlobConstructorParams params);
|
||||
|
||||
async PFileDescriptorSet(FileDescriptor fd);
|
||||
};
|
||||
|
||||
|
|
|
@ -807,6 +807,12 @@ description =
|
|||
# The rest
|
||||
[PHeapSnapshotTempFileHelper::OpenHeapSnapshotTempFile]
|
||||
description =
|
||||
[PBlob::WaitForSliceCreation]
|
||||
description =
|
||||
[PBlob::GetFileId]
|
||||
description =
|
||||
[PBlob::GetFilePath]
|
||||
description =
|
||||
[PBackgroundMutableFile::GetFileId]
|
||||
description =
|
||||
[PBackgroundIndexedDBUtils::GetFileReferences]
|
||||
|
|
Загрузка…
Ссылка в новой задаче