Files
palemoon27/dom/workers/WorkerStructuredClone.h
T
roytam1 eea282447c import changes from `dev' branch of rmottola/Arctic-Fox:
- Bug 1179685 - Fix messageport assert in wpt service worker test. r=baku (61aa36afc)
- Bug 1044102 - Part 3 - Support StructuredClone. r=baku (1662a398a)
- Bug 1135627 - Add implementation of DragEvent constructor. r=jdm r=smaug (be58d003c)
- Bug 1140145 - Fixup incorrectly merged wpt metadata (a408caba8)
2021-09-07 11:10:47 +08:00

64 lines
1.8 KiB
C++

/* -*- Mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; tab-width: 40 -*- */
/* 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_workers_WorkerStructuredClone_h
#define mozilla_dom_workers_WorkerStructuredClone_h
#include "Workers.h"
#include "mozilla/dom/PMessagePort.h"
class nsPIDOMWindow;
namespace mozilla {
namespace layers {
class Image;
}
namespace dom {
class MessagePortBase;
namespace workers {
// This class is implemented in WorkerPrivate.cpp
class WorkerStructuredCloneClosure final
{
private:
WorkerStructuredCloneClosure(const WorkerStructuredCloneClosure&) = delete;
WorkerStructuredCloneClosure & operator=(const WorkerStructuredCloneClosure&) = delete;
public:
WorkerStructuredCloneClosure();
~WorkerStructuredCloneClosure();
void Clear();
// This can be null if the MessagePort is created in a worker.
nsCOMPtr<nsPIDOMWindow> mParentWindow;
nsTArray<nsCOMPtr<nsISupports>> mClonedObjects;
// This is used for sharing the backend of ImageBitmaps.
// The layers::Image object must be thread-safely reference-counted.
// The layers::Image object will not be written ever via any ImageBitmap
// instance, so no race condition will occur.
nsTArray<nsRefPtr<layers::Image>> mClonedImages;
// The transferred ports.
nsTArray<nsRefPtr<MessagePortBase>> mMessagePorts;
// Information for the transferring.
nsTArray<MessagePortIdentifier> mMessagePortIdentifiers;
// To avoid duplicates in the transferred ports.
nsTArray<nsRefPtr<MessagePortBase>> mTransferredPorts;
};
} // workers namespace
} // dom namespace
} // mozilla namespace
#endif // mozilla_dom_workers_WorkerStructuredClone_h