1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set sw=2 ts=8 et tw=80 : */
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/. */
8 #ifndef mozilla_net_AltDataOutputStreamParent_h
9 #define mozilla_net_AltDataOutputStreamParent_h
11 #include "mozilla/net/PAltDataOutputStreamParent.h"
12 #include "nsIOutputStream.h"
17 // Forwards data received from the content process to an output stream.
18 class AltDataOutputStreamParent
: public PAltDataOutputStreamParent
,
23 // Called from NeckoParent::AllocPAltDataOutputStreamParent which also opens
25 // aStream may be null
26 explicit AltDataOutputStreamParent(nsIOutputStream
* aStream
);
28 // Called when data is received from the content process.
29 // We proceed to write that data to the output stream.
30 mozilla::ipc::IPCResult
RecvWriteData(const nsCString
& data
);
31 // Called when AltDataOutputStreamChild::Close() is
32 // Closes and nulls the output stream.
33 mozilla::ipc::IPCResult
RecvClose(const nsresult
& aStatus
);
34 virtual void ActorDestroy(ActorDestroyReason aWhy
) override
;
36 // Sets an error that will be reported to the content process.
37 void SetError(nsresult status
) { mStatus
= status
; }
38 mozilla::ipc::IPCResult
RecvDeleteSelf();
41 virtual ~AltDataOutputStreamParent();
42 nsCOMPtr
<nsIOutputStream
> mOutputStream
;
43 // In case any error occurs mStatus will be != NS_OK, and this status code
44 // will be sent to the content process asynchronously.
50 } // namespace mozilla
52 #endif // mozilla_net_AltDataOutputStreamParent_h