mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-29 07:42:04 +00:00
Bug 665579: Merge nsIThreadInternal and nsIThreadInternal2. r=bsmedberg
This commit is contained in:
parent
8daedc7313
commit
257389646e
@ -104,7 +104,7 @@ IDBTransaction::Create(IDBDatabase* aDatabase,
|
||||
}
|
||||
|
||||
if (!aDispatchDelayed) {
|
||||
nsCOMPtr<nsIThreadInternal2> thread =
|
||||
nsCOMPtr<nsIThreadInternal> thread =
|
||||
do_QueryInterface(NS_GetCurrentThread());
|
||||
NS_ENSURE_TRUE(thread, nsnull);
|
||||
|
||||
@ -899,10 +899,7 @@ IDBTransaction::AfterProcessNextEvent(nsIThreadInternal* aThread,
|
||||
}
|
||||
|
||||
// No longer need to observe thread events.
|
||||
nsCOMPtr<nsIThreadInternal2> thread = do_QueryInterface(aThread);
|
||||
NS_ASSERTION(thread, "This must never fail!");
|
||||
|
||||
if(NS_FAILED(thread->RemoveObserver(this))) {
|
||||
if(NS_FAILED(aThread->RemoveObserver(this))) {
|
||||
NS_ERROR("Failed to remove observer!");
|
||||
}
|
||||
}
|
||||
|
@ -45,7 +45,7 @@ interface nsIThreadEventFilter;
|
||||
* The XPCOM thread object implements this interface, which allows a consumer
|
||||
* to observe dispatch activity on the thread.
|
||||
*/
|
||||
[scriptable, uuid(f89b5063-b06d-42f8-bf23-4dfcf2d80d6a)]
|
||||
[scriptable, uuid(e0d35c22-53d5-4b48-8627-93e05b94cf2c)]
|
||||
interface nsIThreadInternal : nsIThread
|
||||
{
|
||||
/**
|
||||
@ -76,6 +76,28 @@ interface nsIThreadInternal : nsIThread
|
||||
* events remaining in the queue are appended to the elder queue.
|
||||
*/
|
||||
void popEventQueue();
|
||||
|
||||
/**
|
||||
* The current recursion depth, 0 when no events are running, 1 when a single
|
||||
* event is running, and higher when nested events are running. Must only be
|
||||
* called on the target thread.
|
||||
*/
|
||||
readonly attribute unsigned long recursionDepth;
|
||||
|
||||
/**
|
||||
* Add an observer that will *only* receive onProcessNextEvent and
|
||||
* afterProcessNextEvent callbacks. Always called on the target thread, and
|
||||
* the implementation does not have to be threadsafe. Order of callbacks is
|
||||
* not guaranteed (i.e. afterProcessNextEvent may be called first depending on
|
||||
* whether or not the observer is added in a nested loop). Holds a strong ref.
|
||||
*/
|
||||
void addObserver(in nsIThreadObserver observer);
|
||||
|
||||
/**
|
||||
* Remove an observer added via the addObserver call. Once removed the
|
||||
* observer will never be called again by the thread.
|
||||
*/
|
||||
void removeObserver(in nsIThreadObserver observer);
|
||||
};
|
||||
|
||||
/**
|
||||
@ -166,32 +188,3 @@ interface nsIThreadEventFilter : nsISupports
|
||||
*/
|
||||
[notxpcom] boolean acceptEvent(in nsIRunnable event);
|
||||
};
|
||||
|
||||
/**
|
||||
* Temporary interface, will be merged into nsIThreadInternal.
|
||||
*/
|
||||
[scriptable, uuid(4531f101-fddc-4d36-80e7-35260a2f3afe)]
|
||||
interface nsIThreadInternal2 : nsIThreadInternal
|
||||
{
|
||||
/**
|
||||
* The current recursion depth, 0 when no events are running, 1 when a single
|
||||
* event is running, and higher when nested events are running. Must only be
|
||||
* called on the target thread.
|
||||
*/
|
||||
readonly attribute unsigned long recursionDepth;
|
||||
|
||||
/**
|
||||
* Add an observer that will *only* receive onProcessNextEvent and
|
||||
* afterProcessNextEvent callbacks. Always called on the target thread, and
|
||||
* the implementation does not have to be threadsafe. Order of callbacks is
|
||||
* not guaranteed (i.e. afterProcessNextEvent may be called first depending on
|
||||
* whether or not the observer is added in a nested loop). Holds a strong ref.
|
||||
*/
|
||||
void addObserver(in nsIThreadObserver observer);
|
||||
|
||||
/**
|
||||
* Remove an observer added via the addObserver call. Once removed the
|
||||
* observer will never be called again by the thread.
|
||||
*/
|
||||
void removeObserver(in nsIThreadObserver observer);
|
||||
};
|
||||
|
@ -159,7 +159,6 @@ NS_IMPL_THREADSAFE_RELEASE(nsThread)
|
||||
NS_INTERFACE_MAP_BEGIN(nsThread)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIThread)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIThreadInternal)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIThreadInternal2)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIEventTarget)
|
||||
NS_INTERFACE_MAP_ENTRY(nsISupportsPriority)
|
||||
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIThread)
|
||||
@ -745,9 +744,6 @@ nsThread::nsChainedEventQueue::PutEvent(nsIRunnable *event)
|
||||
return val;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// nsIThreadInternal2
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsThread::GetRecursionDepth(PRUint32 *depth)
|
||||
{
|
||||
|
@ -48,14 +48,13 @@
|
||||
#include "nsTObserverArray.h"
|
||||
|
||||
// A native thread
|
||||
class nsThread : public nsIThreadInternal2, public nsISupportsPriority
|
||||
class nsThread : public nsIThreadInternal, public nsISupportsPriority
|
||||
{
|
||||
public:
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSIEVENTTARGET
|
||||
NS_DECL_NSITHREAD
|
||||
NS_DECL_NSITHREADINTERNAL
|
||||
NS_DECL_NSITHREADINTERNAL2
|
||||
NS_DECL_NSISUPPORTSPRIORITY
|
||||
|
||||
nsThread();
|
||||
|
Loading…
Reference in New Issue
Block a user