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
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #include "WorkerChannelInfo.h"
8 #include "mozilla/dom/BrowsingContext.h"
10 namespace mozilla::dom
{
12 // WorkerChannelLoadInfo
14 NS_IMPL_ISUPPORTS(WorkerChannelLoadInfo
, nsIWorkerChannelLoadInfo
)
17 WorkerChannelLoadInfo::GetWorkerAssociatedBrowsingContextID(uint64_t* aResult
) {
18 *aResult
= mWorkerAssociatedBrowsingContextID
;
23 WorkerChannelLoadInfo::SetWorkerAssociatedBrowsingContextID(uint64_t aID
) {
24 mWorkerAssociatedBrowsingContextID
= aID
;
29 WorkerChannelLoadInfo::GetWorkerAssociatedBrowsingContext(
30 dom::BrowsingContext
** aResult
) {
31 *aResult
= BrowsingContext::Get(mWorkerAssociatedBrowsingContextID
).take();
37 NS_IMPL_ISUPPORTS(WorkerChannelInfo
, nsIWorkerChannelInfo
)
39 WorkerChannelInfo::WorkerChannelInfo(uint64_t aChannelID
,
40 uint64_t aBrowsingContextID
)
41 : mChannelID(aChannelID
) {
42 mLoadInfo
= new WorkerChannelLoadInfo();
43 mLoadInfo
->SetWorkerAssociatedBrowsingContextID(aBrowsingContextID
);
47 WorkerChannelInfo::SetLoadInfo(nsIWorkerChannelLoadInfo
* aLoadInfo
) {
48 MOZ_ASSERT(aLoadInfo
);
49 mLoadInfo
= aLoadInfo
;
54 WorkerChannelInfo::GetLoadInfo(nsIWorkerChannelLoadInfo
** aLoadInfo
) {
55 *aLoadInfo
= do_AddRef(mLoadInfo
).take();
60 WorkerChannelInfo::GetChannelId(uint64_t* aChannelID
) {
61 NS_ENSURE_ARG_POINTER(aChannelID
);
62 *aChannelID
= mChannelID
;
66 } // end of namespace mozilla::dom