other-licenses/7zstub/src/7zip/Common/StreamBinder.h

Tue, 06 Jan 2015 21:39:09 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Tue, 06 Jan 2015 21:39:09 +0100
branch
TOR_BUG_9701
changeset 8
97036ab72558
permissions
-rw-r--r--

Conditionally force memory storage according to privacy.thirdparty.isolate;
This solves Tor bug #9701, complying with disk avoidance documented in
https://www.torproject.org/projects/torbrowser/design/#disk-avoidance.

     1 // StreamBinder.h
     3 #ifndef __STREAMBINDER_H
     4 #define __STREAMBINDER_H
     6 #include "../IStream.h"
     7 #include "../../Windows/Synchronization.h"
     9 class CStreamBinder
    10 {
    11   NWindows::NSynchronization::CManualResetEvent *_allBytesAreWritenEvent;
    12   NWindows::NSynchronization::CManualResetEvent *_thereAreBytesToReadEvent;
    13   NWindows::NSynchronization::CManualResetEvent *_readStreamIsClosedEvent;
    14   UInt32 _bufferSize;
    15   const void *_buffer;
    16 public:
    17   // bool ReadingWasClosed;
    18   UInt64 ProcessedSize;
    19   CStreamBinder():
    20     _allBytesAreWritenEvent(NULL), 
    21     _thereAreBytesToReadEvent(NULL),
    22     _readStreamIsClosedEvent(NULL)
    23     {}
    24   ~CStreamBinder();
    25   void CreateEvents();
    27   void CreateStreams(ISequentialInStream **inStream, 
    28       ISequentialOutStream **outStream);
    29   HRESULT Read(void *data, UInt32 size, UInt32 *processedSize);
    30   void CloseRead();
    32   HRESULT Write(const void *data, UInt32 size, UInt32 *processedSize);
    33   void CloseWrite();
    34   void ReInit();
    35 };
    37 #endif

mercurial