Bug 1655067 - Remove an unused function; r=dom-workers-and-storage-reviewers,sg
authorTom Tung <ttung@mozilla.com>
Fri, 11 Sep 2020 08:08:10 +0000
changeset 548279 306503b007ffe4ed76bcc7e019e692ef4ea97483
parent 548278 fd8de30746b91ac76619c569b4a944776feab830
child 548280 9e0aeb1b5202cb3d86b71e63281ecc0928dda51e
push id37776
push userbtara@mozilla.com
push dateFri, 11 Sep 2020 15:10:42 +0000
treeherdermozilla-central@b133e2d673e8 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdom-workers-and-storage-reviewers, sg
bugs1655067
milestone82.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 1655067 - Remove an unused function; r=dom-workers-and-storage-reviewers,sg Differential Revision: https://phabricator.services.mozilla.com/D85972
dom/cache/DBSchema.cpp
dom/cache/DBSchema.h
--- a/dom/cache/DBSchema.cpp
+++ b/dom/cache/DBSchema.cpp
@@ -744,57 +744,16 @@ nsresult DeleteCacheId(mozIStorageConnec
   rv = state->Execute();
   if (NS_WARN_IF(NS_FAILED(rv))) {
     return rv;
   }
 
   return rv;
 }
 
-nsresult IsCacheOrphaned(mozIStorageConnection* aConn, CacheId aCacheId,
-                         bool* aOrphanedOut) {
-  MOZ_ASSERT(!NS_IsMainThread());
-  MOZ_DIAGNOSTIC_ASSERT(aConn);
-  MOZ_DIAGNOSTIC_ASSERT(aOrphanedOut);
-
-  // err on the side of not deleting user data
-  *aOrphanedOut = false;
-
-  nsCOMPtr<mozIStorageStatement> state;
-  nsresult rv = aConn->CreateStatement(
-      nsLiteralCString(
-          "SELECT COUNT(*) FROM storage WHERE cache_id=:cache_id;"),
-      getter_AddRefs(state));
-  if (NS_WARN_IF(NS_FAILED(rv))) {
-    return rv;
-  }
-
-  rv = state->BindInt64ByName("cache_id"_ns, aCacheId);
-  if (NS_WARN_IF(NS_FAILED(rv))) {
-    return rv;
-  }
-
-  bool hasMoreData = false;
-  rv = state->ExecuteStep(&hasMoreData);
-  if (NS_WARN_IF(NS_FAILED(rv))) {
-    return rv;
-  }
-  MOZ_DIAGNOSTIC_ASSERT(hasMoreData);
-
-  int32_t refCount;
-  rv = state->GetInt32(0, &refCount);
-  if (NS_WARN_IF(NS_FAILED(rv))) {
-    return rv;
-  }
-
-  *aOrphanedOut = refCount == 0;
-
-  return rv;
-}
-
 nsresult FindOrphanedCacheIds(mozIStorageConnection* aConn,
                               nsTArray<CacheId>& aOrphanedListOut) {
   nsCOMPtr<mozIStorageStatement> state;
   nsresult rv = aConn->CreateStatement(
       "SELECT id FROM caches "
       "WHERE id NOT IN (SELECT cache_id from storage);"_ns,
       getter_AddRefs(state));
   if (NS_WARN_IF(NS_FAILED(rv))) {
--- a/dom/cache/DBSchema.h
+++ b/dom/cache/DBSchema.h
@@ -35,21 +35,16 @@ nsresult CreateOrMigrateSchema(mozIStora
 nsresult InitializeConnection(mozIStorageConnection* aConn);
 
 nsresult CreateCacheId(mozIStorageConnection* aConn, CacheId* aCacheIdOut);
 
 nsresult DeleteCacheId(mozIStorageConnection* aConn, CacheId aCacheId,
                        nsTArray<nsID>& aDeletedBodyIdListOut,
                        int64_t* aDeletedPaddingSizeOut);
 
-// TODO: Consider removing unused IsCacheOrphaned after writing cleanup code.
-// (bug 1110446)
-nsresult IsCacheOrphaned(mozIStorageConnection* aConn, CacheId aCacheId,
-                         bool* aOrphanedOut);
-
 nsresult FindOrphanedCacheIds(mozIStorageConnection* aConn,
                               nsTArray<CacheId>& aOrphanedListOut);
 
 nsresult FindOverallPaddingSize(mozIStorageConnection* aConn,
                                 int64_t* aOverallPaddingSizeOut);
 
 nsresult GetKnownBodyIds(mozIStorageConnection* aConn,
                          nsTArray<nsID>& aBodyIdListOut);