mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-24 05:11:16 +00:00
Bug 1056356 - Allow calling NewRunnableMethod() with a const pointer to the callee object. r=froydnj
--HG-- extra : rebase_source : 2cd101c22d0992acedccf50e7f5880a268cef199
This commit is contained in:
parent
1ad5e05028
commit
a7263cd695
@ -267,6 +267,19 @@ struct RunnableMethodTraits {
|
||||
}
|
||||
};
|
||||
|
||||
// This allows using the NewRunnableMethod() functions with a const pointer
|
||||
// to the callee object. See the similar support in nsRefPtr for a rationale
|
||||
// of why this is reasonable.
|
||||
template <class T>
|
||||
struct RunnableMethodTraits<const T> {
|
||||
static void RetainCallee(const T* obj) {
|
||||
const_cast<T*>(obj)->AddRef();
|
||||
}
|
||||
static void ReleaseCallee(const T* obj) {
|
||||
const_cast<T*>(obj)->Release();
|
||||
}
|
||||
};
|
||||
|
||||
// RunnableMethod and RunnableFunction -----------------------------------------
|
||||
//
|
||||
// Runnable methods are a type of task that call a function on an object when
|
||||
|
Loading…
Reference in New Issue
Block a user