netwerk/protocol/rtsp/RtspChannelParent.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/netwerk/protocol/rtsp/RtspChannelParent.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,84 @@
     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 +#ifndef RtspChannelParent_h
    1.11 +#define RtspChannelParent_h
    1.12 +
    1.13 +#include "mozilla/net/PRtspChannelParent.h"
    1.14 +#include "mozilla/net/NeckoParent.h"
    1.15 +#include "nsBaseChannel.h"
    1.16 +#include "nsIParentChannel.h"
    1.17 +
    1.18 +namespace mozilla {
    1.19 +namespace net {
    1.20 +
    1.21 +//-----------------------------------------------------------------------------
    1.22 +// Note: RtspChannel doesn't transport streams as normal channel does.
    1.23 +// (See RtspChannelChild.h for detail).
    1.24 +// The reason for the existence of RtspChannelParent is to support HTTP->RTSP
    1.25 +// redirection.
    1.26 +// When redirection happens, two instances of RtspChannelParent will be created:
    1.27 +// - One will be created when HTTP creates the new channel for redirects, and
    1.28 +//   will be registered as an nsIChannel.
    1.29 +// - The other will be created via IPDL by RtspChannelChild, and will be
    1.30 +//   registered as an nsIParentChannel.
    1.31 +class RtspChannelParent : public PRtspChannelParent
    1.32 +                        , public nsBaseChannel
    1.33 +                        , public nsIParentChannel
    1.34 +{
    1.35 +public:
    1.36 +  NS_DECL_ISUPPORTS
    1.37 +  NS_DECL_NSIPARENTCHANNEL
    1.38 +
    1.39 +  RtspChannelParent(nsIURI *aUri);
    1.40 +  ~RtspChannelParent();
    1.41 +
    1.42 +  // nsBaseChannel::nsIChannel
    1.43 +  NS_IMETHOD GetContentType(nsACString & aContentType) MOZ_OVERRIDE MOZ_FINAL;
    1.44 +  NS_IMETHOD AsyncOpen(nsIStreamListener *listener,
    1.45 +                       nsISupports *aContext) MOZ_OVERRIDE MOZ_FINAL;
    1.46 +
    1.47 +  // nsBaseChannel::nsIStreamListener::nsIRequestObserver
    1.48 +  NS_IMETHOD OnStartRequest(nsIRequest *aRequest,
    1.49 +                            nsISupports *aContext) MOZ_OVERRIDE MOZ_FINAL;
    1.50 +  NS_IMETHOD OnStopRequest(nsIRequest *aRequest,
    1.51 +                           nsISupports *aContext,
    1.52 +                           nsresult aStatusCode) MOZ_OVERRIDE MOZ_FINAL;
    1.53 +
    1.54 +  // nsBaseChannel::nsIStreamListener
    1.55 +  NS_IMETHOD OnDataAvailable(nsIRequest *aRequest,
    1.56 +                             nsISupports *aContext,
    1.57 +                             nsIInputStream *aInputStream,
    1.58 +                             uint64_t aOffset,
    1.59 +                             uint32_t aCount) MOZ_OVERRIDE MOZ_FINAL;
    1.60 +
    1.61 +  // nsBaseChannel::nsIChannel::nsIRequest
    1.62 +  NS_IMETHOD Cancel(nsresult status) MOZ_OVERRIDE MOZ_FINAL;
    1.63 +  NS_IMETHOD Suspend() MOZ_OVERRIDE MOZ_FINAL;
    1.64 +  NS_IMETHOD Resume() MOZ_OVERRIDE MOZ_FINAL;
    1.65 +
    1.66 +  // nsBaseChannel
    1.67 +  NS_IMETHOD OpenContentStream(bool aAsync,
    1.68 +                               nsIInputStream **aStream,
    1.69 +                               nsIChannel **aChannel) MOZ_OVERRIDE MOZ_FINAL;
    1.70 +
    1.71 +  // RtspChannelParent
    1.72 +  bool Init(const RtspChannelConnectArgs& aArgs);
    1.73 +
    1.74 +protected:
    1.75 +  // Used to connect redirected-to channel in parent with just created
    1.76 +  // ChildChannel. Used during HTTP->RTSP redirection.
    1.77 +  bool ConnectChannel(const uint32_t& channelId);
    1.78 +
    1.79 +private:
    1.80 +  bool mIPCClosed;
    1.81 +  virtual void ActorDestroy(ActorDestroyReason why) MOZ_OVERRIDE;
    1.82 +};
    1.83 +
    1.84 +} // namespace net
    1.85 +} // namespace mozilla
    1.86 +
    1.87 +#endif // RtspChannelParent_h

mercurial