Backed out changeset 06f41c22f3a6 (bug 1888460) for causing linux xpcshell failures...
[gecko.git] / dom / workers / WorkerChannelInfo.cpp
blobcea6acf1ef13d818bdf641dade700220714ac4cc
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)
16 NS_IMETHODIMP
17 WorkerChannelLoadInfo::GetWorkerAssociatedBrowsingContextID(uint64_t* aResult) {
18 *aResult = mWorkerAssociatedBrowsingContextID;
19 return NS_OK;
22 NS_IMETHODIMP
23 WorkerChannelLoadInfo::SetWorkerAssociatedBrowsingContextID(uint64_t aID) {
24 mWorkerAssociatedBrowsingContextID = aID;
25 return NS_OK;
28 NS_IMETHODIMP
29 WorkerChannelLoadInfo::GetWorkerAssociatedBrowsingContext(
30 dom::BrowsingContext** aResult) {
31 *aResult = BrowsingContext::Get(mWorkerAssociatedBrowsingContextID).take();
32 return NS_OK;
35 // WorkerChannelInfo
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);
46 NS_IMETHODIMP
47 WorkerChannelInfo::SetLoadInfo(nsIWorkerChannelLoadInfo* aLoadInfo) {
48 MOZ_ASSERT(aLoadInfo);
49 mLoadInfo = aLoadInfo;
50 return NS_OK;
53 NS_IMETHODIMP
54 WorkerChannelInfo::GetLoadInfo(nsIWorkerChannelLoadInfo** aLoadInfo) {
55 *aLoadInfo = do_AddRef(mLoadInfo).take();
56 return NS_OK;
59 NS_IMETHODIMP
60 WorkerChannelInfo::GetChannelId(uint64_t* aChannelID) {
61 NS_ENSURE_ARG_POINTER(aChannelID);
62 *aChannelID = mChannelID;
63 return NS_OK;
66 } // end of namespace mozilla::dom