nsIThreadRetargetableRequest.idl 1.3 KB

1234567891011121314151617181920212223242526272829303132333435
  1. /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
  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. interface nsIEventTarget;
  7. /**
  8. * nsIThreadRetargetableRequest
  9. *
  10. * Should be implemented by requests that support retargeting delivery of
  11. * data off the main thread.
  12. */
  13. [uuid(27b84c48-5a73-4ba4-a8a4-8b5e649a145e)]
  14. interface nsIThreadRetargetableRequest : nsISupports
  15. {
  16. /**
  17. * Called to retarget delivery of OnDataAvailable to another thread. Should
  18. * only be called before AsyncOpen for nsIWebsocketChannels, or during
  19. * OnStartRequest for nsIChannels.
  20. * Note: For nsIChannels, OnStartRequest and OnStopRequest will still be
  21. * delivered on the main thread.
  22. *
  23. * @param aNewTarget New event target, e.g. thread or threadpool.
  24. *
  25. * Note: no return value is given. If the retargeting cannot be handled,
  26. * normal delivery to the main thread will continue. As such, listeners
  27. * should be ready to deal with OnDataAvailable on either the main thread or
  28. * the new target thread.
  29. */
  30. void retargetDeliveryTo(in nsIEventTarget aNewTarget);
  31. };