Wed, 31 Dec 2014 06:55:50 +0100
Added tag UPSTREAM_283F7C6 for changeset ca08bd8f51b2
michael@0 | 1 | /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2; -*- */ |
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 | #ifndef nsStartupCacheUtils_h_ |
michael@0 | 6 | #define nsStartupCacheUtils_h_ |
michael@0 | 7 | |
michael@0 | 8 | #include "nsIStorageStream.h" |
michael@0 | 9 | #include "nsIObjectInputStream.h" |
michael@0 | 10 | #include "nsIObjectOutputStream.h" |
michael@0 | 11 | |
michael@0 | 12 | namespace mozilla { |
michael@0 | 13 | namespace scache { |
michael@0 | 14 | |
michael@0 | 15 | NS_EXPORT nsresult |
michael@0 | 16 | NewObjectInputStreamFromBuffer(char* buffer, uint32_t len, |
michael@0 | 17 | nsIObjectInputStream** stream); |
michael@0 | 18 | |
michael@0 | 19 | // We can't retrieve the wrapped stream from the objectOutputStream later, |
michael@0 | 20 | // so we return it here. We give callers in debug builds the option |
michael@0 | 21 | // to wrap the outputstream in a debug stream, which will detect if |
michael@0 | 22 | // non-singleton objects are written out multiple times during a serialization. |
michael@0 | 23 | // This could cause them to be deserialized incorrectly (as multiple copies |
michael@0 | 24 | // instead of references). |
michael@0 | 25 | NS_EXPORT nsresult |
michael@0 | 26 | NewObjectOutputWrappedStorageStream(nsIObjectOutputStream **wrapperStream, |
michael@0 | 27 | nsIStorageStream** stream, |
michael@0 | 28 | bool wantDebugStream); |
michael@0 | 29 | |
michael@0 | 30 | // Creates a buffer for storing the stream into the cache. The buffer is |
michael@0 | 31 | // allocated with 'new []'. Typically, the caller would store the buffer in |
michael@0 | 32 | // an nsAutoArrayPtr<char> and then call nsIStartupCache::PutBuffer with it. |
michael@0 | 33 | NS_EXPORT nsresult |
michael@0 | 34 | NewBufferFromStorageStream(nsIStorageStream *storageStream, |
michael@0 | 35 | char** buffer, uint32_t* len); |
michael@0 | 36 | |
michael@0 | 37 | NS_EXPORT nsresult |
michael@0 | 38 | PathifyURI(nsIURI *in, nsACString &out); |
michael@0 | 39 | } |
michael@0 | 40 | } |
michael@0 | 41 | #endif //nsStartupCacheUtils_h_ |