worker_thread_util.h 931 B

1234567891011121314151617181920212223242526272829303132
  1. // Copyright 2019 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. #ifndef EXTENSIONS_RENDERER_WORKER_THREAD_UTIL_H_
  5. #define EXTENSIONS_RENDERER_WORKER_THREAD_UTIL_H_
  6. namespace blink {
  7. class WebServiceWorkerContextProxy;
  8. }
  9. namespace extensions {
  10. namespace worker_thread_util {
  11. // Returns true if the current thread is a worker thread.
  12. bool IsWorkerThread();
  13. // Stores the proxy of Service Worker's global scope for current worker thread.
  14. //
  15. // Valid only on worker thread.
  16. void SetWorkerContextProxy(blink::WebServiceWorkerContextProxy* proxy);
  17. // Returns true if the current Service Worker global scope has an active
  18. // interaction.
  19. //
  20. // Valid only on worker thread.
  21. bool HasWorkerContextProxyInteraction();
  22. } // namespace worker_thread_util
  23. } // namespace extensions
  24. #endif // EXTENSIONS_RENDERER_WORKER_THREAD_UTIL_H_