LCOV - code coverage report
Current view: top level - dom/file - TemporaryBlobImpl.cpp (source / functions) Hit Total Coverage
Test: output.info Lines: 0 21 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: 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 "TemporaryBlobImpl.h"
       8             : 
       9             : namespace mozilla {
      10             : namespace dom {
      11             : 
      12           0 : NS_IMPL_ISUPPORTS_INHERITED0(TemporaryBlobImpl, BlobImpl)
      13             : 
      14           0 : TemporaryBlobImpl::TemporaryBlobImpl(PRFileDesc* aFD, uint64_t aStartPos,
      15             :                                      uint64_t aLength,
      16           0 :                                      const nsAString& aContentType)
      17             :   : BaseBlobImpl(aContentType, aLength)
      18           0 :   , mStartPos(aStartPos)
      19             : {
      20           0 :   mFileDescOwner = new nsTemporaryFileInputStream::FileDescOwner(aFD);
      21           0 : }
      22             : 
      23           0 : TemporaryBlobImpl::TemporaryBlobImpl(const TemporaryBlobImpl* aOther,
      24             :                                      uint64_t aStart, uint64_t aLength,
      25           0 :                                      const nsAString& aContentType)
      26             :   : BaseBlobImpl(aContentType, aLength)
      27             :   , mStartPos(aStart)
      28           0 :   , mFileDescOwner(aOther->mFileDescOwner)
      29           0 : {}
      30             : 
      31             : already_AddRefed<BlobImpl>
      32           0 : TemporaryBlobImpl::CreateSlice(uint64_t aStart, uint64_t aLength,
      33             :                                const nsAString& aContentType,
      34             :                                ErrorResult& aRv)
      35             : {
      36           0 :   if (aStart + aLength > mLength) {
      37           0 :     aRv.Throw(NS_ERROR_UNEXPECTED);
      38           0 :     return nullptr;
      39             :   }
      40             : 
      41             :   RefPtr<BlobImpl> impl =
      42           0 :     new TemporaryBlobImpl(this, aStart + mStartPos,
      43           0 :                               aLength, aContentType);
      44           0 :   return impl.forget();
      45             : }
      46             : 
      47             : void
      48           0 : TemporaryBlobImpl::GetInternalStream(nsIInputStream** aStream,
      49             :                                      ErrorResult& aRv)
      50             : {
      51             :   nsCOMPtr<nsIInputStream> stream =
      52             :     new nsTemporaryFileInputStream(mFileDescOwner, mStartPos,
      53           0 :                                    mStartPos + mLength);
      54           0 :   stream.forget(aStream);
      55           0 : }
      56             : 
      57             : } // namespace dom
      58             : } // namespace mozilla

Generated by: LCOV version 1.13