LCOV - code coverage report
Current view: top level - dom/file/ipc - IPCBlobInputStreamParent.h (source / functions) Hit Total Coverage
Test: output.info Lines: 0 8 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             : #ifndef mozilla_dom_ipc_IPCBlobInputStreamParent_h
       8             : #define mozilla_dom_ipc_IPCBlobInputStreamParent_h
       9             : 
      10             : #include "mozilla/ipc/PIPCBlobInputStreamParent.h"
      11             : 
      12             : class nsIInputStream;
      13             : 
      14             : namespace mozilla {
      15             : namespace dom {
      16             : 
      17           0 : class NS_NO_VTABLE IPCBlobInputStreamParentCallback
      18             : {
      19             : public:
      20             :   virtual void
      21             :   ActorDestroyed(const nsID& aID) = 0;
      22             : 
      23             :   NS_INLINE_DECL_PURE_VIRTUAL_REFCOUNTING
      24             : 
      25             : protected:
      26           0 :   virtual ~IPCBlobInputStreamParentCallback()
      27           0 :   { }
      28             : };
      29             : 
      30           0 : class IPCBlobInputStreamParent final
      31             :   : public mozilla::ipc::PIPCBlobInputStreamParent
      32             : {
      33             : public:
      34             :   // The size of the inputStream must be passed as argument in order to avoid
      35             :   // the use of nsIInputStream::Available() which could open a fileDescriptor in
      36             :   // case the stream is a nsFileStream.
      37             :   template<typename M>
      38             :   static IPCBlobInputStreamParent*
      39             :   Create(nsIInputStream* aInputStream, uint64_t aSize,
      40             :          uint64_t aChildID, nsresult* aRv, M* aManager);
      41             : 
      42             :   static IPCBlobInputStreamParent*
      43             :   Create(const nsID& aID, uint64_t aSize,
      44             :          mozilla::ipc::PBackgroundParent* aManager);
      45             : 
      46             :   void
      47             :   ActorDestroy(IProtocol::ActorDestroyReason aReason) override;
      48             : 
      49             :   const nsID&
      50           0 :   ID() const
      51             :   {
      52           0 :     return mID;
      53             :   }
      54             : 
      55             :   uint64_t
      56           0 :   Size() const
      57             :   {
      58           0 :     return mSize;
      59             :   }
      60             : 
      61             :   void
      62             :   SetCallback(IPCBlobInputStreamParentCallback* aCallback);
      63             : 
      64             :   mozilla::ipc::IPCResult
      65             :   RecvStreamNeeded() override;
      66             : 
      67             :   mozilla::ipc::IPCResult
      68             :   RecvClose() override;
      69             : 
      70             :   mozilla::ipc::IPCResult
      71             :   Recv__delete__() override;
      72             : 
      73             :   bool
      74             :   HasValidStream() const;
      75             : 
      76             : private:
      77             :   IPCBlobInputStreamParent(const nsID& aID, uint64_t aSize,
      78             :                            nsIContentParent* aManager);
      79             : 
      80             :   IPCBlobInputStreamParent(const nsID& aID, uint64_t aSize,
      81             :                            mozilla::ipc::PBackgroundParent* aManager);
      82             : 
      83             :   const nsID mID;
      84             :   const uint64_t mSize;
      85             : 
      86             :   // Only 1 of these 2 is set. Raw pointer because these 2 managers are keeping
      87             :   // the parent actor alive. The pointers will be nullified in ActorDestroyed.
      88             :   nsIContentParent* mContentManager;
      89             :   mozilla::ipc::PBackgroundParent* mPBackgroundManager;
      90             : 
      91             :   RefPtr<IPCBlobInputStreamParentCallback> mCallback;
      92             : 
      93             :   bool mMigrating;
      94             : };
      95             : 
      96             : } // namespace dom
      97             : } // namespace mozilla
      98             : 
      99             : #endif // mozilla_dom_ipc_IPCBlobInputStreamParent_h

Generated by: LCOV version 1.13