Bug 1381976: Part 2 - Cleanup private/protected members and mark class final. r=mccr8
authorKris Maglione <maglione.k@gmail.com>
Fri, 25 Aug 2017 13:29:51 -0700
changeset 379792 6e30ea61678858a7856d9b80b6737039b69db5d0
parent 379791 d7cef820d5feefda64d071b33f8f6143c829d3e6
child 379793 43cd9eaaab1dc9567d1873a3f9154475ff6db09c
push id50807
push usermaglione.k@gmail.com
push dateFri, 08 Sep 2017 20:27:14 +0000
treeherderautoland@6e30ea616788 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmccr8
bugs1381976
milestone57.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
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;