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_ipc_URIUtils_h
8 #define mozilla_ipc_URIUtils_h
10 #include "mozilla/ipc/URIParams.h"
11 #include "mozilla/ipc/IPDLParamTraits.h"
18 void SerializeURI(nsIURI
* aURI
, URIParams
& aParams
);
20 void SerializeURI(nsIURI
* aURI
, Maybe
<URIParams
>& aParams
);
22 already_AddRefed
<nsIURI
> DeserializeURI(const URIParams
& aParams
);
24 already_AddRefed
<nsIURI
> DeserializeURI(const Maybe
<URIParams
>& aParams
);
27 struct IPDLParamTraits
<nsIURI
*> {
28 static void Write(IPC::MessageWriter
* aWriter
, IProtocol
* aActor
,
30 Maybe
<URIParams
> params
;
31 SerializeURI(aParam
, params
);
32 WriteIPDLParam(aWriter
, aActor
, params
);
35 static bool Read(IPC::MessageReader
* aReader
, IProtocol
* aActor
,
36 RefPtr
<nsIURI
>* aResult
) {
37 Maybe
<URIParams
> params
;
38 if (!ReadIPDLParam(aReader
, aActor
, ¶ms
)) {
41 *aResult
= DeserializeURI(params
);
47 } // namespace mozilla
49 #endif // mozilla_ipc_URIUtils_h