LCOV - code coverage report
Current view: top level - dom/file/ipc - IPCBlobInputStreamStorage.h (source / functions) Hit Total Coverage
Test: output.info Lines: 0 1 0.0 %
Date: 2017-07-14 16:53:18 Functions: 0 2 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_IPCBlobInputStreamStorage_h
       8             : #define mozilla_dom_ipc_IPCBlobInputStreamStorage_h
       9             : 
      10             : #include "mozilla/RefPtr.h"
      11             : #include "nsClassHashtable.h"
      12             : #include "nsIObserver.h"
      13             : 
      14             : class nsIInputStream;
      15             : struct nsID;
      16             : 
      17             : namespace mozilla {
      18             : namespace dom {
      19             : 
      20             : class IPCBlobInputStreamParentCallback;
      21             : 
      22             : class IPCBlobInputStreamStorage final : public nsIObserver
      23             : {
      24             : public:
      25             :   NS_DECL_THREADSAFE_ISUPPORTS
      26             :   NS_DECL_NSIOBSERVER
      27             : 
      28             :   // This initializes the singleton and it must be called on the main-thread.
      29             :   static void
      30             :   Initialize();
      31             : 
      32             :   static IPCBlobInputStreamStorage*
      33             :   Get();
      34             : 
      35             :   void
      36             :   AddStream(nsIInputStream* aInputStream, const nsID& aID, uint64_t aChildID);
      37             : 
      38             :   void
      39             :   ForgetStream(const nsID& aID);
      40             : 
      41             :   void
      42             :   GetStream(const nsID& aID, nsIInputStream** aInputStream);
      43             : 
      44             :   void
      45             :   StoreCallback(const nsID& aID, IPCBlobInputStreamParentCallback* aCallback);
      46             : 
      47             :   already_AddRefed<IPCBlobInputStreamParentCallback>
      48             :   TakeCallback(const nsID& aID);
      49             : 
      50             : private:
      51             :   IPCBlobInputStreamStorage();
      52             :   ~IPCBlobInputStreamStorage();
      53             : 
      54           0 :   struct StreamData
      55             :   {
      56             :     nsCOMPtr<nsIInputStream> mInputStream;
      57             :     RefPtr<IPCBlobInputStreamParentCallback> mCallback;
      58             : 
      59             :     // This is the Process ID connected with this inputStream. We need to store
      60             :     // this information in order to delete it if the child crashes/shutdowns.
      61             :     uint64_t mChildID;
      62             :   };
      63             : 
      64             :   nsClassHashtable<nsIDHashKey, StreamData> mStorage;
      65             : };
      66             : 
      67             : } // namespace dom
      68             : } // namespace mozilla
      69             : 
      70             : #endif // mozilla_dom_ipc_IPCBlobInputStreamStorage_h

Generated by: LCOV version 1.13