mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-17 07:15:46 +00:00
Bug 1348738 - (Part 0) Convert nsRepeatService::gInstance to be a file-scoped StaticRefPtr. r=dholbert
MozReview-Commit-ID: KSLs2tEFf7m --HG-- extra : rebase_source : 902d743ab118e9ff93a364fec13f78eb118e3c73
This commit is contained in:
parent
49d40030b6
commit
123b9045b8
@ -13,7 +13,9 @@
|
||||
#include "nsRepeatService.h"
|
||||
#include "nsIServiceManager.h"
|
||||
|
||||
nsRepeatService* nsRepeatService::gInstance = nullptr;
|
||||
using namespace mozilla;
|
||||
|
||||
static StaticRefPtr<nsRepeatService> gRepeatService;
|
||||
|
||||
nsRepeatService::nsRepeatService()
|
||||
: mCallback(nullptr), mCallbackData(nullptr)
|
||||
@ -25,20 +27,19 @@ nsRepeatService::~nsRepeatService()
|
||||
NS_ASSERTION(!mCallback && !mCallbackData, "Callback was not removed before shutdown");
|
||||
}
|
||||
|
||||
nsRepeatService*
|
||||
/* static */ nsRepeatService*
|
||||
nsRepeatService::GetInstance()
|
||||
{
|
||||
if (!gInstance) {
|
||||
gInstance = new nsRepeatService();
|
||||
NS_IF_ADDREF(gInstance);
|
||||
if (!gRepeatService) {
|
||||
gRepeatService = new nsRepeatService();
|
||||
}
|
||||
return gInstance;
|
||||
return gRepeatService;
|
||||
}
|
||||
|
||||
/*static*/ void
|
||||
nsRepeatService::Shutdown()
|
||||
{
|
||||
NS_IF_RELEASE(gInstance);
|
||||
gRepeatService = nullptr;
|
||||
}
|
||||
|
||||
void nsRepeatService::Start(Callback aCallback, void* aCallbackData,
|
||||
|
@ -53,7 +53,6 @@ private:
|
||||
Callback mCallback;
|
||||
void* mCallbackData;
|
||||
nsCOMPtr<nsITimer> mRepeatTimer;
|
||||
static nsRepeatService* gInstance;
|
||||
|
||||
}; // class nsRepeatService
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user