2017-10-27 01:08:41 +03:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
2015-06-17 13:44:27 +03:00
|
|
|
/* 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_SharedMessagePortMessage_h
|
|
|
|
#define mozilla_dom_SharedMessagePortMessage_h
|
|
|
|
|
2016-11-08 12:50:51 +03:00
|
|
|
#include "mozilla/dom/ipc/StructuredCloneData.h"
|
2015-06-17 13:44:27 +03:00
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
namespace dom {
|
|
|
|
|
|
|
|
class MessagePortChild;
|
|
|
|
class MessagePortMessage;
|
|
|
|
class MessagePortParent;
|
|
|
|
|
2016-11-08 12:50:51 +03:00
|
|
|
class SharedMessagePortMessage final : public ipc::StructuredCloneData {
|
2015-06-17 13:44:27 +03:00
|
|
|
public:
|
|
|
|
NS_INLINE_DECL_REFCOUNTING(SharedMessagePortMessage)
|
|
|
|
|
2016-11-08 12:50:51 +03:00
|
|
|
SharedMessagePortMessage() : ipc::StructuredCloneData() {}
|
2015-06-17 13:44:27 +03:00
|
|
|
|
2016-11-08 12:50:51 +03:00
|
|
|
// Note that the populated ClonedMessageData borrows the underlying
|
|
|
|
// JSStructuredCloneData from the SharedMessagePortMessage, so the caller is
|
|
|
|
// required to ensure that the ClonedMessageData instances are destroyed prior
|
|
|
|
// to the SharedMessagePortMessage instances.
|
2015-06-17 13:44:27 +03:00
|
|
|
static void FromSharedToMessagesChild(
|
|
|
|
MessagePortChild* aActor,
|
2015-10-18 08:24:48 +03:00
|
|
|
const nsTArray<RefPtr<SharedMessagePortMessage>>& aData,
|
2016-11-08 12:50:51 +03:00
|
|
|
nsTArray<ClonedMessageData>& aArray);
|
2015-06-17 13:44:27 +03:00
|
|
|
|
|
|
|
static bool FromMessagesToSharedChild(
|
2016-11-08 12:50:51 +03:00
|
|
|
nsTArray<ClonedMessageData>& aArray,
|
2015-10-18 08:24:48 +03:00
|
|
|
FallibleTArray<RefPtr<SharedMessagePortMessage>>& aData);
|
2015-06-17 13:44:27 +03:00
|
|
|
|
2016-11-08 12:50:51 +03:00
|
|
|
// Note that the populated ClonedMessageData borrows the underlying
|
|
|
|
// JSStructuredCloneData from the SharedMessagePortMessage, so the caller is
|
|
|
|
// required to ensure that the ClonedMessageData instances are destroyed prior
|
|
|
|
// to the SharedMessagePortMessage instances.
|
2015-06-17 13:44:27 +03:00
|
|
|
static bool FromSharedToMessagesParent(
|
|
|
|
MessagePortParent* aActor,
|
2015-10-18 08:24:48 +03:00
|
|
|
const nsTArray<RefPtr<SharedMessagePortMessage>>& aData,
|
2016-11-08 12:50:51 +03:00
|
|
|
FallibleTArray<ClonedMessageData>& aArray);
|
2015-06-17 13:44:27 +03:00
|
|
|
|
|
|
|
static bool FromMessagesToSharedParent(
|
2016-11-08 12:50:51 +03:00
|
|
|
nsTArray<ClonedMessageData>& aArray,
|
2015-10-18 08:24:48 +03:00
|
|
|
FallibleTArray<RefPtr<SharedMessagePortMessage>>& aData);
|
2015-06-17 13:44:27 +03:00
|
|
|
|
|
|
|
private:
|
2016-04-22 13:04:20 +03:00
|
|
|
~SharedMessagePortMessage() {}
|
2015-06-17 13:44:27 +03:00
|
|
|
};
|
|
|
|
|
2015-07-13 18:25:42 +03:00
|
|
|
} // namespace dom
|
|
|
|
} // namespace mozilla
|
2015-06-17 13:44:27 +03:00
|
|
|
|
|
|
|
#endif // mozilla_dom_SharedMessagePortMessage_h
|