Bug 1339556 - remove nsUrlClassifierUtils::Charmap; r=gcp
authorNathan Froyd <froydnj@mozilla.com>
Wed, 15 Feb 2017 09:29:42 -0500
changeset 343077 725b158fecb0a3f16a75f40ea9b7dce749c3c19a
parent 343076 828c1f39d71afcf09f04d624c67fb58e50991f3b
child 343078 fde41ab81a44aa8755fbf319b2e3d7070152753c
push id31369
push userkwierso@gmail.com
push dateThu, 16 Feb 2017 00:18:40 +0000
treeherdermozilla-central@e9b926463f9e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgcp
bugs1339556
milestone54.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 1339556 - remove nsUrlClassifierUtils::Charmap; r=gcp The current code doesn't use Charmap.
toolkit/components/url-classifier/nsUrlClassifierUtils.cpp
toolkit/components/url-classifier/nsUrlClassifierUtils.h
--- a/toolkit/components/url-classifier/nsUrlClassifierUtils.cpp
+++ b/toolkit/components/url-classifier/nsUrlClassifierUtils.cpp
@@ -142,30 +142,23 @@ CreateClientInfo()
 
   return c;
 }
 
 } // end of namespace safebrowsing.
 } // end of namespace mozilla.
 
 nsUrlClassifierUtils::nsUrlClassifierUtils()
-  : mEscapeCharmap(nullptr)
-  , mProviderDictLock("nsUrlClassifierUtils.mProviderDictLock")
+  : mProviderDictLock("nsUrlClassifierUtils.mProviderDictLock")
 {
 }
 
 nsresult
 nsUrlClassifierUtils::Init()
 {
-  // Everything but alpha numerics, - and .
-  mEscapeCharmap = new Charmap(0xffffffff, 0xfc009fff, 0xf8000001, 0xf8000001,
-                               0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff);
-  if (!mEscapeCharmap)
-    return NS_ERROR_OUT_OF_MEMORY;
-
   // nsIUrlClassifierUtils is a thread-safe service so it's
   // allowed to use on non-main threads. However, building
   // the provider dictionary must be on the main thread.
   // We forcefully load nsUrlClassifierUtils in
   // nsUrlClassifierDBService::Init() to ensure we must
   // now be on the main thread.
   nsresult rv = ReadProvidersFromPrefs(mProviderDict);
   NS_ENSURE_SUCCESS(rv, rv);
--- a/toolkit/components/url-classifier/nsUrlClassifierUtils.h
+++ b/toolkit/components/url-classifier/nsUrlClassifierUtils.h
@@ -13,48 +13,16 @@
 #define TESTING_TABLE_PROVIDER_NAME "test"
 
 class nsUrlClassifierUtils final : public nsIUrlClassifierUtils,
                                    public nsIObserver
 {
 public:
   typedef nsClassHashtable<nsCStringHashKey, nsCString> ProviderDictType;
 
-private:
-  /**
-   * A fast, bit-vector map for ascii characters.
-   *
-   * Internally stores 256 bits in an array of 8 ints.
-   * Does quick bit-flicking to lookup needed characters.
-   */
-  class Charmap
-  {
-  public:
-    Charmap(uint32_t b0, uint32_t b1, uint32_t b2, uint32_t b3,
-            uint32_t b4, uint32_t b5, uint32_t b6, uint32_t b7)
-    {
-      mMap[0] = b0; mMap[1] = b1; mMap[2] = b2; mMap[3] = b3;
-      mMap[4] = b4; mMap[5] = b5; mMap[6] = b6; mMap[7] = b7;
-    }
-
-    /**
-     * Do a quick lookup to see if the letter is in the map.
-     */
-    bool Contains(unsigned char c) const
-    {
-      return mMap[c >> 5] & (1 << (c & 31));
-    }
-
-  private:
-    // Store the 256 bits in an 8 byte array.
-    uint32_t mMap[8];
-  };
-
-
-public:
   nsUrlClassifierUtils();
 
   NS_DECL_THREADSAFE_ISUPPORTS
   NS_DECL_NSIURLCLASSIFIERUTILS
   NS_DECL_NSIOBSERVER
 
   nsresult Init();
 
@@ -86,16 +54,14 @@ private:
 
   // Function to tell if we should encode a character.
   bool ShouldURLEscape(const unsigned char c) const;
 
   void CleanupHostname(const nsACString & host, nsACString & _retval);
 
   nsresult ReadProvidersFromPrefs(ProviderDictType& aDict);
 
-  nsAutoPtr<Charmap> mEscapeCharmap;
-
   // The provider lookup table and its mutex.
   ProviderDictType mProviderDict;
   mozilla::Mutex mProviderDictLock;
 };
 
 #endif // nsUrlClassifierUtils_h_