Tue, 06 Jan 2015 21:39:09 +0100
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.
michael@0 | 1 | /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ |
michael@0 | 2 | /* This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 3 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 4 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 5 | |
michael@0 | 6 | #include "nsIInputStream.idl" |
michael@0 | 7 | |
michael@0 | 8 | interface nsIOutputStream; |
michael@0 | 9 | interface nsIEventTarget; |
michael@0 | 10 | |
michael@0 | 11 | /** |
michael@0 | 12 | * A nsIInputStreamTee is a wrapper for an input stream, that when read |
michael@0 | 13 | * reads the specified amount of data from its |source| and copies that |
michael@0 | 14 | * data to its |sink|. |sink| must be a blocking output stream. |
michael@0 | 15 | */ |
michael@0 | 16 | [scriptable, uuid(90a9d790-3bca-421e-a73b-98f68e13c917)] |
michael@0 | 17 | interface nsIInputStreamTee : nsIInputStream |
michael@0 | 18 | { |
michael@0 | 19 | attribute nsIInputStream source; |
michael@0 | 20 | attribute nsIOutputStream sink; |
michael@0 | 21 | |
michael@0 | 22 | /** |
michael@0 | 23 | * If |eventTarget| is set, copying to sink is done asynchronously using |
michael@0 | 24 | * the event-target (e.g. a thread). If |eventTarget| is not set, copying |
michael@0 | 25 | * to sink happens synchronously while reading from the source. |
michael@0 | 26 | */ |
michael@0 | 27 | attribute nsIEventTarget eventTarget; |
michael@0 | 28 | }; |
michael@0 | 29 | |
michael@0 | 30 | %{C++ |
michael@0 | 31 | // factory methods |
michael@0 | 32 | extern nsresult |
michael@0 | 33 | NS_NewInputStreamTee(nsIInputStream **tee, // read from this input stream |
michael@0 | 34 | nsIInputStream *source, |
michael@0 | 35 | nsIOutputStream *sink); |
michael@0 | 36 | |
michael@0 | 37 | extern nsresult |
michael@0 | 38 | NS_NewInputStreamTeeAsync(nsIInputStream **tee, // read from this input stream |
michael@0 | 39 | nsIInputStream *source, |
michael@0 | 40 | nsIOutputStream *sink, |
michael@0 | 41 | nsIEventTarget *eventTarget); |
michael@0 | 42 | %} |