2010-08-12 19:37:44 +00:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2; -*- */
|
2012-05-21 11:12:37 +00: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 19:37:44 +00:00
|
|
|
#ifndef nsStartupCacheUtils_h_
|
|
|
|
#define nsStartupCacheUtils_h_
|
|
|
|
|
|
|
|
#include "nsIStorageStream.h"
|
|
|
|
#include "nsIObjectInputStream.h"
|
|
|
|
#include "nsIObjectOutputStream.h"
|
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
namespace scache {
|
|
|
|
|
|
|
|
NS_EXPORT nsresult
|
2012-08-22 15:56:38 +00:00
|
|
|
NewObjectInputStreamFromBuffer(char* buffer, uint32_t len,
|
2011-07-20 07:39:09 +00:00
|
|
|
nsIObjectInputStream** stream);
|
2010-08-12 19:37:44 +00:00
|
|
|
|
|
|
|
// We can't retrieve the wrapped stream from the objectOutputStream later,
|
2010-08-12 19:42:36 +00: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 19:37:44 +00:00
|
|
|
NS_EXPORT nsresult
|
2011-07-20 07:39:09 +00:00
|
|
|
NewObjectOutputWrappedStorageStream(nsIObjectOutputStream **wrapperStream,
|
|
|
|
nsIStorageStream** stream,
|
2011-09-29 06:19:26 +00:00
|
|
|
bool wantDebugStream);
|
2010-08-12 19:37:44 +00:00
|
|
|
|
2011-11-03 20:39:08 +00: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 19:37:44 +00:00
|
|
|
NS_EXPORT nsresult
|
2011-07-20 07:39:09 +00:00
|
|
|
NewBufferFromStorageStream(nsIStorageStream *storageStream,
|
2012-08-22 15:56:38 +00:00
|
|
|
char** buffer, uint32_t* len);
|
2011-06-16 04:54:47 +00:00
|
|
|
|
|
|
|
NS_EXPORT nsresult
|
2011-07-20 07:39:09 +00:00
|
|
|
PathifyURI(nsIURI *in, nsACString &out);
|
2010-08-12 19:37:44 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif //nsStartupCacheUtils_h_
|