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

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /* This Source Code Form is subject to the terms of the Mozilla Public
       3             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       4             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
       5             : 
       6             : #include "nsSimpleStreamListener.h"
       7             : 
       8             : namespace mozilla {
       9             : namespace net {
      10             : 
      11             : //
      12             : //----------------------------------------------------------------------------
      13             : // nsISupports implementation...
      14             : //----------------------------------------------------------------------------
      15             : //
      16           0 : NS_IMPL_ISUPPORTS(nsSimpleStreamListener,
      17             :                   nsISimpleStreamListener,
      18             :                   nsIStreamListener,
      19             :                   nsIRequestObserver)
      20             : 
      21             : //
      22             : //----------------------------------------------------------------------------
      23             : // nsIRequestObserver implementation...
      24             : //----------------------------------------------------------------------------
      25             : //
      26             : NS_IMETHODIMP
      27           0 : nsSimpleStreamListener::OnStartRequest(nsIRequest *aRequest,
      28             :                                        nsISupports *aContext)
      29             : {
      30           0 :     return mObserver ?
      31           0 :         mObserver->OnStartRequest(aRequest, aContext) : NS_OK;
      32             : }
      33             : 
      34             : NS_IMETHODIMP
      35           0 : nsSimpleStreamListener::OnStopRequest(nsIRequest* request,
      36             :                                       nsISupports *aContext,
      37             :                                       nsresult aStatus)
      38             : {
      39           0 :     return mObserver ?
      40           0 :         mObserver->OnStopRequest(request, aContext, aStatus) : NS_OK;
      41             : }
      42             : 
      43             : //
      44             : //----------------------------------------------------------------------------
      45             : // nsIStreamListener implementation...
      46             : //----------------------------------------------------------------------------
      47             : //
      48             : NS_IMETHODIMP
      49           0 : nsSimpleStreamListener::OnDataAvailable(nsIRequest* request,
      50             :                                         nsISupports *aContext,
      51             :                                         nsIInputStream *aSource,
      52             :                                         uint64_t aOffset,
      53             :                                         uint32_t aCount)
      54             : {
      55             :     uint32_t writeCount;
      56           0 :     nsresult rv = mSink->WriteFrom(aSource, aCount, &writeCount);
      57             :     //
      58             :     // Equate zero bytes read and NS_SUCCEEDED to stopping the read.
      59             :     //
      60           0 :     if (NS_SUCCEEDED(rv) && (writeCount == 0))
      61           0 :         return NS_BASE_STREAM_CLOSED;
      62           0 :     return rv;
      63             : }
      64             : 
      65             : //
      66             : //----------------------------------------------------------------------------
      67             : // nsISimpleStreamListener implementation...
      68             : //----------------------------------------------------------------------------
      69             : //
      70             : NS_IMETHODIMP
      71           0 : nsSimpleStreamListener::Init(nsIOutputStream *aSink,
      72             :                              nsIRequestObserver *aObserver)
      73             : {
      74           0 :     NS_PRECONDITION(aSink, "null output stream");
      75             : 
      76           0 :     mSink = aSink;
      77           0 :     mObserver = aObserver;
      78             : 
      79           0 :     return NS_OK;
      80             : }
      81             : 
      82             : } // namespace net
      83             : } // namespace mozilla

Generated by: LCOV version 1.13