Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
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 /* 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 RtspChannelChild_h
8 #define RtspChannelChild_h
10 #include "mozilla/net/PRtspChannelChild.h"
11 #include "mozilla/net/NeckoChild.h"
12 #include "nsBaseChannel.h"
13 #include "nsIChildChannel.h"
14 #include "nsIStreamingProtocolController.h"
15 #include "nsIStreamingProtocolService.h"
17 namespace mozilla {
18 namespace net {
20 //-----------------------------------------------------------------------------
21 // RtspChannelChild is a dummy channel used to aid MediaResource creation in
22 // HTMLMediaElement. Network control and data flows are managed by an
23 // RtspController object, which is created by us and manipulated by
24 // RtspMediaResource. This object is also responsible for inter-process
25 // communication with the parent process.
26 // When RtspChannelChild::AsyncOpen is called, it should create an
27 // RtspController object, dispatch an OnStartRequest and immediately return.
28 // We expect an RtspMediaResource object will be created in the calling context
29 // and it will use the RtpController we create.
31 class RtspChannelChild : public PRtspChannelChild
32 , public nsBaseChannel
33 , public nsIChildChannel
34 {
35 public:
36 NS_DECL_ISUPPORTS
37 NS_DECL_NSICHILDCHANNEL
39 RtspChannelChild(nsIURI *aUri);
40 ~RtspChannelChild();
42 // nsBaseChannel::nsIChannel
43 NS_IMETHOD GetContentType(nsACString & aContentType) MOZ_OVERRIDE MOZ_FINAL;
44 NS_IMETHOD AsyncOpen(nsIStreamListener *listener, nsISupports *aContext)
45 MOZ_OVERRIDE MOZ_FINAL;
47 // nsBaseChannel::nsIStreamListener::nsIRequestObserver
48 NS_IMETHOD OnStartRequest(nsIRequest *aRequest, nsISupports *aContext)
49 MOZ_OVERRIDE MOZ_FINAL;
50 NS_IMETHOD OnStopRequest(nsIRequest *aRequest,
51 nsISupports *aContext,
52 nsresult aStatusCode) MOZ_OVERRIDE MOZ_FINAL;
54 // nsBaseChannel::nsIStreamListener
55 NS_IMETHOD OnDataAvailable(nsIRequest *aRequest,
56 nsISupports *aContext,
57 nsIInputStream *aInputStream,
58 uint64_t aOffset,
59 uint32_t aCount) MOZ_OVERRIDE MOZ_FINAL;
61 // nsBaseChannel::nsIChannel::nsIRequest
62 NS_IMETHOD Cancel(nsresult status) MOZ_OVERRIDE MOZ_FINAL;
63 NS_IMETHOD Suspend() MOZ_OVERRIDE MOZ_FINAL;
64 NS_IMETHOD Resume() MOZ_OVERRIDE MOZ_FINAL;
66 // nsBaseChannel
67 NS_IMETHOD OpenContentStream(bool aAsync,
68 nsIInputStream **aStream,
69 nsIChannel **aChannel) MOZ_OVERRIDE MOZ_FINAL;
71 // IPDL
72 void AddIPDLReference();
73 void ReleaseIPDLReference();
75 // RtspChannelChild
76 nsIStreamingProtocolController* GetController();
77 void ReleaseController();
79 private:
80 bool mIPCOpen;
81 bool mCanceled;
82 nsCOMPtr<nsIStreamingProtocolController> mMediaStreamController;
83 };
85 } // namespace net
86 } // namespace mozilla
88 #endif // RtspChannelChild_h