Bug 1283439 - Include OpusDecoder.h only for Rust MP4 parsing r=kinetik
[gecko.git] / startupcache / StartupCacheUtils.h
blob7a4da25434035f041f44a2d1e9059079d341e394
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"
11 #include "mozilla/UniquePtr.h"
13 namespace mozilla {
14 namespace scache {
16 NS_EXPORT nsresult
17 NewObjectInputStreamFromBuffer(UniquePtr<char[]> buffer, uint32_t len,
18 nsIObjectInputStream** stream);
20 // We can't retrieve the wrapped stream from the objectOutputStream later,
21 // so we return it here. We give callers in debug builds the option
22 // to wrap the outputstream in a debug stream, which will detect if
23 // non-singleton objects are written out multiple times during a serialization.
24 // This could cause them to be deserialized incorrectly (as multiple copies
25 // instead of references).
26 NS_EXPORT nsresult
27 NewObjectOutputWrappedStorageStream(nsIObjectOutputStream **wrapperStream,
28 nsIStorageStream** stream,
29 bool wantDebugStream);
31 // Creates a buffer for storing the stream into the cache. The buffer is
32 // allocated with 'new []'. After calling this function, the caller would
33 // typically call nsIStartupCache::PutBuffer with the returned buffer.
34 NS_EXPORT nsresult
35 NewBufferFromStorageStream(nsIStorageStream *storageStream,
36 UniquePtr<char[]>* buffer, uint32_t* len);
38 NS_EXPORT nsresult
39 PathifyURI(nsIURI *in, nsACString &out);
40 } // namespace scache
41 } // namespace mozilla
43 #endif //nsStartupCacheUtils_h_