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/dom/WorkerScope.h"
12 #include "nsIWorkerDebugger.h"
16 class nsPIDOMWindowInner
;
18 namespace mozilla::dom
{
22 class WorkerDebugger
: public nsIWorkerDebugger
{
23 class ReportDebuggerErrorRunnable
;
24 class PostDebuggerMessageRunnable
;
26 CheckedUnsafePtr
<WorkerPrivate
> mWorkerPrivate
;
28 nsTArray
<nsCOMPtr
<nsIWorkerDebuggerListener
>> mListeners
;
31 explicit WorkerDebugger(WorkerPrivate
* aWorkerPrivate
);
34 NS_DECL_NSIWORKERDEBUGGER
36 void AssertIsOnParentThread();
40 void PostMessageToDebugger(const nsAString
& aMessage
);
42 void ReportErrorToDebugger(const nsAString
& aFilename
, uint32_t aLineno
,
43 const nsAString
& aMessage
);
46 virtual ~WorkerDebugger();
48 void PostMessageToDebuggerOnMainThread(const nsAString
& aMessage
);
50 void ReportErrorToDebuggerOnMainThread(const nsAString
& aFilename
,
52 const nsAString
& aMessage
);
54 nsCOMPtr
<nsPIDOMWindowInner
> DedicatedWorkerWindow();
57 } // namespace mozilla::dom
59 #endif // mozilla_dom_workers_WorkerDebugger_h