Example #1
0
PProcessHangMonitorChild*
mozilla::CreateHangMonitorChild(mozilla::ipc::Transport* aTransport,
                                base::ProcessId aOtherPid)
{
  MOZ_RELEASE_ASSERT(NS_IsMainThread());

  ProcessHangMonitor* monitor = ProcessHangMonitor::GetOrCreate();
  HangMonitorChild* child = new HangMonitorChild(monitor);

  monitor->MonitorLoop()->PostTask(
    FROM_HERE,
    NewRunnableMethod(child, &HangMonitorChild::Open,
                      aTransport, aOtherPid, XRE_GetIOMessageLoop()));

  return child;
}
Example #2
0
void
mozilla::CreateHangMonitorChild(Endpoint<PProcessHangMonitorChild>&& aEndpoint)
{
    MOZ_RELEASE_ASSERT(NS_IsMainThread());

    JSContext* cx = danger::GetJSContext();
    JS_AddInterruptCallback(cx, InterruptCallback);

    ProcessHangMonitor* monitor = ProcessHangMonitor::GetOrCreate();
    auto* child = new HangMonitorChild(monitor);

    monitor->MonitorLoop()->PostTask(NewNonOwningRunnableMethod
                                     <Endpoint<PProcessHangMonitorChild>&&>(child,
                                             &HangMonitorChild::Bind,
                                             Move(aEndpoint)));
}
Example #3
0
static PProcessHangMonitorParent*
CreateHangMonitorParent(ContentParent* aContentParent,
                        Endpoint<PProcessHangMonitorParent>&& aEndpoint)
{
    MOZ_RELEASE_ASSERT(NS_IsMainThread());

    ProcessHangMonitor* monitor = ProcessHangMonitor::GetOrCreate();
    auto* parent = new HangMonitorParent(monitor);

    auto* process = new HangMonitoredProcess(parent, aContentParent);
    parent->SetProcess(process);

    monitor->MonitorLoop()->PostTask(NewNonOwningRunnableMethod
                                     <Endpoint<PProcessHangMonitorParent>&&>(parent,
                                             &HangMonitorParent::Bind,
                                             Move(aEndpoint)));

    return parent;
}
Example #4
0
PProcessHangMonitorParent*
mozilla::CreateHangMonitorParent(ContentParent* aContentParent,
                                 mozilla::ipc::Transport* aTransport,
                                 base::ProcessId aOtherPid)
{
  MOZ_RELEASE_ASSERT(NS_IsMainThread());

  ProcessHangMonitor* monitor = ProcessHangMonitor::GetOrCreate();
  HangMonitorParent* parent = new HangMonitorParent(monitor);

  HangMonitoredProcess* process = new HangMonitoredProcess(parent, aContentParent);
  parent->SetProcess(process);

  monitor->MonitorLoop()->PostTask(
    FROM_HERE,
    NewRunnableMethod(parent, &HangMonitorParent::Open,
                      aTransport, aOtherPid, XRE_GetIOMessageLoop()));

  return parent;
}
PProcessHangMonitorChild*
mozilla::CreateHangMonitorChild(mozilla::ipc::Transport* aTransport,
                                base::ProcessId aOtherPid)
{
  MOZ_RELEASE_ASSERT(NS_IsMainThread());

  JSContext* cx = danger::GetJSContext();
  JS_AddInterruptCallback(cx, InterruptCallback);

  ProcessHangMonitor* monitor = ProcessHangMonitor::GetOrCreate();
  HangMonitorChild* child = new HangMonitorChild(monitor);

  monitor->MonitorLoop()->PostTask(NewNonOwningRunnableMethod
                                   <mozilla::ipc::Transport*,
                                    base::ProcessId,
                                    MessageLoop*>(child,
                                                  &HangMonitorChild::Open,
                                                  aTransport, aOtherPid,
                                                  XRE_GetIOMessageLoop()));

  return child;
}