LCOV - code coverage report
Current view: top level - dom/cache - StreamControl.cpp (source / functions) Hit Total Coverage
Test: output.info Lines: 0 48 0.0 %
Date: 2017-07-14 16:53:18 Functions: 0 8 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
       2             : /* vim: set ts=8 sts=2 et sw=2 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/. */
       6             : 
       7             : #include "mozilla/dom/cache/StreamControl.h"
       8             : 
       9             : namespace mozilla {
      10             : namespace dom {
      11             : namespace cache {
      12             : 
      13             : void
      14           0 : StreamControl::AddReadStream(ReadStream::Controllable* aReadStream)
      15             : {
      16           0 :   AssertOwningThread();
      17           0 :   MOZ_DIAGNOSTIC_ASSERT(aReadStream);
      18           0 :   MOZ_ASSERT(!mReadStreamList.Contains(aReadStream));
      19           0 :   mReadStreamList.AppendElement(aReadStream);
      20           0 : }
      21             : 
      22             : void
      23           0 : StreamControl::ForgetReadStream(ReadStream::Controllable* aReadStream)
      24             : {
      25           0 :   AssertOwningThread();
      26           0 :   MOZ_ALWAYS_TRUE(mReadStreamList.RemoveElement(aReadStream));
      27           0 : }
      28             : 
      29             : void
      30           0 : StreamControl::NoteClosed(ReadStream::Controllable* aReadStream,
      31             :                           const nsID& aId)
      32             : {
      33           0 :   AssertOwningThread();
      34           0 :   ForgetReadStream(aReadStream);
      35           0 :   NoteClosedAfterForget(aId);
      36           0 : }
      37             : 
      38           0 : StreamControl::~StreamControl()
      39             : {
      40             :   // owning thread only, but can't call virtual AssertOwningThread in destructor
      41           0 :   MOZ_DIAGNOSTIC_ASSERT(mReadStreamList.IsEmpty());
      42           0 : }
      43             : 
      44             : void
      45           0 : StreamControl::CloseReadStreams(const nsID& aId)
      46             : {
      47           0 :   AssertOwningThread();
      48             : #ifdef MOZ_DIAGNOSTIC_ASSERT_ENABLED
      49           0 :   uint32_t closedCount = 0;
      50             : #endif
      51             : 
      52           0 :   ReadStreamList::ForwardIterator iter(mReadStreamList);
      53           0 :   while (iter.HasMore()) {
      54           0 :     RefPtr<ReadStream::Controllable> stream = iter.GetNext();
      55           0 :     if (stream->MatchId(aId)) {
      56           0 :       stream->CloseStream();
      57             : #ifdef MOZ_DIAGNOSTIC_ASSERT_ENABLED
      58           0 :       closedCount += 1;
      59             : #endif
      60             :     }
      61             :   }
      62             : 
      63           0 :   MOZ_DIAGNOSTIC_ASSERT(closedCount > 0);
      64           0 : }
      65             : 
      66             : void
      67           0 : StreamControl::CloseAllReadStreams()
      68             : {
      69           0 :   AssertOwningThread();
      70             : 
      71           0 :   ReadStreamList::ForwardIterator iter(mReadStreamList);
      72           0 :   while (iter.HasMore()) {
      73           0 :     iter.GetNext()->CloseStream();
      74             :   }
      75           0 : }
      76             : 
      77             : void
      78           0 : StreamControl::CloseAllReadStreamsWithoutReporting()
      79             : {
      80           0 :   AssertOwningThread();
      81             : 
      82           0 :   ReadStreamList::ForwardIterator iter(mReadStreamList);
      83           0 :   while (iter.HasMore()) {
      84           0 :     RefPtr<ReadStream::Controllable> stream = iter.GetNext();
      85             :     // Note, we cannot trigger IPC traffic here.  So use
      86             :     // CloseStreamWithoutReporting().
      87           0 :     stream->CloseStreamWithoutReporting();
      88             :   }
      89           0 : }
      90             : 
      91             : bool
      92           0 : StreamControl::HasEverBeenRead() const
      93             : {
      94           0 :   ReadStreamList::ForwardIterator iter(mReadStreamList);
      95           0 :   while (iter.HasMore()) {
      96           0 :     if (iter.GetNext()->HasEverBeenRead()) {
      97           0 :       return true;
      98             :     }
      99             :   }
     100           0 :   return false;
     101             : }
     102             : 
     103             : } // namespace cache
     104             : } // namespace dom
     105             : } // namespace mozilla

Generated by: LCOV version 1.13