netwerk/protocol/rtsp/RtspChannelParent.cpp

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/netwerk/protocol/rtsp/RtspChannelParent.cpp	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,159 @@
     1.4 +/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
     1.5 +/* vim: set sw=2 ts=8 et tw=80 : */
     1.6 +/* This Source Code Form is subject to the terms of the Mozilla Public
     1.7 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.8 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.9 +
    1.10 +#include "RtspChannelParent.h"
    1.11 +
    1.12 +using namespace mozilla::ipc;
    1.13 +
    1.14 +namespace mozilla {
    1.15 +namespace net {
    1.16 +
    1.17 +//-----------------------------------------------------------------------------
    1.18 +// RtspChannelParent
    1.19 +//-----------------------------------------------------------------------------
    1.20 +RtspChannelParent::RtspChannelParent(nsIURI *aUri)
    1.21 +  : mIPCClosed(false)
    1.22 +{
    1.23 +  nsBaseChannel::SetURI(aUri);
    1.24 +}
    1.25 +
    1.26 +RtspChannelParent::~RtspChannelParent()
    1.27 +{
    1.28 +}
    1.29 +
    1.30 +void
    1.31 +RtspChannelParent::ActorDestroy(ActorDestroyReason why)
    1.32 +{
    1.33 +  mIPCClosed = true;
    1.34 +}
    1.35 +
    1.36 +//-----------------------------------------------------------------------------
    1.37 +// nsISupports
    1.38 +//-----------------------------------------------------------------------------
    1.39 +NS_IMPL_ISUPPORTS_INHERITED(RtspChannelParent,
    1.40 +                            nsBaseChannel,
    1.41 +                            nsIParentChannel)
    1.42 +
    1.43 +//-----------------------------------------------------------------------------
    1.44 +// RtspChannelParent methods
    1.45 +//-----------------------------------------------------------------------------
    1.46 +bool
    1.47 +RtspChannelParent::Init(const RtspChannelConnectArgs& aArgs)
    1.48 +{
    1.49 +  return ConnectChannel(aArgs.channelId());
    1.50 +}
    1.51 +
    1.52 +bool
    1.53 +RtspChannelParent::ConnectChannel(const uint32_t& channelId)
    1.54 +{
    1.55 +  nsresult rv;
    1.56 +  nsCOMPtr<nsIChannel> channel;
    1.57 +  rv = NS_LinkRedirectChannels(channelId, this, getter_AddRefs(channel));
    1.58 +
    1.59 +  return true;
    1.60 +}
    1.61 +
    1.62 +//-----------------------------------------------------------------------------
    1.63 +// nsBaseChannel::nsIChannel
    1.64 +//-----------------------------------------------------------------------------
    1.65 +NS_IMETHODIMP
    1.66 +RtspChannelParent::GetContentType(nsACString& aContentType)
    1.67 +{
    1.68 +  aContentType.AssignLiteral("RTSP");
    1.69 +  return NS_OK;
    1.70 +}
    1.71 +
    1.72 +NS_IMETHODIMP
    1.73 +RtspChannelParent::AsyncOpen(nsIStreamListener *aListener, nsISupports *aContext)
    1.74 +{
    1.75 +  return NS_OK;
    1.76 +}
    1.77 +
    1.78 +//-----------------------------------------------------------------------------
    1.79 +// nsBaseChannel::nsIStreamListener::nsIRequestObserver
    1.80 +//-----------------------------------------------------------------------------
    1.81 +NS_IMETHODIMP
    1.82 +RtspChannelParent::OnStartRequest(nsIRequest *aRequest,
    1.83 +                            nsISupports *aContext)
    1.84 +{
    1.85 +  MOZ_CRASH("Should never be called");
    1.86 +}
    1.87 +
    1.88 +NS_IMETHODIMP
    1.89 +RtspChannelParent::OnStopRequest(nsIRequest *aRequest,
    1.90 +                           nsISupports *aContext,
    1.91 +                           nsresult aStatusCode)
    1.92 +{
    1.93 +  MOZ_CRASH("Should never be called");
    1.94 +}
    1.95 +
    1.96 +//-----------------------------------------------------------------------------
    1.97 +// nsBaseChannel::nsIStreamListener
    1.98 +//-----------------------------------------------------------------------------
    1.99 +NS_IMETHODIMP
   1.100 +RtspChannelParent::OnDataAvailable(nsIRequest *aRequest,
   1.101 +                             nsISupports *aContext,
   1.102 +                             nsIInputStream *aInputStream,
   1.103 +                             uint64_t aOffset,
   1.104 +                             uint32_t aCount)
   1.105 +{
   1.106 +  MOZ_CRASH("Should never be called");
   1.107 +}
   1.108 +
   1.109 +//-----------------------------------------------------------------------------
   1.110 +// nsBaseChannel::nsIChannel::nsIRequeset
   1.111 +//-----------------------------------------------------------------------------
   1.112 +NS_IMETHODIMP
   1.113 +RtspChannelParent::Cancel(nsresult status)
   1.114 +{
   1.115 +  // FIXME: This method will be called by
   1.116 +  // nsXMLHttpRequest::CloseRequestWithError while closing the browser app.
   1.117 +  // However, the root cause is RtspChannelParent will be created by
   1.118 +  // nsXMLHttpRequest::Open when we navigate away from an RTSP web page.
   1.119 +  // We should find out why it happens and decide how to fix it.
   1.120 +  return NS_OK;
   1.121 +}
   1.122 +
   1.123 +NS_IMETHODIMP
   1.124 +RtspChannelParent::Suspend()
   1.125 +{
   1.126 +  MOZ_CRASH("Should never be called");
   1.127 +}
   1.128 +
   1.129 +NS_IMETHODIMP
   1.130 +RtspChannelParent::Resume()
   1.131 +{
   1.132 +  MOZ_CRASH("Should never be called");
   1.133 +}
   1.134 +
   1.135 +//-----------------------------------------------------------------------------
   1.136 +// nsBaseChannel
   1.137 +//-----------------------------------------------------------------------------
   1.138 +NS_IMETHODIMP
   1.139 +RtspChannelParent::OpenContentStream(bool aAsync,
   1.140 +                               nsIInputStream **aStream,
   1.141 +                               nsIChannel **aChannel)
   1.142 +{
   1.143 +  MOZ_CRASH("Should never be called");
   1.144 +}
   1.145 +
   1.146 +//-----------------------------------------------------------------------------
   1.147 +// nsIParentChannel
   1.148 +//-----------------------------------------------------------------------------
   1.149 +NS_IMETHODIMP
   1.150 +RtspChannelParent::SetParentListener(HttpChannelParentListener *aListener)
   1.151 +{
   1.152 +  return NS_OK;
   1.153 +}
   1.154 +
   1.155 +NS_IMETHODIMP
   1.156 +RtspChannelParent::Delete()
   1.157 +{
   1.158 +  return NS_OK;
   1.159 +}
   1.160 +
   1.161 +} // namespace net
   1.162 +} // namespace mozilla

mercurial