bug 812562 - click-to-play: reshow notification for blocklisted plugins r=jaws
[gecko.git] / startupcache / StartupCacheUtils.h
blobe4023d86abcd4ec0954204ec3851ee198014f128
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2; -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5 #ifndef nsStartupCacheUtils_h_
6 #define nsStartupCacheUtils_h_
8 #include "nsIStorageStream.h"
9 #include "nsIObjectInputStream.h"
10 #include "nsIObjectOutputStream.h"
12 namespace mozilla {
13 namespace scache {
15 NS_EXPORT nsresult
16 NewObjectInputStreamFromBuffer(char* buffer, uint32_t len,
17 nsIObjectInputStream** stream);
19 // We can't retrieve the wrapped stream from the objectOutputStream later,
20 // so we return it here. We give callers in debug builds the option
21 // to wrap the outputstream in a debug stream, which will detect if
22 // non-singleton objects are written out multiple times during a serialization.
23 // This could cause them to be deserialized incorrectly (as multiple copies
24 // instead of references).
25 NS_EXPORT nsresult
26 NewObjectOutputWrappedStorageStream(nsIObjectOutputStream **wrapperStream,
27 nsIStorageStream** stream,
28 bool wantDebugStream);
30 // Creates a buffer for storing the stream into the cache. The buffer is
31 // allocated with 'new []'. Typically, the caller would store the buffer in
32 // an nsAutoArrayPtr<char> and then call nsIStartupCache::PutBuffer with it.
33 NS_EXPORT nsresult
34 NewBufferFromStorageStream(nsIStorageStream *storageStream,
35 char** buffer, uint32_t* len);
37 NS_EXPORT nsresult
38 PathifyURI(nsIURI *in, nsACString &out);
41 #endif //nsStartupCacheUtils_h_