diff options
Diffstat (limited to 'dom/ipc/ProcessHangMonitor.cpp')
-rw-r--r-- | dom/ipc/ProcessHangMonitor.cpp | 30 |
1 files changed, 25 insertions, 5 deletions
diff --git a/dom/ipc/ProcessHangMonitor.cpp b/dom/ipc/ProcessHangMonitor.cpp index 1dcba24406..7b0f45598c 100644 --- a/dom/ipc/ProcessHangMonitor.cpp +++ b/dom/ipc/ProcessHangMonitor.cpp @@ -86,6 +86,8 @@ using namespace mozilla::ipc; namespace { +LazyLogModule gQoSLog("QoSPriority"); // For RecvSetMainThreadQoSPriority. + /* Child process objects */ class HangMonitorChild : public PProcessHangMonitorChild, @@ -560,12 +562,10 @@ mozilla::ipc::IPCResult HangMonitorChild::RecvRequestContentJSInterrupt() { // In order to cancel JS execution on shutdown, we expect that // ProcessChild::NotifiedImpendingShutdown has been called before. if (mozilla::ipc::ProcessChild::ExpectingShutdown()) { - CrashReporter::AppendToCrashReportAnnotation( - CrashReporter::Annotation::IPCShutdownState, + ProcessChild::AppendToIPCShutdownStateAnnotation( "HangMonitorChild::RecvRequestContentJSInterrupt (expected)"_ns); } else { - CrashReporter::AppendToCrashReportAnnotation( - CrashReporter::Annotation::IPCShutdownState, + ProcessChild::AppendToIPCShutdownStateAnnotation( "HangMonitorChild::RecvRequestContentJSInterrupt (unexpected)"_ns); } JS_RequestInterruptCallback(mContext); @@ -651,9 +651,21 @@ mozilla::ipc::IPCResult HangMonitorChild::RecvCancelContentJSExecutionIfRunning( return IPC_OK(); } +const char* DefineQoS(const nsIThread::QoSPriority& aQoSPriority) { + if (aQoSPriority == nsIThread::QOS_PRIORITY_LOW) { + return "BACKGROUND"; + } + // As of right now, all non-low QoS priorities default to the thread's normal + // priority. + return "NORMAL"; +} + mozilla::ipc::IPCResult HangMonitorChild::RecvSetMainThreadQoSPriority( const nsIThread::QoSPriority& aQoSPriority) { MOZ_RELEASE_ASSERT(IsOnThread()); + MOZ_LOG(gQoSLog, LogLevel::Debug, + ("Priority change %s recieved by content process.", + DefineQoS(aQoSPriority))); #ifdef XP_MACOSX // If the new priority is the background (low) priority, we can tell the OS to @@ -672,14 +684,22 @@ mozilla::ipc::IPCResult HangMonitorChild::RecvSetMainThreadQoSPriority( pthread_override_qos_class_start_np(mMainPThread, qosClass, 0); if (NS_FAILED(NS_DispatchToMainThread(NS_NewRunnableFunction( "HangMonitorChild::RecvSetMainThreadQoSPriority", - [qosClass, qosOverride] { + [qosClass, qosOverride, aQoSPriority] { + MOZ_LOG( + gQoSLog, LogLevel::Debug, + ("Override %s sent to main thread.", DefineQoS(aQoSPriority))); pthread_set_qos_class_self_np(qosClass, 0); if (qosOverride) { pthread_override_qos_class_end_np(qosOverride); + MOZ_LOG(gQoSLog, LogLevel::Debug, + ("Override %s removed from main thread.", + DefineQoS(aQoSPriority))); } })))) { // If we fail to dispatch, go ahead and end the override anyway. pthread_override_qos_class_end_np(qosOverride); + MOZ_LOG(gQoSLog, LogLevel::Debug, + ("Override %s removed from main thread.", DefineQoS(aQoSPriority))); } #endif |