Bug 1658359 - Rename nsIAboutGlean and friends to nsIFOG r=janerik

We'll need this interface for more general operations than just powering
about:glean.

Differential Revision: https://phabricator.services.mozilla.com/D87274
This commit is contained in:
Chris H-C 2020-09-02 17:06:18 +00:00
Родитель 4cd4dde714
Коммит ff95941133
8 изменённых файлов: 38 добавлений и 40 удалений

Просмотреть файл

@ -39,7 +39,7 @@ if CONFIG['MOZ_GLEAN']:
inputs=['metrics_index.py'])
DIRS += [
'aboutGlean',
'xpcom',
]
with Files('docs/**'):

Просмотреть файл

@ -4,24 +4,24 @@
* 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/. */
#include "nsIAboutGlean.h"
#include "mozilla/AboutGlean.h"
#include "nsIFOG.h"
#include "mozilla/FOG.h"
#include "mozilla/ClearOnShutdown.h"
namespace mozilla {
static StaticRefPtr<AboutGlean> gAboutGlean;
static StaticRefPtr<FOG> gFOG;
// static
already_AddRefed<AboutGlean> AboutGlean::GetSingleton() {
if (gAboutGlean) {
return do_AddRef(gAboutGlean);
already_AddRefed<FOG> FOG::GetSingleton() {
if (gFOG) {
return do_AddRef(gFOG);
}
gAboutGlean = new AboutGlean();
ClearOnShutdown(&gAboutGlean);
return do_AddRef(gAboutGlean);
gFOG = new FOG();
ClearOnShutdown(&gFOG);
return do_AddRef(gFOG);
}
extern "C" {
@ -31,20 +31,20 @@ nsresult fog_submit_ping(const nsACString* aPingName);
}
NS_IMETHODIMP
AboutGlean::SetLogPings(bool aEnableLogPings) {
FOG::SetLogPings(bool aEnableLogPings) {
return fog_set_log_pings(aEnableLogPings);
}
NS_IMETHODIMP
AboutGlean::SetTagPings(const nsACString& aDebugTag) {
FOG::SetTagPings(const nsACString& aDebugTag) {
return fog_set_debug_view_tag(&aDebugTag);
}
NS_IMETHODIMP
AboutGlean::SendPing(const nsACString& aPingName) {
FOG::SendPing(const nsACString& aPingName) {
return fog_submit_ping(&aPingName);
}
NS_IMPL_ISUPPORTS(AboutGlean, nsIAboutGlean)
NS_IMPL_ISUPPORTS(FOG, nsIFOG)
} // namespace mozilla

Просмотреть файл

@ -3,24 +3,24 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
#ifndef mozilla_AboutGlean_h
#define mozilla_AboutGlean_h
#ifndef mozilla_FOG_h
#define mozilla_FOG_h
#include "nsIAboutGlean.h"
#include "nsIFOG.h"
namespace mozilla {
class AboutGlean final : public nsIAboutGlean {
class FOG final : public nsIFOG {
NS_DECL_THREADSAFE_ISUPPORTS
NS_DECL_NSIABOUTGLEAN
NS_DECL_NSIFOG
public:
AboutGlean() = default;
static already_AddRefed<AboutGlean> GetSingleton();
FOG() = default;
static already_AddRefed<FOG> GetSingleton();
private:
~AboutGlean() = default;
~FOG() = default;
};
}; // namespace mozilla
#endif // mozilla_AboutGlean_h
#endif // mozilla_FOG_h

Просмотреть файл

@ -9,8 +9,8 @@ Classes = [
'cid': '{98d0e975-9cad-4ce3-ae2f-f878b8be6307}',
'contract_ids': ['@mozilla.org/toolkit/glean;1'],
'singleton': True,
'type': 'mozilla::AboutGlean',
'headers': ['mozilla/AboutGlean.h'],
'constructor': 'mozilla::AboutGlean::GetSingleton',
'type': 'mozilla::FOG',
'headers': ['mozilla/FOG.h'],
'constructor': 'mozilla::FOG::GetSingleton',
}
]

Просмотреть файл

@ -8,21 +8,21 @@ if CONFIG['MOZ_GLEAN']:
FINAL_LIBRARY = 'xul'
EXPORTS.mozilla += [
'AboutGlean.h',
'FOG.h',
]
UNIFIED_SOURCES += [
'AboutGlean.cpp',
'FOG.cpp',
]
XPCOM_MANIFESTS += [
'components.conf'
]
XPIDL_MODULE = 'glean'
XPIDL_MODULE = 'fog'
XPIDL_SOURCES += [
'nsIAboutGlean.idl',
'nsIFOG.idl',
]
with Files('**'):

Просмотреть файл

@ -6,7 +6,7 @@
#include "nsISupports.idl"
[scriptable, uuid(98d0e975-9cad-4ce3-ae2f-f878b8be6307)]
interface nsIAboutGlean : nsISupports
interface nsIFOG : nsISupports
{
/**

Просмотреть файл

@ -38,9 +38,9 @@ class TestDeletionRequestPing(FOGTestCase):
debug_tag = "my-test-tag"
tagging_script = """\
let AboutGlean = Components.classes["@mozilla.org/toolkit/glean;1"]
.createInstance(Components.interfaces.nsIAboutGlean);
AboutGlean.setTagPings("{}");
let FOG = Components.classes["@mozilla.org/toolkit/glean;1"]
.createInstance(Components.interfaces.nsIFOG);
FOG.setTagPings("{}");
""".format(debug_tag)
with self.marionette.using_context(self.marionette.CONTEXT_CHROME):
self.marionette.execute_script(textwrap.dedent(tagging_script))

Просмотреть файл

@ -9,12 +9,10 @@ function onLoad() {
let tag = document.getElementById("tag-pings").value;
let log = document.getElementById("log-pings").checked;
let send = document.getElementById("send-pings").value;
let AboutGlean = Cc["@mozilla.org/toolkit/glean;1"].createInstance(
Ci.nsIAboutGlean
);
AboutGlean.setLogPings(log);
AboutGlean.setTagPings(tag);
AboutGlean.sendPing(send);
let FOG = Cc["@mozilla.org/toolkit/glean;1"].createInstance(Ci.nsIFOG);
FOG.setLogPings(log);
FOG.setTagPings(tag);
FOG.sendPing(send);
});
}