LCOV - code coverage report
Current view: top level - ipc/glue - nsIIPCSerializableInputStream.h (source / functions) Hit Total Coverage
Test: output.info Lines: 1 1 100.0 %
Date: 2017-07-14 16:53:18 Functions: 1 1 100.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 file,
       5             :  * You can obtain one at http://mozilla.org/MPL/2.0/. */
       6             : 
       7             : #ifndef mozilla_ipc_nsIIPCSerializableInputStream_h
       8             : #define mozilla_ipc_nsIIPCSerializableInputStream_h
       9             : 
      10             : #include "mozilla/Attributes.h"
      11             : #include "mozilla/Maybe.h"
      12             : #include "nsISupports.h"
      13             : #include "nsTArrayForwardDeclare.h"
      14             : 
      15             : namespace mozilla {
      16             : namespace ipc {
      17             : 
      18             : class FileDescriptor;
      19             : class InputStreamParams;
      20             : 
      21             : } // namespace ipc
      22             : } // namespace mozilla
      23             : 
      24             : #define NS_IIPCSERIALIZABLEINPUTSTREAM_IID \
      25             :   {0xb0211b14, 0xea6d, 0x40d4, {0x87, 0xb5, 0x7b, 0xe3, 0xdf, 0xac, 0x09, 0xd1}}
      26             : 
      27         462 : class NS_NO_VTABLE nsIIPCSerializableInputStream : public nsISupports
      28             : {
      29             : public:
      30             :   typedef nsTArray<mozilla::ipc::FileDescriptor>
      31             :           FileDescriptorArray;
      32             : 
      33             :   NS_DECLARE_STATIC_IID_ACCESSOR(NS_IIPCSERIALIZABLEINPUTSTREAM_IID)
      34             : 
      35             :   virtual void
      36             :   Serialize(mozilla::ipc::InputStreamParams& aParams,
      37             :             FileDescriptorArray& aFileDescriptors) = 0;
      38             : 
      39             :   virtual bool
      40             :   Deserialize(const mozilla::ipc::InputStreamParams& aParams,
      41             :               const FileDescriptorArray& aFileDescriptors) = 0;
      42             : 
      43             :   // The number of bytes that are expected to be written when this
      44             :   // stream is serialized. A value of Some(N) indicates that N bytes
      45             :   // will be written to the IPC buffer, and will be used to decide
      46             :   // upon an optimal transmission mechanism. A value of Nothing
      47             :   // indicates that either serializing this stream will not require
      48             :   // serializing its contents (eg. a file-backed stream, or a stream
      49             :   // backed by an IPC actor), or the length of the stream's contents
      50             :   // cannot be determined.
      51             :   virtual mozilla::Maybe<uint64_t>
      52             :   ExpectedSerializedLength() = 0;
      53             : };
      54             : 
      55             : NS_DEFINE_STATIC_IID_ACCESSOR(nsIIPCSerializableInputStream,
      56             :                               NS_IIPCSERIALIZABLEINPUTSTREAM_IID)
      57             : 
      58             : #define NS_DECL_NSIIPCSERIALIZABLEINPUTSTREAM                                  \
      59             :   virtual void                                                                 \
      60             :   Serialize(mozilla::ipc::InputStreamParams&,                                  \
      61             :             FileDescriptorArray&) override;                                    \
      62             :                                                                                \
      63             :   virtual bool                                                                 \
      64             :   Deserialize(const mozilla::ipc::InputStreamParams&,                          \
      65             :               const FileDescriptorArray&) override;                            \
      66             :                                                                                \
      67             :   virtual mozilla::Maybe<uint64_t>                                             \
      68             :   ExpectedSerializedLength() override;
      69             : 
      70             : #define NS_FORWARD_NSIIPCSERIALIZABLEINPUTSTREAM(_to)                          \
      71             :   virtual void                                                                 \
      72             :   Serialize(mozilla::ipc::InputStreamParams& aParams,                          \
      73             :             FileDescriptorArray& aFileDescriptors) override                    \
      74             :   {                                                                            \
      75             :     _to Serialize(aParams, aFileDescriptors);                                  \
      76             :   }                                                                            \
      77             :                                                                                \
      78             :   virtual bool                                                                 \
      79             :   Deserialize(const mozilla::ipc::InputStreamParams& aParams,                  \
      80             :               const FileDescriptorArray& aFileDescriptors) override            \
      81             :   {                                                                            \
      82             :     return _to Deserialize(aParams, aFileDescriptors);                         \
      83             :   }                                                                            \
      84             :                                                                                \
      85             :   virtual mozilla::Maybe<uint64_t>                                             \
      86             :   ExpectedSerializedLength() override                                          \
      87             :   {                                                                            \
      88             :     return _to ExpectedSerializedLength();                                     \
      89             :   }
      90             : 
      91             : #define NS_FORWARD_SAFE_NSIIPCSERIALIZABLEINPUTSTREAM(_to)                     \
      92             :   virtual void                                                                 \
      93             :   Serialize(mozilla::ipc::InputStreamParams& aParams,                          \
      94             :             FileDescriptorArray& aFileDescriptors) override                    \
      95             :   {                                                                            \
      96             :     if (_to) {                                                                 \
      97             :       _to->Serialize(aParams, aFileDescriptors);                               \
      98             :     }                                                                          \
      99             :   }                                                                            \
     100             :                                                                                \
     101             :   virtual bool                                                                 \
     102             :   Deserialize(const mozilla::ipc::InputStreamParams& aParams,                  \
     103             :               const FileDescriptorArray& aFileDescriptors) override            \
     104             :   {                                                                            \
     105             :     return _to ? _to->Deserialize(aParams, aFileDescriptors) : false;          \
     106             :   }                                                                            \
     107             :                                                                                \
     108             :   virtual mozilla::Maybe<uint64_t>                                             \
     109             :   ExpectedSerializedLength() override                                          \
     110             :   {                                                                            \
     111             :     return _to ? _to->ExpectedSerializedLength() : Nothing();                  \
     112             :   }
     113             : 
     114             : #endif // mozilla_ipc_nsIIPCSerializableInputStream_h

Generated by: LCOV version 1.13