Bug 1859625 Part 3: Stop sending the GetOutputColorProfileData message. r=ipc-reviewe...
[gecko.git] / dom / console / ConsoleReportCollector.h
blob9d4e0b1aa01cea62f768782b0cac8df88197affb
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
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #ifndef mozilla_ConsoleReportCollector_h
8 #define mozilla_ConsoleReportCollector_h
10 #include "mozilla/Mutex.h"
11 #include "nsIConsoleReportCollector.h"
12 #include "nsTArray.h"
14 namespace mozilla {
16 namespace net {
17 class ConsoleReportCollected;
20 class ConsoleReportCollector final : public nsIConsoleReportCollector {
21 public:
22 ConsoleReportCollector();
24 void AddConsoleReport(uint32_t aErrorFlags, const nsACString& aCategory,
25 nsContentUtils::PropertiesFile aPropertiesFile,
26 const nsACString& aSourceFileURI, uint32_t aLineNumber,
27 uint32_t aColumnNumber, const nsACString& aMessageName,
28 const nsTArray<nsString>& aStringParams) override;
30 void FlushReportsToConsole(
31 uint64_t aInnerWindowID,
32 ReportAction aAction = ReportAction::Forget) override;
34 void FlushReportsToConsoleForServiceWorkerScope(
35 const nsACString& aScope,
36 ReportAction aAction = ReportAction::Forget) override;
38 void FlushConsoleReports(
39 dom::Document* aDocument,
40 ReportAction aAction = ReportAction::Forget) override;
42 void FlushConsoleReports(
43 nsILoadGroup* aLoadGroup,
44 ReportAction aAction = ReportAction::Forget) override;
46 void FlushConsoleReports(nsIConsoleReportCollector* aCollector) override;
48 void StealConsoleReports(
49 nsTArray<net::ConsoleReportCollected>& aReports) override;
51 void ClearConsoleReports() override;
53 private:
54 ~ConsoleReportCollector();
56 struct PendingReport {
57 PendingReport(uint32_t aErrorFlags, const nsACString& aCategory,
58 nsContentUtils::PropertiesFile aPropertiesFile,
59 const nsACString& aSourceFileURI, uint32_t aLineNumber,
60 uint32_t aColumnNumber, const nsACString& aMessageName,
61 const nsTArray<nsString>& aStringParams)
62 : mErrorFlags(aErrorFlags),
63 mCategory(aCategory),
64 mPropertiesFile(aPropertiesFile),
65 mSourceFileURI(aSourceFileURI),
66 mLineNumber(aLineNumber),
67 mColumnNumber(aColumnNumber),
68 mMessageName(aMessageName),
69 mStringParams(aStringParams.Clone()) {}
71 const uint32_t mErrorFlags;
72 const nsCString mCategory;
73 const nsContentUtils::PropertiesFile mPropertiesFile;
74 const nsCString mSourceFileURI;
75 const uint32_t mLineNumber;
76 const uint32_t mColumnNumber;
77 const nsCString mMessageName;
78 const CopyableTArray<nsString> mStringParams;
81 Mutex mMutex;
83 // protected by mMutex
84 nsTArray<PendingReport> mPendingReports MOZ_GUARDED_BY(mMutex);
86 public:
87 NS_DECL_THREADSAFE_ISUPPORTS
90 } // namespace mozilla
92 #endif // mozilla_ConsoleReportCollector_h