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_WorkerDebugger_h
8 #define mozilla_dom_workers_WorkerDebugger_h
10 #include "mozilla/PerformanceTypes.h"
11 #include "mozilla/dom/WorkerScope.h"
13 #include "nsIWorkerDebugger.h"
17 class nsPIDOMWindowInner
;
19 namespace mozilla::dom
{
23 class WorkerDebugger
: public nsIWorkerDebugger
{
24 class ReportDebuggerErrorRunnable
;
25 class PostDebuggerMessageRunnable
;
27 CheckedUnsafePtr
<WorkerPrivate
> mWorkerPrivate
;
29 nsTArray
<nsCOMPtr
<nsIWorkerDebuggerListener
>> mListeners
;
32 explicit WorkerDebugger(WorkerPrivate
* aWorkerPrivate
);
35 NS_DECL_NSIWORKERDEBUGGER
37 void AssertIsOnParentThread();
41 void PostMessageToDebugger(const nsAString
& aMessage
);
43 void ReportErrorToDebugger(const nsAString
& aFilename
, uint32_t aLineno
,
44 const nsAString
& aMessage
);
47 * Sends back a PerformanceInfo struct from the counters
48 * in mWorkerPrivate. Counters are reset to zero after this call.
50 RefPtr
<PerformanceInfoPromise
> ReportPerformanceInfo();
53 virtual ~WorkerDebugger();
55 void PostMessageToDebuggerOnMainThread(const nsAString
& aMessage
);
57 void ReportErrorToDebuggerOnMainThread(const nsAString
& aFilename
,
59 const nsAString
& aMessage
);
61 nsCOMPtr
<nsPIDOMWindowInner
> DedicatedWorkerWindow();
64 } // namespace mozilla::dom
66 #endif // mozilla_dom_workers_WorkerDebugger_h