LCOV - code coverage report
Current view: top level - netwerk/base - RedirectChannelRegistrar.cpp (source / functions) Hit Total Coverage
Test: output.info Lines: 0 33 0.0 %
Date: 2017-07-14 16:53:18 Functions: 0 9 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* This Source Code Form is subject to the terms of the Mozilla Public
       2             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       3             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
       4             : 
       5             : #include "RedirectChannelRegistrar.h"
       6             : 
       7             : namespace mozilla {
       8             : namespace net {
       9             : 
      10           0 : NS_IMPL_ISUPPORTS(RedirectChannelRegistrar, nsIRedirectChannelRegistrar)
      11             : 
      12           0 : RedirectChannelRegistrar::RedirectChannelRegistrar()
      13             :   : mRealChannels(32)
      14             :   , mParentChannels(32)
      15             :   , mId(1)
      16           0 :   , mLock("RedirectChannelRegistrar")
      17             : {
      18           0 : }
      19             : 
      20             : NS_IMETHODIMP
      21           0 : RedirectChannelRegistrar::RegisterChannel(nsIChannel *channel,
      22             :                                           uint32_t *_retval)
      23             : {
      24           0 :   MutexAutoLock lock(mLock);
      25             : 
      26           0 :   mRealChannels.Put(mId, channel);
      27           0 :   *_retval = mId;
      28             : 
      29           0 :   ++mId;
      30             : 
      31             :   // Ensure we always provide positive ids
      32           0 :   if (!mId)
      33           0 :     mId = 1;
      34             : 
      35           0 :   return NS_OK;
      36             : }
      37             : 
      38             : NS_IMETHODIMP
      39           0 : RedirectChannelRegistrar::GetRegisteredChannel(uint32_t id,
      40             :                                                nsIChannel **_retval)
      41             : {
      42           0 :   MutexAutoLock lock(mLock);
      43             : 
      44           0 :   if (!mRealChannels.Get(id, _retval))
      45           0 :     return NS_ERROR_NOT_AVAILABLE;
      46             : 
      47           0 :   return NS_OK;
      48             : }
      49             : 
      50             : NS_IMETHODIMP
      51           0 : RedirectChannelRegistrar::LinkChannels(uint32_t id,
      52             :                                        nsIParentChannel *channel,
      53             :                                        nsIChannel** _retval)
      54             : {
      55           0 :   MutexAutoLock lock(mLock);
      56             : 
      57           0 :   if (!mRealChannels.Get(id, _retval))
      58           0 :     return NS_ERROR_NOT_AVAILABLE;
      59             : 
      60           0 :   mParentChannels.Put(id, channel);
      61           0 :   return NS_OK;
      62             : }
      63             : 
      64             : NS_IMETHODIMP
      65           0 : RedirectChannelRegistrar::GetParentChannel(uint32_t id,
      66             :                                            nsIParentChannel **_retval)
      67             : {
      68           0 :   MutexAutoLock lock(mLock);
      69             : 
      70           0 :   if (!mParentChannels.Get(id, _retval))
      71           0 :     return NS_ERROR_NOT_AVAILABLE;
      72             : 
      73           0 :   return NS_OK;
      74             : }
      75             : 
      76             : NS_IMETHODIMP
      77           0 : RedirectChannelRegistrar::DeregisterChannels(uint32_t id)
      78             : {
      79           0 :   MutexAutoLock lock(mLock);
      80             : 
      81           0 :   mRealChannels.Remove(id);
      82           0 :   mParentChannels.Remove(id);
      83           0 :   return NS_OK;
      84             : }
      85             : 
      86             : } // namespace net
      87             : } // namespace mozilla

Generated by: LCOV version 1.13