Fri, 16 Jan 2015 18:13:44 +0100
Integrate suggestion from review to improve consistency with existing code.
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 #include "RtspChannelParent.h"
9 using namespace mozilla::ipc;
11 namespace mozilla {
12 namespace net {
14 //-----------------------------------------------------------------------------
15 // RtspChannelParent
16 //-----------------------------------------------------------------------------
17 RtspChannelParent::RtspChannelParent(nsIURI *aUri)
18 : mIPCClosed(false)
19 {
20 nsBaseChannel::SetURI(aUri);
21 }
23 RtspChannelParent::~RtspChannelParent()
24 {
25 }
27 void
28 RtspChannelParent::ActorDestroy(ActorDestroyReason why)
29 {
30 mIPCClosed = true;
31 }
33 //-----------------------------------------------------------------------------
34 // nsISupports
35 //-----------------------------------------------------------------------------
36 NS_IMPL_ISUPPORTS_INHERITED(RtspChannelParent,
37 nsBaseChannel,
38 nsIParentChannel)
40 //-----------------------------------------------------------------------------
41 // RtspChannelParent methods
42 //-----------------------------------------------------------------------------
43 bool
44 RtspChannelParent::Init(const RtspChannelConnectArgs& aArgs)
45 {
46 return ConnectChannel(aArgs.channelId());
47 }
49 bool
50 RtspChannelParent::ConnectChannel(const uint32_t& channelId)
51 {
52 nsresult rv;
53 nsCOMPtr<nsIChannel> channel;
54 rv = NS_LinkRedirectChannels(channelId, this, getter_AddRefs(channel));
56 return true;
57 }
59 //-----------------------------------------------------------------------------
60 // nsBaseChannel::nsIChannel
61 //-----------------------------------------------------------------------------
62 NS_IMETHODIMP
63 RtspChannelParent::GetContentType(nsACString& aContentType)
64 {
65 aContentType.AssignLiteral("RTSP");
66 return NS_OK;
67 }
69 NS_IMETHODIMP
70 RtspChannelParent::AsyncOpen(nsIStreamListener *aListener, nsISupports *aContext)
71 {
72 return NS_OK;
73 }
75 //-----------------------------------------------------------------------------
76 // nsBaseChannel::nsIStreamListener::nsIRequestObserver
77 //-----------------------------------------------------------------------------
78 NS_IMETHODIMP
79 RtspChannelParent::OnStartRequest(nsIRequest *aRequest,
80 nsISupports *aContext)
81 {
82 MOZ_CRASH("Should never be called");
83 }
85 NS_IMETHODIMP
86 RtspChannelParent::OnStopRequest(nsIRequest *aRequest,
87 nsISupports *aContext,
88 nsresult aStatusCode)
89 {
90 MOZ_CRASH("Should never be called");
91 }
93 //-----------------------------------------------------------------------------
94 // nsBaseChannel::nsIStreamListener
95 //-----------------------------------------------------------------------------
96 NS_IMETHODIMP
97 RtspChannelParent::OnDataAvailable(nsIRequest *aRequest,
98 nsISupports *aContext,
99 nsIInputStream *aInputStream,
100 uint64_t aOffset,
101 uint32_t aCount)
102 {
103 MOZ_CRASH("Should never be called");
104 }
106 //-----------------------------------------------------------------------------
107 // nsBaseChannel::nsIChannel::nsIRequeset
108 //-----------------------------------------------------------------------------
109 NS_IMETHODIMP
110 RtspChannelParent::Cancel(nsresult status)
111 {
112 // FIXME: This method will be called by
113 // nsXMLHttpRequest::CloseRequestWithError while closing the browser app.
114 // However, the root cause is RtspChannelParent will be created by
115 // nsXMLHttpRequest::Open when we navigate away from an RTSP web page.
116 // We should find out why it happens and decide how to fix it.
117 return NS_OK;
118 }
120 NS_IMETHODIMP
121 RtspChannelParent::Suspend()
122 {
123 MOZ_CRASH("Should never be called");
124 }
126 NS_IMETHODIMP
127 RtspChannelParent::Resume()
128 {
129 MOZ_CRASH("Should never be called");
130 }
132 //-----------------------------------------------------------------------------
133 // nsBaseChannel
134 //-----------------------------------------------------------------------------
135 NS_IMETHODIMP
136 RtspChannelParent::OpenContentStream(bool aAsync,
137 nsIInputStream **aStream,
138 nsIChannel **aChannel)
139 {
140 MOZ_CRASH("Should never be called");
141 }
143 //-----------------------------------------------------------------------------
144 // nsIParentChannel
145 //-----------------------------------------------------------------------------
146 NS_IMETHODIMP
147 RtspChannelParent::SetParentListener(HttpChannelParentListener *aListener)
148 {
149 return NS_OK;
150 }
152 NS_IMETHODIMP
153 RtspChannelParent::Delete()
154 {
155 return NS_OK;
156 }
158 } // namespace net
159 } // namespace mozilla