startupcache/StartupCacheUtils.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/startupcache/StartupCacheUtils.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,41 @@
     1.4 +/* -*-  Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2; -*- */
     1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public
     1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.8 +#ifndef nsStartupCacheUtils_h_
     1.9 +#define nsStartupCacheUtils_h_
    1.10 +
    1.11 +#include "nsIStorageStream.h"
    1.12 +#include "nsIObjectInputStream.h"
    1.13 +#include "nsIObjectOutputStream.h"
    1.14 +
    1.15 +namespace mozilla {
    1.16 +namespace scache {
    1.17 +
    1.18 +NS_EXPORT nsresult
    1.19 +NewObjectInputStreamFromBuffer(char* buffer, uint32_t len, 
    1.20 +                               nsIObjectInputStream** stream);
    1.21 +
    1.22 +// We can't retrieve the wrapped stream from the objectOutputStream later,
    1.23 +// so we return it here. We give callers in debug builds the option 
    1.24 +// to wrap the outputstream in a debug stream, which will detect if
    1.25 +// non-singleton objects are written out multiple times during a serialization.
    1.26 +// This could cause them to be deserialized incorrectly (as multiple copies
    1.27 +// instead of references).
    1.28 +NS_EXPORT nsresult
    1.29 +NewObjectOutputWrappedStorageStream(nsIObjectOutputStream **wrapperStream,
    1.30 +                                    nsIStorageStream** stream,
    1.31 +                                    bool wantDebugStream);
    1.32 +
    1.33 +// Creates a buffer for storing the stream into the cache. The buffer is
    1.34 +// allocated with 'new []'. Typically, the caller would store the buffer in
    1.35 +// an nsAutoArrayPtr<char> and then call nsIStartupCache::PutBuffer with it.
    1.36 +NS_EXPORT nsresult
    1.37 +NewBufferFromStorageStream(nsIStorageStream *storageStream, 
    1.38 +                           char** buffer, uint32_t* len);
    1.39 +
    1.40 +NS_EXPORT nsresult
    1.41 +PathifyURI(nsIURI *in, nsACString &out);
    1.42 +}
    1.43 +}
    1.44 +#endif //nsStartupCacheUtils_h_

mercurial