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"
|
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
namespace scache {
|
|
|
|
|
|
|
|
NS_EXPORT nsresult
|
2011-07-20 11:39:09 +04:00
|
|
|
NewObjectInputStreamFromBuffer(char* buffer, PRUint32 len,
|
|
|
|
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
|
|
|
|
// allocated with 'new []'. Typically, the caller would store the buffer in
|
|
|
|
// an nsAutoArrayPtr<char> and then call nsIStartupCache::PutBuffer with it.
|
2010-08-12 23:37:44 +04:00
|
|
|
NS_EXPORT nsresult
|
2011-07-20 11:39:09 +04:00
|
|
|
NewBufferFromStorageStream(nsIStorageStream *storageStream,
|
|
|
|
char** buffer, PRUint32* 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);
|
2010-08-12 23:37:44 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif //nsStartupCacheUtils_h_
|