xpcom/base/nsIMessageLoop.idl

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/xpcom/base/nsIMessageLoop.idl	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,36 @@
     1.4 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
     1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public
     1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.8 +
     1.9 +#include "nsISupports.idl"
    1.10 +
    1.11 +interface nsIRunnable;
    1.12 +
    1.13 +/**
    1.14 + * This service allows access to the current thread's Chromium MessageLoop
    1.15 + * instance, with some extra sugar added.  If you're calling from C++, it may
    1.16 + * or may not make sense for you to use this interface.  If you're calling from
    1.17 + * JS, you don't have a choice!
    1.18 + *
    1.19 + * Right now, you can only call PostIdleTask(), but nothing is stopping you
    1.20 + * from adding other methods.
    1.21 + *
    1.22 + * nsIMessageLoop's contractid is "@mozilla.org/message-loop;1".
    1.23 + */
    1.24 +[scriptable, uuid(3E8C58E8-E52C-43E0-8E66-669CA788FF5F)]
    1.25 +interface nsIMessageLoop : nsISupports
    1.26 +{
    1.27 +  /**
    1.28 +   * Posts a task to be run when this thread's message loop is idle, or after
    1.29 +   * ensureRunsAfterMS milliseconds have elapsed.  (That is, the task is
    1.30 +   * guaranteed to run /eventually/.)
    1.31 +   *
    1.32 +   * Note that if the event loop is busy, we will hold a reference to the task
    1.33 +   * until ensureRunsAfterMS milliseconds have elapsed.  Be careful when
    1.34 +   * specifying long timeouts and tasks which hold references to windows or
    1.35 +   * other large objects, because you can leak memory in a difficult-to-detect
    1.36 +   * way!
    1.37 +   */
    1.38 +  void postIdleTask(in nsIRunnable task, in uint32_t ensureRunsAfterMS);
    1.39 +};

mercurial