Coverage Report

Created: 2018-09-25 14:53

/work/obj-fuzz/dist/include/mozilla/net/AltDataOutputStreamParent.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 sw=2 ts=8 et tw=80 : */
3
4
/* This Source Code Form is subject to the terms of the Mozilla Public
5
 * License, v. 2.0. If a copy of the MPL was not distributed with this
6
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7
8
#ifndef mozilla_net_AltDataOutputStreamParent_h
9
#define mozilla_net_AltDataOutputStreamParent_h
10
11
#include "mozilla/net/PAltDataOutputStreamParent.h"
12
#include "nsIOutputStream.h"
13
14
namespace mozilla {
15
namespace net {
16
17
// Forwards data received from the content process to an output stream.
18
class AltDataOutputStreamParent
19
  : public PAltDataOutputStreamParent
20
  , public nsISupports
21
{
22
public:
23
  NS_DECL_ISUPPORTS
24
25
  // Called from NeckoParent::AllocPAltDataOutputStreamParent which also opens
26
  // the output stream.
27
  // aStream may be null
28
  explicit AltDataOutputStreamParent(nsIOutputStream* aStream);
29
30
  // Called when data is received from the content process.
31
  // We proceed to write that data to the output stream.
32
  virtual mozilla::ipc::IPCResult RecvWriteData(const nsCString& data) override;
33
  // Called when AltDataOutputStreamChild::Close() is
34
  // Closes and nulls the output stream.
35
  virtual mozilla::ipc::IPCResult RecvClose() override;
36
  virtual void ActorDestroy(ActorDestroyReason aWhy) override;
37
38
  // Sets an error that will be reported to the content process.
39
0
  void SetError(nsresult status) { mStatus = status; }
40
  virtual mozilla::ipc::IPCResult RecvDeleteSelf() override;
41
42
private:
43
  virtual ~AltDataOutputStreamParent();
44
  nsCOMPtr<nsIOutputStream> mOutputStream;
45
  // In case any error occurs mStatus will be != NS_OK, and this status code will
46
  // be sent to the content process asynchronously.
47
  nsresult mStatus;
48
  bool     mIPCOpen;
49
};
50
51
} // namespace net
52
} // namespace mozilla
53
54
#endif // mozilla_net_AltDataOutputStreamParent_h