зеркало из https://github.com/mozilla/pjs.git
Bug 714967 - Support mozilla::services with external linkage. r=bsmedberg
This commit is contained in:
Родитель
1789633390
Коммит
241e0dd3ca
|
@ -64,7 +64,7 @@ using namespace mozilla::services;
|
|||
#define MOZ_SERVICE(NAME, TYPE, CONTRACT_ID) \
|
||||
static TYPE* g##NAME = nsnull; \
|
||||
\
|
||||
already_AddRefed<TYPE> \
|
||||
already_AddRefed<TYPE> \
|
||||
mozilla::services::Get##NAME() \
|
||||
{ \
|
||||
if (!g##NAME) { \
|
||||
|
@ -73,6 +73,11 @@ using namespace mozilla::services;
|
|||
} \
|
||||
NS_IF_ADDREF(g##NAME); \
|
||||
return g##NAME; \
|
||||
} \
|
||||
NS_EXPORT_(already_AddRefed<TYPE>) \
|
||||
mozilla::services::_external_Get##NAME() \
|
||||
{ \
|
||||
return Get##NAME(); \
|
||||
}
|
||||
|
||||
#include "ServiceList.h"
|
||||
|
|
|
@ -52,9 +52,24 @@
|
|||
namespace mozilla {
|
||||
namespace services {
|
||||
|
||||
#define MOZ_SERVICE(NAME, TYPE, SERVICE_CID) already_AddRefed<TYPE> Get##NAME();
|
||||
#ifdef MOZILLA_INTERNAL_API
|
||||
#define MOZ_SERVICE(NAME, TYPE, SERVICE_CID) \
|
||||
already_AddRefed<TYPE> Get##NAME(); \
|
||||
NS_EXPORT_(already_AddRefed<TYPE>) _external_Get##NAME();
|
||||
|
||||
#include "ServiceList.h"
|
||||
#undef MOZ_SERVICE
|
||||
#else
|
||||
#define MOZ_SERVICE(NAME, TYPE, SERVICE_CID) \
|
||||
NS_IMPORT_(already_AddRefed<TYPE>) _external_Get##NAME(); \
|
||||
inline already_AddRefed<TYPE> Get##NAME() \
|
||||
{ \
|
||||
return _external_Get##NAME(); \
|
||||
}
|
||||
|
||||
#include "ServiceList.h"
|
||||
#undef MOZ_SERVICE
|
||||
#endif
|
||||
|
||||
} // namespace services
|
||||
} // namespace mozilla
|
||||
|
|
Загрузка…
Ссылка в новой задаче