Bug 1732219 - Add API for fetching the preview image. r=geckoview-reviewers,agi,mconley
[gecko.git] / dom / workers / WorkerCommon.h
blob8b1b46d69f2c90d851d292c285a1ba9bdbd4d9b7
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
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 file,
5 * You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #ifndef mozilla_dom_workers_WorkerCommon_h
8 #define mozilla_dom_workers_WorkerCommon_h
10 #include "js/TypeDecls.h"
12 class nsPIDOMWindowInner;
14 namespace mozilla {
15 namespace dom {
17 class WorkerPrivate;
19 // All of these are implemented in RuntimeService.cpp
21 WorkerPrivate* GetWorkerPrivateFromContext(JSContext* aCx);
23 WorkerPrivate* GetCurrentThreadWorkerPrivate();
25 bool IsCurrentThreadRunningWorker();
27 bool IsCurrentThreadRunningChromeWorker();
29 JSContext* GetCurrentWorkerThreadJSContext();
31 JSObject* GetCurrentThreadWorkerGlobal();
33 JSObject* GetCurrentThreadWorkerDebuggerGlobal();
35 void CancelWorkersForWindow(const nsPIDOMWindowInner& aWindow);
37 void FreezeWorkersForWindow(const nsPIDOMWindowInner& aWindow);
39 void ThawWorkersForWindow(const nsPIDOMWindowInner& aWindow);
41 void SuspendWorkersForWindow(const nsPIDOMWindowInner& aWindow);
43 void ResumeWorkersForWindow(const nsPIDOMWindowInner& aWindow);
45 void PropagateStorageAccessPermissionGrantedToWorkers(
46 const nsPIDOMWindowInner& aWindow);
48 // All of these are implemented in WorkerScope.cpp
50 bool IsWorkerGlobal(JSObject* global);
52 bool IsWorkerDebuggerGlobal(JSObject* global);
54 bool IsWorkerDebuggerSandbox(JSObject* object);
56 } // namespace dom
57 } // namespace mozilla
59 #endif // mozilla_dom_workers_WorkerCommon_h