Coverage Report

Created: 2018-09-25 14:53

/work/obj-fuzz/dist/include/mozilla/ipc/URIUtils.h
Line
Count
Source (jump to first uncovered line)
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/. */
6
7
#ifndef mozilla_ipc_URIUtils_h
8
#define mozilla_ipc_URIUtils_h
9
10
#include "mozilla/ipc/URIParams.h"
11
#include "mozilla/ipc/IPDLParamTraits.h"
12
#include "nsCOMPtr.h"
13
#include "nsIURI.h"
14
15
namespace mozilla {
16
namespace ipc {
17
18
void
19
SerializeURI(nsIURI* aURI,
20
             URIParams& aParams);
21
22
void
23
SerializeURI(nsIURI* aURI,
24
             OptionalURIParams& aParams);
25
26
already_AddRefed<nsIURI>
27
DeserializeURI(const URIParams& aParams);
28
29
already_AddRefed<nsIURI>
30
DeserializeURI(const OptionalURIParams& aParams);
31
32
template<>
33
struct IPDLParamTraits<nsIURI>
34
{
35
  static void Write(IPC::Message* aMsg, IProtocol* aActor, nsIURI* aParam)
36
0
  {
37
0
    OptionalURIParams params;
38
0
    SerializeURI(aParam, params);
39
0
    WriteIPDLParam(aMsg, aActor, params);
40
0
  }
41
42
  static bool Read(const IPC::Message* aMsg, PickleIterator* aIter,
43
                   IProtocol* aActor, RefPtr<nsIURI>* aResult)
44
0
  {
45
0
    OptionalURIParams params;
46
0
    if (!ReadIPDLParam(aMsg, aIter, aActor, &params)) {
47
0
      return false;
48
0
    }
49
0
    *aResult = DeserializeURI(params);
50
0
    return true;
51
0
  }
52
};
53
54
} // namespace ipc
55
} // namespace mozilla
56
57
#endif // mozilla_ipc_URIUtils_h