2010-08-12 23:37:44 +04:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2; -*- */
|
2012-05-21 15:12:37 +04:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
2010-08-12 23:37:44 +04:00
|
|
|
#ifndef nsStartupCacheUtils_h_
|
|
|
|
#define nsStartupCacheUtils_h_
|
|
|
|
|
|
|
|
#include "nsIStorageStream.h"
|
|
|
|
#include "nsIObjectInputStream.h"
|
|
|
|
#include "nsIObjectOutputStream.h"
|
2016-02-18 19:14:02 +03:00
|
|
|
#include "mozilla/UniquePtr.h"
|
2010-08-12 23:37:44 +04:00
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
namespace scache {
|
|
|
|
|
|
|
|
NS_EXPORT nsresult
|
2016-02-18 19:14:02 +03:00
|
|
|
NewObjectInputStreamFromBuffer(UniquePtr<char[]> buffer, uint32_t len,
|
2011-07-20 11:39:09 +04:00
|
|
|
nsIObjectInputStream** stream);
|
2010-08-12 23:37:44 +04:00
|
|
|
|
|
|
|
// We can't retrieve the wrapped stream from the objectOutputStream later,
|
2010-08-12 23:42:36 +04:00
|
|
|
// so we return it here. We give callers in debug builds the option
|
|
|
|
// to wrap the outputstream in a debug stream, which will detect if
|
|
|
|
// non-singleton objects are written out multiple times during a serialization.
|
|
|
|
// This could cause them to be deserialized incorrectly (as multiple copies
|
|
|
|
// instead of references).
|
2010-08-12 23:37:44 +04:00
|
|
|
NS_EXPORT nsresult
|
2011-07-20 11:39:09 +04:00
|
|
|
NewObjectOutputWrappedStorageStream(nsIObjectOutputStream **wrapperStream,
|
|
|
|
nsIStorageStream** stream,
|
2011-09-29 10:19:26 +04:00
|
|
|
bool wantDebugStream);
|
2010-08-12 23:37:44 +04:00
|
|
|
|
2011-11-04 00:39:08 +04:00
|
|
|
// Creates a buffer for storing the stream into the cache. The buffer is
|
2016-02-18 20:04:40 +03:00
|
|
|
// allocated with 'new []'. After calling this function, the caller would
|
|
|
|
// typically call nsIStartupCache::PutBuffer with the returned buffer.
|
2010-08-12 23:37:44 +04:00
|
|
|
NS_EXPORT nsresult
|
2011-07-20 11:39:09 +04:00
|
|
|
NewBufferFromStorageStream(nsIStorageStream *storageStream,
|
2016-02-18 20:04:40 +03:00
|
|
|
UniquePtr<char[]>* buffer, uint32_t* len);
|
2011-06-16 08:54:47 +04:00
|
|
|
|
|
|
|
NS_EXPORT nsresult
|
2011-07-20 11:39:09 +04:00
|
|
|
PathifyURI(nsIURI *in, nsACString &out);
|
2015-07-13 18:25:42 +03:00
|
|
|
} // namespace scache
|
|
|
|
} // namespace mozilla
|
|
|
|
|
2010-08-12 23:37:44 +04:00
|
|
|
#endif //nsStartupCacheUtils_h_
|