forked from mirrors/gecko-dev
Bug 1264642 - Part 6. Mark JSStructuredCloneData as MOZ_NON_MEMMOVABLE and add specializations in nsTArray.h. r=froydnj
MozReview-Commit-ID: HltgzBnxMsn
This commit is contained in:
parent
0dbfe2dbcc
commit
b4cf4bec61
11 changed files with 81 additions and 27 deletions
|
|
@ -36,6 +36,8 @@ public:
|
||||||
StructuredCloneHolderBase(StructuredCloneScope aScope = StructuredCloneScope::SameProcessSameThread);
|
StructuredCloneHolderBase(StructuredCloneScope aScope = StructuredCloneScope::SameProcessSameThread);
|
||||||
virtual ~StructuredCloneHolderBase();
|
virtual ~StructuredCloneHolderBase();
|
||||||
|
|
||||||
|
StructuredCloneHolderBase(StructuredCloneHolderBase&& aOther) = default;
|
||||||
|
|
||||||
// These methods should be implemented in order to clone data.
|
// These methods should be implemented in order to clone data.
|
||||||
// Read more documentation in js/public/StructuredClone.h.
|
// Read more documentation in js/public/StructuredClone.h.
|
||||||
|
|
||||||
|
|
@ -150,6 +152,8 @@ public:
|
||||||
StructuredCloneScope aStructuredCloneScope);
|
StructuredCloneScope aStructuredCloneScope);
|
||||||
virtual ~StructuredCloneHolder();
|
virtual ~StructuredCloneHolder();
|
||||||
|
|
||||||
|
StructuredCloneHolder(StructuredCloneHolder&& aOther) = default;
|
||||||
|
|
||||||
// Normally you should just use Write() and Read().
|
// Normally you should just use Write() and Read().
|
||||||
|
|
||||||
void Write(JSContext* aCx,
|
void Write(JSContext* aCx,
|
||||||
|
|
|
||||||
|
|
@ -57,6 +57,10 @@ struct StructuredCloneReadInfo
|
||||||
inline
|
inline
|
||||||
~StructuredCloneReadInfo();
|
~StructuredCloneReadInfo();
|
||||||
|
|
||||||
|
// In IndexedDatabaseInlines.h
|
||||||
|
inline
|
||||||
|
StructuredCloneReadInfo(StructuredCloneReadInfo&& aOther);
|
||||||
|
|
||||||
// In IndexedDatabaseInlines.h
|
// In IndexedDatabaseInlines.h
|
||||||
inline StructuredCloneReadInfo&
|
inline StructuredCloneReadInfo&
|
||||||
operator=(StructuredCloneReadInfo&& aOther);
|
operator=(StructuredCloneReadInfo&& aOther);
|
||||||
|
|
|
||||||
|
|
@ -51,6 +51,20 @@ StructuredCloneReadInfo::StructuredCloneReadInfo()
|
||||||
MOZ_COUNT_CTOR(StructuredCloneReadInfo);
|
MOZ_COUNT_CTOR(StructuredCloneReadInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline
|
||||||
|
StructuredCloneReadInfo::StructuredCloneReadInfo(
|
||||||
|
StructuredCloneReadInfo&& aCloneReadInfo)
|
||||||
|
: mData(Move(aCloneReadInfo.mData))
|
||||||
|
{
|
||||||
|
MOZ_ASSERT(&aCloneReadInfo != this);
|
||||||
|
MOZ_COUNT_CTOR(StructuredCloneReadInfo);
|
||||||
|
|
||||||
|
mFiles.Clear();
|
||||||
|
mFiles.SwapElements(aCloneReadInfo.mFiles);
|
||||||
|
mDatabase = aCloneReadInfo.mDatabase;
|
||||||
|
aCloneReadInfo.mDatabase = nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
inline
|
inline
|
||||||
StructuredCloneReadInfo::StructuredCloneReadInfo(
|
StructuredCloneReadInfo::StructuredCloneReadInfo(
|
||||||
SerializedStructuredCloneReadInfo&& aCloneReadInfo)
|
SerializedStructuredCloneReadInfo&& aCloneReadInfo)
|
||||||
|
|
|
||||||
|
|
@ -65,7 +65,8 @@ using mozilla::WritingMode from "mozilla/WritingModes.h";
|
||||||
using mozilla::layers::TouchBehaviorFlags from "mozilla/layers/APZUtils.h";
|
using mozilla::layers::TouchBehaviorFlags from "mozilla/layers/APZUtils.h";
|
||||||
using nsIWidget::TouchPointerState from "nsIWidget.h";
|
using nsIWidget::TouchPointerState from "nsIWidget.h";
|
||||||
using struct LookAndFeelInt from "mozilla/widget/WidgetMessageUtils.h";
|
using struct LookAndFeelInt from "mozilla/widget/WidgetMessageUtils.h";
|
||||||
using class mozilla::dom::ipc::StructuredCloneData from "ipc/IPCMessageUtils.h";
|
using class mozilla::dom::MessagePort from "mozilla/dom/MessagePort.h";
|
||||||
|
using class mozilla::dom::ipc::StructuredCloneData from "mozilla/dom/ipc/StructuredCloneData.h";
|
||||||
using mozilla::EventMessage from "mozilla/EventForwards.h";
|
using mozilla::EventMessage from "mozilla/EventForwards.h";
|
||||||
using nsEventStatus from "mozilla/EventForwards.h";
|
using nsEventStatus from "mozilla/EventForwards.h";
|
||||||
using nsSizeMode from "nsIWidgetListener.h";
|
using nsSizeMode from "nsIWidgetListener.h";
|
||||||
|
|
|
||||||
|
|
@ -95,7 +95,8 @@ using mozilla::dom::TabId from "mozilla/dom/ipc/IdType.h";
|
||||||
using mozilla::dom::ContentParentId from "mozilla/dom/ipc/IdType.h";
|
using mozilla::dom::ContentParentId from "mozilla/dom/ipc/IdType.h";
|
||||||
using mozilla::LayoutDeviceIntPoint from "Units.h";
|
using mozilla::LayoutDeviceIntPoint from "Units.h";
|
||||||
using struct LookAndFeelInt from "mozilla/widget/WidgetMessageUtils.h";
|
using struct LookAndFeelInt from "mozilla/widget/WidgetMessageUtils.h";
|
||||||
using class mozilla::dom::ipc::StructuredCloneData from "ipc/IPCMessageUtils.h";
|
using class mozilla::dom::MessagePort from "mozilla/dom/MessagePort.h";
|
||||||
|
using class mozilla::dom::ipc::StructuredCloneData from "mozilla/dom/ipc/StructuredCloneData.h";
|
||||||
using mozilla::DataStorageType from "ipc/DataStorageIPCUtils.h";
|
using mozilla::DataStorageType from "ipc/DataStorageIPCUtils.h";
|
||||||
using mozilla::DocShellOriginAttributes from "mozilla/ipc/BackgroundUtils.h";
|
using mozilla::DocShellOriginAttributes from "mozilla/ipc/BackgroundUtils.h";
|
||||||
using struct mozilla::layers::TextureFactoryIdentifier from "mozilla/layers/CompositorTypes.h";
|
using struct mozilla::layers::TextureFactoryIdentifier from "mozilla/layers/CompositorTypes.h";
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,8 @@ include PTabContext;
|
||||||
using class IPC::Principal from "mozilla/dom/PermissionMessageUtils.h";
|
using class IPC::Principal from "mozilla/dom/PermissionMessageUtils.h";
|
||||||
using mozilla::dom::TabId from "mozilla/dom/ipc/IdType.h";
|
using mozilla::dom::TabId from "mozilla/dom/ipc/IdType.h";
|
||||||
using mozilla::dom::ContentParentId from "mozilla/dom/ipc/IdType.h";
|
using mozilla::dom::ContentParentId from "mozilla/dom/ipc/IdType.h";
|
||||||
using class mozilla::dom::ipc::StructuredCloneData from "ipc/IPCMessageUtils.h";
|
using class mozilla::dom::MessagePort from "mozilla/dom/MessagePort.h";
|
||||||
|
using class mozilla::dom::ipc::StructuredCloneData from "mozilla/dom/ipc/StructuredCloneData.h";
|
||||||
|
|
||||||
namespace mozilla {
|
namespace mozilla {
|
||||||
namespace dom {
|
namespace dom {
|
||||||
|
|
|
||||||
|
|
@ -75,12 +75,17 @@ public:
|
||||||
|
|
||||||
StructuredCloneData(const StructuredCloneData&) = delete;
|
StructuredCloneData(const StructuredCloneData&) = delete;
|
||||||
|
|
||||||
|
StructuredCloneData(StructuredCloneData&& aOther) = default;
|
||||||
|
|
||||||
~StructuredCloneData()
|
~StructuredCloneData()
|
||||||
{}
|
{}
|
||||||
|
|
||||||
StructuredCloneData&
|
StructuredCloneData&
|
||||||
operator=(const StructuredCloneData& aOther) = delete;
|
operator=(const StructuredCloneData& aOther) = delete;
|
||||||
|
|
||||||
|
StructuredCloneData&
|
||||||
|
operator=(StructuredCloneData&& aOther) = default;
|
||||||
|
|
||||||
const nsTArray<RefPtr<BlobImpl>>& BlobImpls() const
|
const nsTArray<RefPtr<BlobImpl>>& BlobImpls() const
|
||||||
{
|
{
|
||||||
return mBlobImplArray;
|
return mBlobImplArray;
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,7 @@
|
||||||
#ifndef mozilla_dom_TCPSocketChild_h
|
#ifndef mozilla_dom_TCPSocketChild_h
|
||||||
#define mozilla_dom_TCPSocketChild_h
|
#define mozilla_dom_TCPSocketChild_h
|
||||||
|
|
||||||
|
#include "mozilla/dom/TypedArray.h"
|
||||||
#include "mozilla/net/PTCPSocketChild.h"
|
#include "mozilla/net/PTCPSocketChild.h"
|
||||||
#include "nsCycleCollectionParticipant.h"
|
#include "nsCycleCollectionParticipant.h"
|
||||||
#include "nsCOMPtr.h"
|
#include "nsCOMPtr.h"
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,7 @@
|
||||||
#ifndef js_StructuredClone_h
|
#ifndef js_StructuredClone_h
|
||||||
#define js_StructuredClone_h
|
#define js_StructuredClone_h
|
||||||
|
|
||||||
|
#include "mozilla/Attributes.h"
|
||||||
#include "mozilla/BufferList.h"
|
#include "mozilla/BufferList.h"
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
@ -160,7 +161,7 @@ enum OwnTransferablePolicy {
|
||||||
NoTransferables
|
NoTransferables
|
||||||
};
|
};
|
||||||
|
|
||||||
class JSStructuredCloneData : public mozilla::BufferList<js::SystemAllocPolicy>
|
class MOZ_NON_MEMMOVABLE JSStructuredCloneData : public mozilla::BufferList<js::SystemAllocPolicy>
|
||||||
{
|
{
|
||||||
typedef js::SystemAllocPolicy AllocPolicy;
|
typedef js::SystemAllocPolicy AllocPolicy;
|
||||||
typedef mozilla::BufferList<js::SystemAllocPolicy> BufferList;
|
typedef mozilla::BufferList<js::SystemAllocPolicy> BufferList;
|
||||||
|
|
|
||||||
|
|
@ -135,12 +135,6 @@ nrappkit copyright:
|
||||||
#endif
|
#endif
|
||||||
#undef strlcpy
|
#undef strlcpy
|
||||||
|
|
||||||
// TCPSocketChild.h doesn't include TypedArray.h
|
|
||||||
namespace mozilla {
|
|
||||||
namespace dom {
|
|
||||||
class ArrayBuffer;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#include "mozilla/dom/network/TCPSocketChild.h"
|
#include "mozilla/dom/network/TCPSocketChild.h"
|
||||||
|
|
||||||
#ifdef LOG_TEMP_INFO
|
#ifdef LOG_TEMP_INFO
|
||||||
|
|
|
||||||
|
|
@ -43,6 +43,33 @@ namespace layers {
|
||||||
struct TileClient;
|
struct TileClient;
|
||||||
} // namespace layers
|
} // namespace layers
|
||||||
} // namespace mozilla
|
} // namespace mozilla
|
||||||
|
|
||||||
|
namespace mozilla {
|
||||||
|
struct SerializedStructuredCloneBuffer;
|
||||||
|
} // namespace mozilla
|
||||||
|
|
||||||
|
namespace mozilla {
|
||||||
|
namespace dom {
|
||||||
|
namespace ipc {
|
||||||
|
class StructuredCloneData;
|
||||||
|
} // namespace ipc
|
||||||
|
} // namespace dom
|
||||||
|
} // namespace mozilla
|
||||||
|
|
||||||
|
namespace mozilla {
|
||||||
|
namespace dom {
|
||||||
|
class ClonedMessageData;
|
||||||
|
class MessagePortMessage;
|
||||||
|
namespace indexedDB {
|
||||||
|
struct StructuredCloneReadInfo;
|
||||||
|
class SerializedStructuredCloneReadInfo;
|
||||||
|
class ObjectStoreCursorResponse;
|
||||||
|
} // namespace indexedDB
|
||||||
|
} // namespace dom
|
||||||
|
} // namespace mozilla
|
||||||
|
|
||||||
|
class JSStructuredCloneData;
|
||||||
|
|
||||||
//
|
//
|
||||||
// nsTArray is a resizable array class, like std::vector.
|
// nsTArray is a resizable array class, like std::vector.
|
||||||
//
|
//
|
||||||
|
|
@ -685,29 +712,30 @@ struct MOZ_NEEDS_MEMMOVABLE_TYPE nsTArray_CopyChooser
|
||||||
// Some classes require constructors/destructors to be called, so they are
|
// Some classes require constructors/destructors to be called, so they are
|
||||||
// specialized here.
|
// specialized here.
|
||||||
//
|
//
|
||||||
|
#define DECLARE_USE_COPY_CONSTRUCTORS(T) \
|
||||||
|
template<> \
|
||||||
|
struct nsTArray_CopyChooser<T> \
|
||||||
|
{ \
|
||||||
|
typedef nsTArray_CopyWithConstructors<T> Type; \
|
||||||
|
};
|
||||||
|
|
||||||
template<class E>
|
template<class E>
|
||||||
struct nsTArray_CopyChooser<JS::Heap<E>>
|
struct nsTArray_CopyChooser<JS::Heap<E>>
|
||||||
{
|
{
|
||||||
typedef nsTArray_CopyWithConstructors<JS::Heap<E>> Type;
|
typedef nsTArray_CopyWithConstructors<JS::Heap<E>> Type;
|
||||||
};
|
};
|
||||||
|
|
||||||
template<>
|
DECLARE_USE_COPY_CONSTRUCTORS(nsRegion)
|
||||||
struct nsTArray_CopyChooser<nsRegion>
|
DECLARE_USE_COPY_CONSTRUCTORS(nsIntRegion)
|
||||||
{
|
DECLARE_USE_COPY_CONSTRUCTORS(mozilla::layers::TileClient)
|
||||||
typedef nsTArray_CopyWithConstructors<nsRegion> Type;
|
DECLARE_USE_COPY_CONSTRUCTORS(mozilla::SerializedStructuredCloneBuffer)
|
||||||
};
|
DECLARE_USE_COPY_CONSTRUCTORS(mozilla::dom::ipc::StructuredCloneData)
|
||||||
|
DECLARE_USE_COPY_CONSTRUCTORS(mozilla::dom::ClonedMessageData)
|
||||||
template<>
|
DECLARE_USE_COPY_CONSTRUCTORS(mozilla::dom::indexedDB::StructuredCloneReadInfo);
|
||||||
struct nsTArray_CopyChooser<nsIntRegion>
|
DECLARE_USE_COPY_CONSTRUCTORS(mozilla::dom::indexedDB::ObjectStoreCursorResponse)
|
||||||
{
|
DECLARE_USE_COPY_CONSTRUCTORS(mozilla::dom::indexedDB::SerializedStructuredCloneReadInfo);
|
||||||
typedef nsTArray_CopyWithConstructors<nsIntRegion> Type;
|
DECLARE_USE_COPY_CONSTRUCTORS(JSStructuredCloneData)
|
||||||
};
|
DECLARE_USE_COPY_CONSTRUCTORS(mozilla::dom::MessagePortMessage)
|
||||||
|
|
||||||
template<>
|
|
||||||
struct nsTArray_CopyChooser<mozilla::layers::TileClient>
|
|
||||||
{
|
|
||||||
typedef nsTArray_CopyWithConstructors<mozilla::layers::TileClient> Type;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue