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 #ifndef mozilla_dom_IdType_h
8 #define mozilla_dom_IdType_h
10 #include "ipc/IPCMessageUtils.h"
17 namespace mozilla::dom
{
18 class BrowsingContext
;
24 friend struct IPC::ParamTraits
<IdType
<T
>>;
28 explicit IdType(uint64_t aId
) : mId(aId
) {}
30 operator uint64_t() const { return mId
; }
32 IdType
& operator=(uint64_t aId
) {
37 bool operator<(const IdType
& rhs
) { return mId
< rhs
.mId
; }
43 using TabId
= IdType
<BrowserParent
>;
44 using ContentParentId
= IdType
<ContentParent
>;
45 } // namespace mozilla::dom
50 struct ParamTraits
<mozilla::dom::IdType
<T
>> {
51 using paramType
= mozilla::dom::IdType
<T
>;
53 static void Write(MessageWriter
* aWriter
, const paramType
& aParam
) {
54 WriteParam(aWriter
, aParam
.mId
);
57 static bool Read(MessageReader
* aReader
, paramType
* aResult
) {
58 return ReadParam(aReader
, &aResult
->mId
);
64 #endif // mozilla_dom_IdType_h