Bug 1220007 P1 Allow ConsoleReportCollectors to flush to another collector. r=bz
This commit is contained in:
@@ -79,6 +79,27 @@ ConsoleReportCollector::FlushConsoleReports(nsIDocument* aDocument)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
ConsoleReportCollector::FlushConsoleReports(nsIConsoleReportCollector* aCollector)
|
||||||
|
{
|
||||||
|
MOZ_ASSERT(aCollector);
|
||||||
|
|
||||||
|
nsTArray<PendingReport> reports;
|
||||||
|
|
||||||
|
{
|
||||||
|
MutexAutoLock lock(mMutex);
|
||||||
|
mPendingReports.SwapElements(reports);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (uint32_t i = 0; i < reports.Length(); ++i) {
|
||||||
|
PendingReport& report = reports[i];
|
||||||
|
aCollector->AddConsoleReport(report.mErrorFlags, report.mCategory,
|
||||||
|
report.mPropertiesFile, report.mSourceFileURI,
|
||||||
|
report.mLineNumber, report.mColumnNumber,
|
||||||
|
report.mMessageName, report.mStringParams);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
ConsoleReportCollector::~ConsoleReportCollector()
|
ConsoleReportCollector::~ConsoleReportCollector()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,6 +29,9 @@ public:
|
|||||||
void
|
void
|
||||||
FlushConsoleReports(nsIDocument* aDocument) override;
|
FlushConsoleReports(nsIDocument* aDocument) override;
|
||||||
|
|
||||||
|
void
|
||||||
|
FlushConsoleReports(nsIConsoleReportCollector* aCollector) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
~ConsoleReportCollector();
|
~ConsoleReportCollector();
|
||||||
|
|
||||||
|
|||||||
@@ -66,7 +66,7 @@ public:
|
|||||||
aLineNumber, aColumnNumber, aMessageName, params);
|
aLineNumber, aColumnNumber, aMessageName, params);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Flush all pending reports to the console.
|
// Flush all pending reports to the console. Main thread only.
|
||||||
//
|
//
|
||||||
// aDocument An optional document representing where to flush the
|
// aDocument An optional document representing where to flush the
|
||||||
// reports. If provided, then the corresponding window's
|
// reports. If provided, then the corresponding window's
|
||||||
@@ -74,6 +74,14 @@ public:
|
|||||||
// go to the browser console.
|
// go to the browser console.
|
||||||
virtual void
|
virtual void
|
||||||
FlushConsoleReports(nsIDocument* aDocument) = 0;
|
FlushConsoleReports(nsIDocument* aDocument) = 0;
|
||||||
|
|
||||||
|
// Flush all pending reports to another collector. May be called from any
|
||||||
|
// thread.
|
||||||
|
//
|
||||||
|
// aCollector A required collector object that will effectively take
|
||||||
|
// ownership of our currently console reports.
|
||||||
|
virtual void
|
||||||
|
FlushConsoleReports(nsIConsoleReportCollector* aCollector) = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
NS_DEFINE_STATIC_IID_ACCESSOR(nsIConsoleReportCollector, NS_NSICONSOLEREPORTCOLLECTOR_IID)
|
NS_DEFINE_STATIC_IID_ACCESSOR(nsIConsoleReportCollector, NS_NSICONSOLEREPORTCOLLECTOR_IID)
|
||||||
|
|||||||
@@ -2357,6 +2357,12 @@ HttpBaseChannel::FlushConsoleReports(nsIDocument* aDocument)
|
|||||||
mReportCollector->FlushConsoleReports(aDocument);
|
mReportCollector->FlushConsoleReports(aDocument);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
HttpBaseChannel::FlushConsoleReports(nsIConsoleReportCollector* aCollector)
|
||||||
|
{
|
||||||
|
mReportCollector->FlushConsoleReports(aCollector);
|
||||||
|
}
|
||||||
|
|
||||||
nsIPrincipal *
|
nsIPrincipal *
|
||||||
HttpBaseChannel::GetURIPrincipal()
|
HttpBaseChannel::GetURIPrincipal()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -247,6 +247,9 @@ public:
|
|||||||
void
|
void
|
||||||
FlushConsoleReports(nsIDocument* aDocument) override;
|
FlushConsoleReports(nsIDocument* aDocument) override;
|
||||||
|
|
||||||
|
void
|
||||||
|
FlushConsoleReports(nsIConsoleReportCollector* aCollector) override;
|
||||||
|
|
||||||
class nsContentEncodings : public nsIUTF8StringEnumerator
|
class nsContentEncodings : public nsIUTF8StringEnumerator
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|||||||
Reference in New Issue
Block a user