Bug 1308039 - Preempt GC to paint (r=mrbkap)
authorBill McCloskey <billm@mozilla.com>
Thu, 06 Oct 2016 17:20:58 -0700
changeset 423587 3d42c7605d818d6e277d570a8fc4309cf5019ee1
parent 423586 2fc4ea870154988aaabb3df7826e2617b8370062
child 423588 6147b5ffb4a0e001f8f3b7aa7db14cbdaad395a9
push id31945
push users.kaspari@gmail.com
push dateTue, 11 Oct 2016 12:27:19 +0000
reviewersmrbkap
bugs1308039
milestone52.0a1
Bug 1308039 - Preempt GC to paint (r=mrbkap)
dom/ipc/ProcessHangMonitor.cpp
--- a/dom/ipc/ProcessHangMonitor.cpp
+++ b/dom/ipc/ProcessHangMonitor.cpp
@@ -302,17 +302,17 @@ HangMonitorChild::InterruptCallback()
     forcePaintEpoch = mForcePaintEpoch;
 
     mForcePaint = false;
   }
 
   if (forcePaint) {
     RefPtr<TabChild> tabChild = TabChild::FindTabChild(forcePaintTab);
     if (tabChild) {
-      JS::AutoAssertOnGC aaogc(mContext);
+      JS::AutoAssertOnGC nogc(mContext);
       JS::AutoAssertOnBarrier nobarrier(mContext);
       tabChild->ForcePaint(forcePaintEpoch);
     }
   }
 }
 
 void
 HangMonitorChild::Shutdown()
@@ -385,16 +385,17 @@ HangMonitorChild::RecvForcePaint(const T
   {
     MonitorAutoLock lock(mMonitor);
     mForcePaint = true;
     mForcePaintTab = aTabId;
     mForcePaintEpoch = aLayerObserverEpoch;
   }
 
   JS_RequestInterruptCallback(mContext);
+  JS::RequestGCInterruptCallback(mContext);
 
   return true;
 }
 
 void
 HangMonitorChild::Open(Transport* aTransport, ProcessId aPid,
                        MessageLoop* aIOLoop)
 {
@@ -1183,16 +1184,17 @@ mozilla::CreateHangMonitorParent(Content
 PProcessHangMonitorChild*
 mozilla::CreateHangMonitorChild(mozilla::ipc::Transport* aTransport,
                                 base::ProcessId aOtherPid)
 {
   MOZ_RELEASE_ASSERT(NS_IsMainThread());
 
   JSContext* cx = danger::GetJSContext();
   JS_AddInterruptCallback(cx, InterruptCallback);
+  JS::AddGCInterruptCallback(cx, InterruptCallback);
 
   ProcessHangMonitor* monitor = ProcessHangMonitor::GetOrCreate();
   HangMonitorChild* child = new HangMonitorChild(monitor);
 
   monitor->MonitorLoop()->PostTask(NewNonOwningRunnableMethod
                                    <mozilla::ipc::Transport*,
                                     base::ProcessId,
                                     MessageLoop*>(child,