1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/xpcom/base/nsIStatusReporter.idl Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,89 @@ 1.4 +/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 1.5 +/* vim: set ts=8 sts=2 et sw=2 tw=80: */ 1.6 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.7 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.8 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.9 + 1.10 +#include "nsISupports.idl" 1.11 + 1.12 +interface nsISimpleEnumerator; 1.13 + 1.14 +/* 1.15 + * Status reporters show Firefox's service status. 1.16 + */ 1.17 + 1.18 +[scriptable, uuid(ffcb716c-deeb-44ea-9d9d-ab25dc6980a8)] 1.19 +interface nsIStatusReporter : nsISupports 1.20 +{ 1.21 + readonly attribute ACString name; 1.22 + /* 1.23 + * The name of the process containing this reporter. Each reporter initially 1.24 + * has "" in this field, indicating that it applies to the current process. 1.25 + */ 1.26 + readonly attribute ACString process; 1.27 + /* 1.28 + * A human-readable status description. 1.29 + */ 1.30 + readonly attribute AUTF8String description; 1.31 +}; 1.32 + 1.33 +[scriptable, uuid(fd531273-3319-4fcd-90f2-9f53876c3828)] 1.34 +interface nsIStatusReporterManager : nsISupports 1.35 +{ 1.36 + 1.37 + /* 1.38 + * Return an enumerator of nsIStatusReporters that are currently registered. 1.39 + */ 1.40 + nsISimpleEnumerator enumerateReporters(); 1.41 + 1.42 + /* 1.43 + * Register the given nsIStatusReporter. After a reporter is registered, 1.44 + * it will be available via enumerateReporters(). The Manager service 1.45 + * will hold a strong reference to the given reporter. 1.46 + */ 1.47 + void registerReporter(in nsIStatusReporter reporter); 1.48 + 1.49 + /* 1.50 + * Unregister the given status reporter. 1.51 + */ 1.52 + void unregisterReporter(in nsIStatusReporter reporter); 1.53 + 1.54 + /* 1.55 + * Initialize. 1.56 + */ 1.57 + void init(); 1.58 + 1.59 + /* 1.60 + * Dump service status as a json file 1.61 + */ 1.62 + void dumpReports(); 1.63 +}; 1.64 + 1.65 +%{C++ 1.66 + 1.67 +/* 1.68 + * Note that this defaults 'process' to "", which is usually what's desired. 1.69 + */ 1.70 +#define NS_STATUS_REPORTER_IMPLEMENT(_classname, _name, _desc_Function) \ 1.71 + class StatusReporter_##_classname MOZ_FINAL : public nsIStatusReporter { \ 1.72 + public: \ 1.73 + NS_DECL_ISUPPORTS \ 1.74 + NS_IMETHOD GetName(nsACString &name) \ 1.75 + { name.AssignLiteral(_name); return NS_OK; } \ 1.76 + NS_IMETHOD GetProcess(nsACString &process) \ 1.77 + { process.Truncate(); return NS_OK; } \ 1.78 + NS_IMETHOD GetDescription(nsACString &desc) \ 1.79 + { _desc_Function(desc); return NS_OK; } \ 1.80 + }; \ 1.81 + NS_IMPL_ISUPPORTS(StatusReporter_##_classname, nsIStatusReporter) 1.82 + 1.83 +#define NS_STATUS_REPORTER_NAME(_classname) StatusReporter_##_classname 1.84 + 1.85 +nsresult NS_RegisterStatusReporter(nsIStatusReporter *reporter); 1.86 +nsresult NS_UnregisterStatusReporter(nsIStatusReporter *reporter); 1.87 +nsresult NS_DumpStatusReporter(); 1.88 + 1.89 +#define NS_STATUS_REPORTER_MANAGER_CID \ 1.90 +{ 0xe8eb4e7e, 0xf2cf, 0x45e5, \ 1.91 +{ 0xb8, 0xa4, 0x6a, 0x0f, 0x50, 0x18, 0x84, 0x63 } } 1.92 +%}