Bug 1381976: Part 2 - Cleanup private/protected members and mark class final. r=mccr8
MozReview-Commit-ID: Kn9NfKC4GL8
--- a/js/xpconnect/loader/mozJSComponentLoader.h
+++ b/js/xpconnect/loader/mozJSComponentLoader.h
@@ -34,19 +34,19 @@ namespace mozilla {
/* 6bd13476-1dd2-11b2-bbef-f0ccb5fa64b6 (thanks, mozbot) */
#define MOZJSCOMPONENTLOADER_CID \
{0x6bd13476, 0x1dd2, 0x11b2, \
{ 0xbb, 0xef, 0xf0, 0xcc, 0xb5, 0xfa, 0x64, 0xb6 }}
#define MOZJSCOMPONENTLOADER_CONTRACTID "@mozilla.org/moz/jsloader;1"
-class mozJSComponentLoader : public mozilla::ModuleLoader,
- public xpcIJSModuleLoader,
- public nsIObserver
+class mozJSComponentLoader final : public mozilla::ModuleLoader,
+ public xpcIJSModuleLoader,
+ public nsIObserver
{
public:
NS_DECL_ISUPPORTS
NS_DECL_XPCIJSMODULELOADER
NS_DECL_NSIOBSERVER
mozJSComponentLoader();
@@ -66,42 +66,43 @@ class mozJSComponentLoader : public mozi
return mLoaderGlobal == aObj;
}
size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf);
protected:
virtual ~mozJSComponentLoader();
- static mozJSComponentLoader* sSelf;
-
- nsresult ReallyInit();
- void UnloadModules();
-
- void CreateLoaderGlobal(JSContext* aCx,
- const nsACString& aLocation,
- JSAddonId* aAddonID,
- JS::MutableHandleObject aGlobal);
-
- bool ReuseGlobal(bool aIsAddon, nsIURI* aComponent);
-
friend class mozilla::ScriptPreloader;
JSObject* CompilationScope(JSContext* aCx)
{
if (mLoaderGlobal)
return mLoaderGlobal;
if ((mInitialized || NS_SUCCEEDED(ReallyInit())) &&
mShareLoaderGlobal)
{
return GetSharedGlobal(aCx);
}
return xpc::CompilationScope();
}
+ private:
+ static mozJSComponentLoader* sSelf;
+
+ nsresult ReallyInit();
+ void UnloadModules();
+
+ void CreateLoaderGlobal(JSContext* aCx,
+ const nsACString& aLocation,
+ JSAddonId* aAddonID,
+ JS::MutableHandleObject aGlobal);
+
+ bool ReuseGlobal(bool aIsAddon, nsIURI* aComponent);
+
JSObject* GetSharedGlobal(JSContext* aCx);
JSObject* PrepareObjectForLocation(JSContext* aCx,
nsIFile* aComponentFile,
nsIURI* aComponent,
bool* aReuseGlobal,
bool* aRealFile);
@@ -171,18 +172,16 @@ class mozJSComponentLoader : public mozi
nsCOMPtr<xpcIJSGetFactory> getfactoryobj;
JS::PersistentRootedObject obj;
JS::PersistentRootedScript thisObjectKey;
char* location;
nsCString resolvedURL;
};
- friend class ModuleEntry;
-
static size_t DataEntrySizeOfExcludingThis(const nsACString& aKey, ModuleEntry* const& aData,
mozilla::MallocSizeOf aMallocSizeOf, void* arg);
static size_t ClassEntrySizeOfExcludingThis(const nsACString& aKey,
const nsAutoPtr<ModuleEntry>& aData,
mozilla::MallocSizeOf aMallocSizeOf, void* arg);
// Modules are intentionally leaked, but still cleared.
nsDataHashtable<nsCStringHashKey, ModuleEntry*> mModules;