nsIRequestContext.idl 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
  2. /* This Source Code Form is subject to the terms of the Mozilla Public
  3. * License, v. 2.0. If a copy of the MPL was not distributed with this
  4. * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
  5. #include "nsISupports.idl"
  6. %{C++
  7. // Forward-declare mozilla::net::SpdyPushCache
  8. namespace mozilla {
  9. namespace net {
  10. class SpdyPushCache;
  11. }
  12. }
  13. %}
  14. [ptr] native SpdyPushCachePtr(mozilla::net::SpdyPushCache);
  15. /**
  16. * The nsIRequestContext is used to maintain state about connections
  17. * that are in some way associated with each other (often by being part
  18. * of the same load group) and how they interact with blocking items like
  19. * HEAD css/js loads.
  20. *
  21. * This used to be known as nsILoadGroupConnectionInfo and nsISchedulingContext.
  22. */
  23. [scriptable, uuid(658e3e6e-8633-4b1a-8d66-fa9f72293e63)]
  24. interface nsIRequestContext : nsISupports
  25. {
  26. /**
  27. * A unique identifier for this request context
  28. */
  29. [noscript] readonly attribute nsID ID;
  30. /**
  31. * Number of active blocking transactions associated with this context
  32. */
  33. readonly attribute unsigned long blockingTransactionCount;
  34. /**
  35. * Increase the number of active blocking transactions associated
  36. * with this context by one.
  37. */
  38. void addBlockingTransaction();
  39. /**
  40. * Decrease the number of active blocking transactions associated
  41. * with this context by one. The return value is the number of remaining
  42. * blockers.
  43. */
  44. unsigned long removeBlockingTransaction();
  45. /**
  46. * This gives out a weak pointer to the push cache.
  47. * The nsIRequestContext implementation owns the cache
  48. * and will destroy it when overwritten or when the context
  49. * ends.
  50. */
  51. [noscript] attribute SpdyPushCachePtr spdyPushCache;
  52. /**
  53. * This holds a cached value of the user agent override.
  54. */
  55. [noscript] attribute ACString userAgentOverride;
  56. };
  57. /**
  58. * The nsIRequestContextService is how anyone gets access to a request
  59. * context when they haven't been explicitly given a strong reference to an
  60. * existing one. It is responsible for creating and handing out strong
  61. * references to nsIRequestContexts, but only keeps weak references itself.
  62. * The shared request context will go away once no one else is keeping a
  63. * reference to it. If you ask for a request context that has no one else
  64. * holding a reference to it, you'll get a brand new request context. Anyone
  65. * who asks for the same request context while you're holding a reference
  66. * will get a reference to the same request context you have.
  67. */
  68. [uuid(7fcbf4da-d828-4acc-b144-e5435198f727)]
  69. interface nsIRequestContextService : nsISupports
  70. {
  71. /**
  72. * Get an existing request context from its ID
  73. */
  74. nsIRequestContext getRequestContext(in nsIDRef id);
  75. /**
  76. * Create a new request context identifier
  77. */
  78. nsID newRequestContextID();
  79. /**
  80. * Remove an existing request context from its ID
  81. */
  82. void removeRequestContext(in nsIDRef id);
  83. };