Files
palemoon27/dom/messagechannel/SharedMessagePortMessage.h
T
roytam1 88786f232f import changes from `dev' branch of rmottola/Arctic-Fox:
- Bug 1044102 - Part 0 - Test cases. r=smaug. (e588558b1)
- Bug 1044102 - Part 1 - Implement ImageBitmap. r=roc, sr=smaug (17702ab3c)
- Bug 1044102 - Part 2 - Support ImageBitmap as CanvasImageSource. r=smaug (b9454bbe3)
- Bug 1049091 - Console API in workers should not block the script waiting for the main-thread, r=ehsan (08a18bdd5)
- Bug 1154076 - Console API must keep the Worker alive when the runnable to the main-thread is dispatched, r=bent (67ca7f850)
- Bug 1184541 - Create a StructuredCloneHelperInternal and use it in the Console API, r=smaug (45391c7d9)
- fix namespace (808e6e99d)
- Bug 1184557 - part 1 - StructuredCloneHelper class for window to window postMessage, r=smaug (19df45161)
- Bug 1184557 - part 2 - StructuredCloneHelperInternal::Shutdown, r=smaug (a157c50d0)
- Bug 1184995 - StructuredCloneHelper for BroadcastChannel and DataStore, r=smaug (86f901c2f)
- namespace fix (a9f89ad33)
- Bug 1185569 - Use StructuredCloneHelper in MessagePort, r=smaug (c26235044)
- Bug 1188265 - No manual JS_ClearPendingException when StructuredCloneHelper is used, r=smaug (1e9fbe26f)
2021-09-07 11:04:19 +08:00

71 lines
2.0 KiB
C++

/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* 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
#include "mozilla/dom/StructuredCloneHelper.h"
namespace mozilla {
namespace dom {
class MessagePortChild;
class MessagePortMessage;
class MessagePortParent;
class SharedMessagePortMessage final : public StructuredCloneHelper
{
public:
NS_INLINE_DECL_REFCOUNTING(SharedMessagePortMessage)
nsTArray<uint8_t> mData;
SharedMessagePortMessage()
: StructuredCloneHelper(CloningSupported, TransferringSupported)
{}
void Read(nsISupports* aParent,
JSContext* aCx,
JS::MutableHandle<JS::Value> aValue,
ErrorResult& aRv);
void Write(JSContext* aCx,
JS::Handle<JS::Value> aValue,
JS::Handle<JS::Value> aTransfer,
ErrorResult& aRv);
void Free();
static void
FromSharedToMessagesChild(
MessagePortChild* aActor,
const nsTArray<nsRefPtr<SharedMessagePortMessage>>& aData,
nsTArray<MessagePortMessage>& aArray);
static bool
FromMessagesToSharedChild(
nsTArray<MessagePortMessage>& aArray,
FallibleTArray<nsRefPtr<SharedMessagePortMessage>>& aData);
static bool
FromSharedToMessagesParent(
MessagePortParent* aActor,
const nsTArray<nsRefPtr<SharedMessagePortMessage>>& aData,
FallibleTArray<MessagePortMessage>& aArray);
static bool
FromMessagesToSharedParent(
nsTArray<MessagePortMessage>& aArray,
FallibleTArray<nsRefPtr<SharedMessagePortMessage>>& aData);
private:
~SharedMessagePortMessage();
};
} // dom namespace
} // mozilla namespace
#endif // mozilla_dom_SharedMessagePortMessage_h