2015-04-09 20:25:05 +03:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
2012-05-21 15:12:37 +04:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
1999-04-07 00:54:09 +04:00
|
|
|
|
|
|
|
#ifndef nsObserverService_h___
|
|
|
|
#define nsObserverService_h___
|
|
|
|
|
1999-05-26 05:38:36 +04:00
|
|
|
#include "nsIObserverService.h"
|
2006-03-21 17:43:56 +03:00
|
|
|
#include "nsObserverList.h"
|
2013-11-07 09:35:30 +04:00
|
|
|
#include "nsIMemoryReporter.h"
|
2006-03-21 17:43:56 +03:00
|
|
|
#include "nsTHashtable.h"
|
2012-06-06 03:51:58 +04:00
|
|
|
#include "mozilla/Attributes.h"
|
1999-05-26 05:38:36 +04:00
|
|
|
|
1999-05-29 04:51:17 +04:00
|
|
|
// {D07F5195-E3D1-11d2-8ACD-00105A1B8860}
|
|
|
|
#define NS_OBSERVERSERVICE_CID \
|
|
|
|
{ \
|
|
|
|
0xd07f5195, 0xe3d1, 0x11d2, { \
|
|
|
|
0x8a, 0xcd, 0x0, 0x10, 0x5a, 0x1b, 0x88, 0x60 \
|
|
|
|
} \
|
|
|
|
}
|
1999-05-26 05:38:36 +04:00
|
|
|
|
2013-08-28 03:24:51 +04:00
|
|
|
class nsIMemoryReporter;
|
2013-08-26 22:56:23 +04:00
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
class nsObserverService final : public nsIObserverService,
|
2013-12-08 09:39:47 +04:00
|
|
|
public nsIMemoryReporter {
|
1999-05-26 05:38:36 +04:00
|
|
|
public:
|
2006-03-21 17:43:56 +03:00
|
|
|
NS_DECLARE_STATIC_IID_ACCESSOR(NS_OBSERVERSERVICE_CID)
|
1999-05-26 05:38:36 +04:00
|
|
|
|
|
|
|
nsObserverService();
|
2006-03-21 17:43:56 +03:00
|
|
|
|
2014-04-14 23:04:26 +04:00
|
|
|
NS_DECL_ISUPPORTS
|
2001-10-20 00:52:59 +04:00
|
|
|
NS_DECL_NSIOBSERVERSERVICE
|
2013-12-08 09:39:47 +04:00
|
|
|
NS_DECL_NSIMEMORYREPORTER
|
|
|
|
|
2006-03-21 17:43:56 +03:00
|
|
|
void Shutdown();
|
|
|
|
|
2016-04-28 10:11:17 +03:00
|
|
|
static MOZ_MUST_USE nsresult Create(nsISupports* aOuter, const nsIID& aIID,
|
|
|
|
void** aInstancePtr);
|
1999-05-26 05:38:36 +04:00
|
|
|
|
2012-04-30 23:01:11 +04:00
|
|
|
// Unmark any strongly held observers implemented in JS so the cycle
|
|
|
|
// collector will not traverse them.
|
|
|
|
NS_IMETHOD UnmarkGrayStrongObservers();
|
|
|
|
|
1999-05-26 05:38:36 +04:00
|
|
|
private:
|
2004-01-15 09:14:18 +03:00
|
|
|
~nsObserverService(void);
|
2013-08-26 22:56:23 +04:00
|
|
|
void RegisterReporter();
|
2018-11-12 13:04:17 +03:00
|
|
|
nsresult EnsureValidCall() const;
|
|
|
|
nsresult FilterHttpOnTopics(const char* aTopic);
|
2004-01-15 09:14:18 +03:00
|
|
|
|
2013-11-07 09:35:30 +04:00
|
|
|
static const size_t kSuspectReferentCount = 100;
|
2011-09-29 10:19:26 +04:00
|
|
|
bool mShuttingDown;
|
2006-03-21 17:43:56 +03:00
|
|
|
nsTHashtable<nsObserverList> mObserverTopicTable;
|
2006-03-09 06:14:32 +03:00
|
|
|
};
|
2006-03-04 17:04:05 +03:00
|
|
|
|
2006-03-21 17:43:56 +03:00
|
|
|
NS_DEFINE_STATIC_IID_ACCESSOR(nsObserverService, NS_OBSERVERSERVICE_CID)
|
|
|
|
|
1999-04-07 00:54:09 +04:00
|
|
|
#endif /* nsObserverService_h___ */
|