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"
19 class BrowsingContext
;
25 friend struct IPC::ParamTraits
<IdType
<T
>>;
29 explicit IdType(uint64_t aId
) : mId(aId
) {}
31 operator uint64_t() const { return mId
; }
33 IdType
& operator=(uint64_t aId
) {
38 bool operator<(const IdType
& rhs
) { return mId
< rhs
.mId
; }
44 using TabId
= IdType
<BrowserParent
>;
45 using ContentParentId
= IdType
<ContentParent
>;
47 } // namespace mozilla
52 struct ParamTraits
<mozilla::dom::IdType
<T
>> {
53 using paramType
= mozilla::dom::IdType
<T
>;
55 static void Write(Message
* aMsg
, const paramType
& aParam
) {
56 WriteParam(aMsg
, aParam
.mId
);
59 static bool Read(const Message
* aMsg
, PickleIterator
* aIter
,
61 return ReadParam(aMsg
, aIter
, &aResult
->mId
);
67 #endif // mozilla_dom_IdType_h