Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
michael@0 | 1 | /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
michael@0 | 2 | /* vim:set ts=2 sw=2 sts=2 et cindent: */ |
michael@0 | 3 | /* This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 4 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 5 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 6 | |
michael@0 | 7 | #include "nsISupports.idl" |
michael@0 | 8 | |
michael@0 | 9 | [ptr] native PRThread(PRThread); |
michael@0 | 10 | |
michael@0 | 11 | interface nsIThread; |
michael@0 | 12 | |
michael@0 | 13 | /** |
michael@0 | 14 | * An interface for creating and locating nsIThread instances. |
michael@0 | 15 | */ |
michael@0 | 16 | [scriptable, uuid(1be89eca-e2f7-453b-8d38-c11ba247f6f3)] |
michael@0 | 17 | interface nsIThreadManager : nsISupports |
michael@0 | 18 | { |
michael@0 | 19 | /** |
michael@0 | 20 | * Default number of bytes reserved for a thread's stack, if no stack size |
michael@0 | 21 | * is specified in newThread(). 0 means use platform default. |
michael@0 | 22 | */ |
michael@0 | 23 | const unsigned long DEFAULT_STACK_SIZE = 0; |
michael@0 | 24 | |
michael@0 | 25 | /** |
michael@0 | 26 | * Create a new thread (a global, user PRThread). |
michael@0 | 27 | * |
michael@0 | 28 | * @param creationFlags |
michael@0 | 29 | * Reserved for future use. Pass 0. |
michael@0 | 30 | * @param stackSize |
michael@0 | 31 | * Number of bytes to reserve for the thread's stack. |
michael@0 | 32 | * |
michael@0 | 33 | * @returns |
michael@0 | 34 | * The newly created nsIThread object. |
michael@0 | 35 | */ |
michael@0 | 36 | nsIThread newThread(in unsigned long creationFlags, [optional] in unsigned long stackSize); |
michael@0 | 37 | |
michael@0 | 38 | /** |
michael@0 | 39 | * Get the nsIThread object (if any) corresponding to the given PRThread. |
michael@0 | 40 | * This method returns null if there is no corresponding nsIThread. |
michael@0 | 41 | * |
michael@0 | 42 | * @param prthread |
michael@0 | 43 | * The PRThread of the nsIThread being requested. |
michael@0 | 44 | * |
michael@0 | 45 | * @returns |
michael@0 | 46 | * The nsIThread object corresponding to the given PRThread or null if no |
michael@0 | 47 | * such nsIThread exists. |
michael@0 | 48 | */ |
michael@0 | 49 | [noscript] nsIThread getThreadFromPRThread(in PRThread prthread); |
michael@0 | 50 | |
michael@0 | 51 | /** |
michael@0 | 52 | * Get the main thread. |
michael@0 | 53 | */ |
michael@0 | 54 | readonly attribute nsIThread mainThread; |
michael@0 | 55 | |
michael@0 | 56 | /** |
michael@0 | 57 | * Get the current thread. If the calling thread does not already have a |
michael@0 | 58 | * nsIThread associated with it, then a new nsIThread will be created and |
michael@0 | 59 | * associated with the current PRThread. |
michael@0 | 60 | */ |
michael@0 | 61 | readonly attribute nsIThread currentThread; |
michael@0 | 62 | |
michael@0 | 63 | /** |
michael@0 | 64 | * This attribute is true if the calling thread is the main thread of the |
michael@0 | 65 | * application process. |
michael@0 | 66 | */ |
michael@0 | 67 | readonly attribute boolean isMainThread; |
michael@0 | 68 | }; |