mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-01-08 08:11:36 +01:00
wrapper: Add thread-specific IMPLEMENT_REFCOUNTING variant
This commit is contained in:
parent
6337aa6fad
commit
d63e5bbd8a
@ -89,6 +89,32 @@ struct CefDeleteOnIOThread : public CefDeleteOnThread<TID_IO> {};
|
|||||||
struct CefDeleteOnFileThread : public CefDeleteOnThread<TID_FILE> {};
|
struct CefDeleteOnFileThread : public CefDeleteOnThread<TID_FILE> {};
|
||||||
struct CefDeleteOnRendererThread : public CefDeleteOnThread<TID_RENDERER> {};
|
struct CefDeleteOnRendererThread : public CefDeleteOnThread<TID_RENDERER> {};
|
||||||
|
|
||||||
|
// Same as IMPLEMENT_REFCOUNTING() but using the specified Destructor.
|
||||||
|
#define IMPLEMENT_REFCOUNTING_EX(ClassName, Destructor) \
|
||||||
|
public: \
|
||||||
|
void AddRef() const OVERRIDE { ref_count_.AddRef(); } \
|
||||||
|
bool Release() const OVERRIDE { \
|
||||||
|
if (ref_count_.Release()) { \
|
||||||
|
Destructor::Destruct(this); \
|
||||||
|
return true; \
|
||||||
|
} \
|
||||||
|
return false; \
|
||||||
|
} \
|
||||||
|
bool HasOneRef() const OVERRIDE { return ref_count_.HasOneRef(); } \
|
||||||
|
bool HasAtLeastOneRef() const OVERRIDE { \
|
||||||
|
return ref_count_.HasAtLeastOneRef(); \
|
||||||
|
} \
|
||||||
|
\
|
||||||
|
private: \
|
||||||
|
CefRefCount ref_count_
|
||||||
|
|
||||||
|
#define IMPLEMENT_REFCOUNTING_DELETE_ON_UIT(ClassName) \
|
||||||
|
IMPLEMENT_REFCOUNTING_EX(ClassName, CefDeleteOnUIThread)
|
||||||
|
|
||||||
|
#define IMPLEMENT_REFCOUNTING_DELETE_ON_IOT(ClassName) \
|
||||||
|
IMPLEMENT_REFCOUNTING_EX(ClassName, CefDeleteOnIOThread)
|
||||||
|
|
||||||
|
|
||||||
///
|
///
|
||||||
// Helper class to manage a scoped copy of |argv|.
|
// Helper class to manage a scoped copy of |argv|.
|
||||||
///
|
///
|
||||||
|
Loading…
Reference in New Issue
Block a user