1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this file,
5 * You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #include "mozilla/dom/EndpointForReportParent.h"
8 #include "mozilla/dom/ReportingHeader.h"
9 #include "mozilla/ipc/PBackgroundSharedTypes.h"
10 #include "mozilla/Unused.h"
11 #include "nsIThread.h"
12 #include "nsThreadUtils.h"
17 EndpointForReportParent::EndpointForReportParent()
18 : mPBackgroundThread(NS_GetCurrentThread()), mActive(true) {}
20 EndpointForReportParent::~EndpointForReportParent() = default;
22 void EndpointForReportParent::ActorDestroy(ActorDestroyReason aWhy
) {
26 void EndpointForReportParent::Run(
27 const nsString
& aGroupName
,
28 const mozilla::ipc::PrincipalInfo
& aPrincipalInfo
) {
29 RefPtr
<EndpointForReportParent
> self
= this;
31 NS_DispatchToMainThread(NS_NewRunnableFunction(
32 "EndpointForReportParent::Run", [self
, aGroupName
, aPrincipalInfo
]() {
34 ReportingHeader::GetEndpointForReport(aGroupName
, aPrincipalInfo
, uri
);
35 self
->mPBackgroundThread
->Dispatch(NS_NewRunnableFunction(
36 "EndpointForReportParent::Answer", [self
, uri
]() {
38 Unused
<< self
->Send__delete__(self
, uri
);
45 } // namespace mozilla