nsIStartupCache.idl 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. /* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
  2. *
  3. * This Source Code Form is subject to the terms of the Mozilla Public
  4. * License, v. 2.0. If a copy of the MPL was not distributed with this
  5. * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
  6. #include "nsIInputStream.idl"
  7. #include "nsISupports.idl"
  8. #include "nsIObserver.idl"
  9. #include "nsIObjectOutputStream.idl"
  10. %{C++
  11. #include "mozilla/UniquePtr.h"
  12. %}
  13. [uuid(25957820-90a1-428c-8739-b0845d3cc534)]
  14. interface nsIStartupCache : nsISupports
  15. {
  16. /** This interface is provided for testing purposes only, basically
  17. * just to solve link vagaries. See docs in StartupCache.h
  18. * GetBuffer, PutBuffer, and InvalidateCache act as described
  19. * in that file. */
  20. uint32_t getBuffer(in string aID, out charPtr aBuffer);
  21. %{C++
  22. /* A more convenient interface for using from C++. */
  23. nsresult GetBuffer(const char* id, mozilla::UniquePtr<char[]>* outbuf, uint32_t* length)
  24. {
  25. char* buf;
  26. nsresult rv = GetBuffer(id, &buf, length);
  27. NS_ENSURE_SUCCESS(rv, rv);
  28. outbuf->reset(buf);
  29. return rv;
  30. }
  31. %}
  32. void putBuffer(in string aID, in string aBuffer,
  33. in uint32_t aLength);
  34. void invalidateCache();
  35. void ignoreDiskCache();
  36. /** In debug builds, wraps this object output stream with a stream that will
  37. * detect and prevent the write of a multiply-referenced non-singleton object
  38. * during serialization. In non-debug, returns an add-ref'd pointer to
  39. * original stream, unwrapped. */
  40. nsIObjectOutputStream getDebugObjectOutputStream(in nsIObjectOutputStream aStream);
  41. /* Allows clients to check whether the one-time writeout after startup
  42. * has finished yet, and also to set this variable as needed (so test
  43. * code can fire mulitple startup writes if needed).
  44. */
  45. boolean startupWriteComplete();
  46. void resetStartupWriteTimer();
  47. /* Instruct clients to always post cache ages to Telemetry, even in
  48. cases where it would not normally make sense. */
  49. void recordAgesAlways();
  50. /* Allows clients to simulate the behavior of ObserverService. */
  51. readonly attribute nsIObserver observer;
  52. };