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);
|
||||
virtual ~StructuredCloneHolderBase();
|
||||
|
||||
StructuredCloneHolderBase(StructuredCloneHolderBase&& aOther) = default;
|
||||
|
||||
// These methods should be implemented in order to clone data.
|
||||
// Read more documentation in js/public/StructuredClone.h.
|
||||
|
||||
|
|
@ -150,6 +152,8 @@ public:
|
|||
StructuredCloneScope aStructuredCloneScope);
|
||||
virtual ~StructuredCloneHolder();
|
||||
|
||||
StructuredCloneHolder(StructuredCloneHolder&& aOther) = default;
|
||||
|
||||
// Normally you should just use Write() and Read().
|
||||
|
||||
void Write(JSContext* aCx,
|
||||
|
|
|
|||
|
|
@ -57,6 +57,10 @@ struct StructuredCloneReadInfo
|
|||
inline
|
||||
~StructuredCloneReadInfo();
|
||||
|
||||
// In IndexedDatabaseInlines.h
|
||||
inline
|
||||
StructuredCloneReadInfo(StructuredCloneReadInfo&& aOther);
|
||||
|
||||
// In IndexedDatabaseInlines.h
|
||||
inline StructuredCloneReadInfo&
|
||||
operator=(StructuredCloneReadInfo&& aOther);
|
||||
|
|
|
|||
|
|
@ -51,6 +51,20 @@ StructuredCloneReadInfo::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
|
||||
StructuredCloneReadInfo::StructuredCloneReadInfo(
|
||||
SerializedStructuredCloneReadInfo&& aCloneReadInfo)
|
||||
|
|
|
|||
|
|
@ -65,7 +65,8 @@ using mozilla::WritingMode from "mozilla/WritingModes.h";
|
|||
using mozilla::layers::TouchBehaviorFlags from "mozilla/layers/APZUtils.h";
|
||||
using nsIWidget::TouchPointerState from "nsIWidget.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 nsEventStatus from "mozilla/EventForwards.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::LayoutDeviceIntPoint from "Units.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::DocShellOriginAttributes from "mozilla/ipc/BackgroundUtils.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 mozilla::dom::TabId 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 dom {
|
||||
|
|
|
|||
|
|
@ -75,12 +75,17 @@ public:
|
|||
|
||||
StructuredCloneData(const StructuredCloneData&) = delete;
|
||||
|
||||
StructuredCloneData(StructuredCloneData&& aOther) = default;
|
||||
|
||||
~StructuredCloneData()
|
||||
{}
|
||||
|
||||
StructuredCloneData&
|
||||
operator=(const StructuredCloneData& aOther) = delete;
|
||||
|
||||
StructuredCloneData&
|
||||
operator=(StructuredCloneData&& aOther) = default;
|
||||
|
||||
const nsTArray<RefPtr<BlobImpl>>& BlobImpls() const
|
||||
{
|
||||
return mBlobImplArray;
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@
|
|||
#ifndef mozilla_dom_TCPSocketChild_h
|
||||
#define mozilla_dom_TCPSocketChild_h
|
||||
|
||||
#include "mozilla/dom/TypedArray.h"
|
||||
#include "mozilla/net/PTCPSocketChild.h"
|
||||
#include "nsCycleCollectionParticipant.h"
|
||||
#include "nsCOMPtr.h"
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@
|
|||
#ifndef js_StructuredClone_h
|
||||
#define js_StructuredClone_h
|
||||
|
||||
#include "mozilla/Attributes.h"
|
||||
#include "mozilla/BufferList.h"
|
||||
|
||||
#include <stdint.h>
|
||||
|
|
@ -160,7 +161,7 @@ enum OwnTransferablePolicy {
|
|||
NoTransferables
|
||||
};
|
||||
|
||||
class JSStructuredCloneData : public mozilla::BufferList<js::SystemAllocPolicy>
|
||||
class MOZ_NON_MEMMOVABLE JSStructuredCloneData : public mozilla::BufferList<js::SystemAllocPolicy>
|
||||
{
|
||||
typedef js::SystemAllocPolicy AllocPolicy;
|
||||
typedef mozilla::BufferList<js::SystemAllocPolicy> BufferList;
|
||||
|
|
|
|||
|
|
@ -135,12 +135,6 @@ nrappkit copyright:
|
|||
#endif
|
||||
#undef strlcpy
|
||||
|
||||
// TCPSocketChild.h doesn't include TypedArray.h
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
class ArrayBuffer;
|
||||
}
|
||||
}
|
||||
#include "mozilla/dom/network/TCPSocketChild.h"
|
||||
|
||||
#ifdef LOG_TEMP_INFO
|
||||
|
|
|
|||
|
|
@ -43,6 +43,33 @@ namespace layers {
|
|||
struct TileClient;
|
||||
} // namespace layers
|
||||
} // 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.
|
||||
//
|
||||
|
|
@ -685,29 +712,30 @@ struct MOZ_NEEDS_MEMMOVABLE_TYPE nsTArray_CopyChooser
|
|||
// Some classes require constructors/destructors to be called, so they are
|
||||
// specialized here.
|
||||
//
|
||||
#define DECLARE_USE_COPY_CONSTRUCTORS(T) \
|
||||
template<> \
|
||||
struct nsTArray_CopyChooser<T> \
|
||||
{ \
|
||||
typedef nsTArray_CopyWithConstructors<T> Type; \
|
||||
};
|
||||
|
||||
template<class E>
|
||||
struct nsTArray_CopyChooser<JS::Heap<E>>
|
||||
{
|
||||
typedef nsTArray_CopyWithConstructors<JS::Heap<E>> Type;
|
||||
};
|
||||
|
||||
template<>
|
||||
struct nsTArray_CopyChooser<nsRegion>
|
||||
{
|
||||
typedef nsTArray_CopyWithConstructors<nsRegion> Type;
|
||||
};
|
||||
|
||||
template<>
|
||||
struct nsTArray_CopyChooser<nsIntRegion>
|
||||
{
|
||||
typedef nsTArray_CopyWithConstructors<nsIntRegion> Type;
|
||||
};
|
||||
|
||||
template<>
|
||||
struct nsTArray_CopyChooser<mozilla::layers::TileClient>
|
||||
{
|
||||
typedef nsTArray_CopyWithConstructors<mozilla::layers::TileClient> Type;
|
||||
};
|
||||
DECLARE_USE_COPY_CONSTRUCTORS(nsRegion)
|
||||
DECLARE_USE_COPY_CONSTRUCTORS(nsIntRegion)
|
||||
DECLARE_USE_COPY_CONSTRUCTORS(mozilla::layers::TileClient)
|
||||
DECLARE_USE_COPY_CONSTRUCTORS(mozilla::SerializedStructuredCloneBuffer)
|
||||
DECLARE_USE_COPY_CONSTRUCTORS(mozilla::dom::ipc::StructuredCloneData)
|
||||
DECLARE_USE_COPY_CONSTRUCTORS(mozilla::dom::ClonedMessageData)
|
||||
DECLARE_USE_COPY_CONSTRUCTORS(mozilla::dom::indexedDB::StructuredCloneReadInfo);
|
||||
DECLARE_USE_COPY_CONSTRUCTORS(mozilla::dom::indexedDB::ObjectStoreCursorResponse)
|
||||
DECLARE_USE_COPY_CONSTRUCTORS(mozilla::dom::indexedDB::SerializedStructuredCloneReadInfo);
|
||||
DECLARE_USE_COPY_CONSTRUCTORS(JSStructuredCloneData)
|
||||
DECLARE_USE_COPY_CONSTRUCTORS(mozilla::dom::MessagePortMessage)
|
||||
|
||||
|
||||
//
|
||||
|
|
|
|||
Loading…
Reference in a new issue