xpcom/base/nsIMessageLoop.idl

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

michael@0 1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
michael@0 2 /* This Source Code Form is subject to the terms of the Mozilla Public
michael@0 3 * License, v. 2.0. If a copy of the MPL was not distributed with this
michael@0 4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
michael@0 5
michael@0 6 #include "nsISupports.idl"
michael@0 7
michael@0 8 interface nsIRunnable;
michael@0 9
michael@0 10 /**
michael@0 11 * This service allows access to the current thread's Chromium MessageLoop
michael@0 12 * instance, with some extra sugar added. If you're calling from C++, it may
michael@0 13 * or may not make sense for you to use this interface. If you're calling from
michael@0 14 * JS, you don't have a choice!
michael@0 15 *
michael@0 16 * Right now, you can only call PostIdleTask(), but nothing is stopping you
michael@0 17 * from adding other methods.
michael@0 18 *
michael@0 19 * nsIMessageLoop's contractid is "@mozilla.org/message-loop;1".
michael@0 20 */
michael@0 21 [scriptable, uuid(3E8C58E8-E52C-43E0-8E66-669CA788FF5F)]
michael@0 22 interface nsIMessageLoop : nsISupports
michael@0 23 {
michael@0 24 /**
michael@0 25 * Posts a task to be run when this thread's message loop is idle, or after
michael@0 26 * ensureRunsAfterMS milliseconds have elapsed. (That is, the task is
michael@0 27 * guaranteed to run /eventually/.)
michael@0 28 *
michael@0 29 * Note that if the event loop is busy, we will hold a reference to the task
michael@0 30 * until ensureRunsAfterMS milliseconds have elapsed. Be careful when
michael@0 31 * specifying long timeouts and tasks which hold references to windows or
michael@0 32 * other large objects, because you can leak memory in a difficult-to-detect
michael@0 33 * way!
michael@0 34 */
michael@0 35 void postIdleTask(in nsIRunnable task, in uint32_t ensureRunsAfterMS);
michael@0 36 };

mercurial