Bug 1381976: Part 2 - Cleanup private/protected members and mark class final. r=mccr8 draft
authorKris Maglione <maglione.k@gmail.com>
Fri, 25 Aug 2017 13:29:51 -0700
changeset 661684 521043472a824fbcc07288e030f9c36601082c20
parent 661683 93f639022375dd3f0b8e06533e829ce4089d46b7
child 661692 2732fcf15636f23394c163b8e6d2ec3e29f400d1
push id78842
push usermaglione.k@gmail.com
push dateFri, 08 Sep 2017 20:25:36 +0000
reviewersmccr8
bugs1381976
milestone57.0a1
Bug 1381976: Part 2 - Cleanup private/protected members and mark class final. r=mccr8 MozReview-Commit-ID: Kn9NfKC4GL8
js/xpconnect/loader/mozJSComponentLoader.h
--- 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;