Bug 770911 - Remove all prefetch clearing code. r=taras, a=lsblakk.
authorBrian R. Bondy <netzen@gmail.com>
Sat, 04 Aug 2012 18:07:37 -0400
changeset 104863 c4f3769869bb7d47b4d5f35a25e62c343d234506
parent 104862 09036d362f916bed26b04bbcbcc25af8bda38845
child 104864 f2e923c88812ab757848016a3a613cf877ee5507
push id191
push userlsblakk@mozilla.com
push dateFri, 05 Oct 2012 17:12:53 +0000
treeherdermozilla-release@ddb22ac6c03b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstaras, lsblakk
bugs770911
milestone16.0a2
Bug 770911 - Remove all prefetch clearing code. r=taras, a=lsblakk.
b2g/app/nsBrowserApp.cpp
browser/app/nsBrowserApp.cpp
browser/components/shell/src/nsWindowsShellService.cpp
browser/components/shell/src/nsWindowsShellService.h
mobile/xul/app/nsBrowserApp.cpp
toolkit/components/maintenanceservice/Makefile.in
toolkit/components/maintenanceservice/maintenanceservice.cpp
toolkit/components/maintenanceservice/prefetch.cpp
toolkit/components/maintenanceservice/prefetch.h
toolkit/components/maintenanceservice/workmonitor.cpp
--- a/b2g/app/nsBrowserApp.cpp
+++ b/b2g/app/nsBrowserApp.cpp
@@ -169,29 +169,22 @@ int main(int argc, char* argv[])
 
   strcpy(++lastSlash, XPCOM_DLL);
 
   int gotCounters;
 #if defined(XP_UNIX)
   struct rusage initialRUsage;
   gotCounters = !getrusage(RUSAGE_SELF, &initialRUsage);
 #elif defined(XP_WIN)
-  // GetProcessIoCounters().ReadOperationCount seems to have little to
-  // do with actual read operations. It reports 0 or 1 at this stage
-  // in the program. Luckily 1 coincides with when prefetch is
-  // enabled. If Windows prefetch didn't happen we can do our own
-  // faster dll preloading.
   IO_COUNTERS ioCounters;
   gotCounters = GetProcessIoCounters(GetCurrentProcess(), &ioCounters);
-  if (gotCounters && !ioCounters.ReadOperationCount)
 #endif
-  {
-      XPCOMGlueEnablePreload();
-  }
 
+  // We do this because of data in bug 771745
+  XPCOMGlueEnablePreload();
 
   rv = XPCOMGlueStartup(exePath);
   if (NS_FAILED(rv)) {
     Output("Couldn't load XPCOM.\n");
     return 255;
   }
   // Reset exePath so that it is the directory name and not the xpcom dll name
   *lastSlash = 0;
--- a/browser/app/nsBrowserApp.cpp
+++ b/browser/app/nsBrowserApp.cpp
@@ -155,48 +155,16 @@ static int do_main(int argc, char* argv[
     int result = XRE_main(argc, argv, appData, 0);
     XRE_FreeAppData(appData);
     return result;
   }
 
   return XRE_main(argc, argv, &sAppData, 0);
 }
 
-#ifdef XP_WIN
-/**
- * Determines if the registry is disabled via the service or not.
- * 
- * @return true if prefetch is disabled
- *         false if prefetch is not disabled or an error occurred.
-*/
-bool IsPrefetchDisabledViaService()
-{
-  // We don't need to return false when we don't have MOZ_MAINTENANCE_SERVICE
-  // defined.  The reason is because another product installed that has it
-  // defined may have cleared our prefetch for us.  There is no known way
-  // to figure out which prefetch files are associated with which apps
-  // because of the prefetch hash.  So we disable all of them that start
-  // with FIREFOX.
-  HKEY baseKey;
-  LONG retCode = RegOpenKeyExW(HKEY_LOCAL_MACHINE, 
-                               L"SOFTWARE\\Mozilla\\MaintenanceService", 0,
-                               KEY_READ | KEY_WOW64_64KEY, &baseKey);
-  if (retCode != ERROR_SUCCESS) {
-    return false;
-  }
-  DWORD disabledValue = 0;
-  DWORD disabledValueSize = sizeof(DWORD);
-  RegQueryValueExW(baseKey, L"FFPrefetchDisabled", 0, NULL,
-                   reinterpret_cast<LPBYTE>(&disabledValue),
-                   &disabledValueSize);
-  RegCloseKey(baseKey);
-  return disabledValue == 1;
-}
-#endif
-
 /* Local implementation of PR_Now, since the executable can't depend on NSPR */
 static PRTime _PR_Now()
 {
 #ifdef XP_WIN
   MOZ_STATIC_ASSERT(sizeof(PRTime) == sizeof(FILETIME), "PRTime must have the same size as FILETIME");
   FILETIME ft;
   GetSystemTimeAsFileTime(&ft);
   PRTime now;
@@ -239,19 +207,18 @@ int main(int argc, char* argv[])
 #if defined(XP_UNIX)
   struct rusage initialRUsage;
   gotCounters = !getrusage(RUSAGE_SELF, &initialRUsage);
 #elif defined(XP_WIN)
   IO_COUNTERS ioCounters;
   gotCounters = GetProcessIoCounters(GetCurrentProcess(), &ioCounters);
 #endif
 
-#if !defined(XP_WIN)
+  // We do this because of data in bug 771745
   XPCOMGlueEnablePreload();
-#endif
 
   rv = XPCOMGlueStartup(exePath);
   if (NS_FAILED(rv)) {
     Output("Couldn't load XPCOM.\n");
     return 255;
   }
   // Reset exePath so that it is the directory name and not the xpcom dll name
   *lastSlash = 0;
--- a/browser/components/shell/src/nsWindowsShellService.cpp
+++ b/browser/components/shell/src/nsWindowsShellService.cpp
@@ -47,21 +47,16 @@
 #define REG_SUCCEEDED(val) \
   (val == ERROR_SUCCESS)
 
 #define REG_FAILED(val) \
   (val != ERROR_SUCCESS)
 
 #define NS_TASKBAR_CONTRACTID "@mozilla.org/windows-taskbar;1"
 
-// We clear the prefetch files one time after the browser is started after
-// 3 minutes.  After this is done once we set a pref so this will never happen
-// again except in updater code.
-#define CLEAR_PREFETCH_TIMEOUT_MS 180000
-
 NS_IMPL_ISUPPORTS2(nsWindowsShellService, nsIWindowsShellService, nsIShellService)
 
 static nsresult
 OpenKeyForReading(HKEY aKeyRoot, const nsAString& aKeyName, HKEY* aKey)
 {
   const nsString &flatName = PromiseFlatString(aKeyName);
 
   DWORD res = ::RegOpenKeyExW(aKeyRoot, flatName.get(), 0, KEY_READ, aKey);
@@ -189,27 +184,16 @@ static SETTING gDDESettings[] = {
   { MAKE_KEY_NAME1("Software\\Classes\\FirefoxURL", SOD) },
 
   // Protocol Handlers
   { MAKE_KEY_NAME1("Software\\Classes\\FTP", SOD) },
   { MAKE_KEY_NAME1("Software\\Classes\\HTTP", SOD) },
   { MAKE_KEY_NAME1("Software\\Classes\\HTTPS", SOD) }
 };
 
-#if defined(MOZ_MAINTENANCE_SERVICE)
-
-#define ONLY_SERVICE_LAUNCHING
-#include "updatehelper.h"
-#include "updatehelper.cpp"
-
-static const char *kPrefetchClearedPref =
-  "app.update.service.lastVersionPrefetchCleared";
-static nsCOMPtr<nsIThread> sThread;
-#endif
-
 nsresult
 GetHelperPath(nsAutoString& aPath)
 {
   nsresult rv;
   nsCOMPtr<nsIProperties> directoryService = 
     do_GetService(NS_DIRECTORY_SERVICE_CONTRACTID, &rv);
   NS_ENSURE_SUCCESS(rv, rv);
 
@@ -996,133 +980,22 @@ nsWindowsShellService::SetDesktopBackgro
   NS_ENSURE_SUCCESS(rv, rv);
 
   return regKey->Close();
 }
 
 nsWindowsShellService::nsWindowsShellService() : 
   mCheckedThisSession(false) 
 {
-#if defined(MOZ_MAINTENANCE_SERVICE)
-
-  // Check to make sure the service is installed
-  PRUint32 installed = 0;
-  nsCOMPtr<nsIWindowsRegKey> regKey = 
-    do_CreateInstance("@mozilla.org/windows-registry-key;1");
-  if (!regKey || 
-      NS_FAILED(regKey->Open(nsIWindowsRegKey::ROOT_KEY_LOCAL_MACHINE,
-                             NS_LITERAL_STRING(
-                               "SOFTWARE\\Mozilla\\MaintenanceService"),
-                             nsIWindowsRegKey::ACCESS_READ |
-                             nsIWindowsRegKey::WOW64_64)) ||
-      NS_FAILED(regKey->ReadIntValue(NS_LITERAL_STRING("Installed"), 
-                &installed)) ||
-      !installed) {
-    return;
-  }
-
-  // check to see if we have attempted to do the one time operation of clearing
-  // the prefetch.  We do it once per version upgrade.
-  nsCString lastClearedVer;
-  nsCOMPtr<nsIPrefBranch> prefBranch;
-  nsCOMPtr<nsIPrefService> prefs =
-    do_GetService(NS_PREFSERVICE_CONTRACTID);
-  if (!prefs || 
-      NS_FAILED(prefs->GetBranch(nsnull, getter_AddRefs(prefBranch))) ||
-      (NS_SUCCEEDED(prefBranch->GetCharPref(kPrefetchClearedPref, 
-                                            getter_Copies(lastClearedVer))))) {
-    // If the versions are the same, then bail out early.  We only want to clear
-    // once per version.
-    if (!strcmp(MOZ_APP_VERSION, lastClearedVer.get())) {
-      return;
-    }
-  }
-
-  // In a minute after startup is definitely complete, launch the
-  // service command.
-  mTimer = do_CreateInstance(NS_TIMER_CONTRACTID);
-  if (mTimer) {
-    mTimer->InitWithFuncCallback(
-      nsWindowsShellService::LaunchPrefetchClearCommand, 
-      nsnull, CLEAR_PREFETCH_TIMEOUT_MS, nsITimer::TYPE_ONE_SHOT);
-  }
-#endif
 }
 
 nsWindowsShellService::~nsWindowsShellService()
 {
-#if defined(MOZ_MAINTENANCE_SERVICE)
- if (mTimer) {
-    mTimer->Cancel();
-    mTimer = nsnull;
-  }
-  if (sThread) {
-    sThread->Shutdown();
-    sThread = nsnull;
-  }
-#endif
 }
 
-#if defined(MOZ_MAINTENANCE_SERVICE)
-
-class ClearPrefetchEvent : public nsRunnable {
-public:
-  ClearPrefetchEvent()
-  {
-  }
-
-  NS_IMETHOD Run() 
-  {
-    // Start the service command
-    LPCWSTR updaterServiceArgv[2];
-    updaterServiceArgv[0] = L"MozillaMaintenance";
-    updaterServiceArgv[1] = L"clear-prefetch";
-    // If this command fails, it is not critical as prefetch will be cleared
-    // on the next software update.
-    StartServiceCommand(NS_ARRAY_LENGTH(updaterServiceArgv), 
-                        updaterServiceArgv);
-    return NS_OK;
-  }
-};
-#endif
-
-/**
- * For faster startup we attempt to clear the prefetch if the maintenance
- * service is installed.  Please see the definition of ClearPrefetch()
- * in toolkit/components/maintenanceservice/prefetch.cpp for more info.
- * For now the only application that gets prefetch cleaned is Firefox
- * since we have not done performance checking for other applications.
- * This is done on every update but also there is a one time operation done
- * from within the program for first time installs.
- */ 
-#if defined(MOZ_MAINTENANCE_SERVICE)
-void
-nsWindowsShellService::LaunchPrefetchClearCommand(nsITimer *aTimer, void*)
-{
-  // Make sure we don't call this again from the application, it will be
-  // called on each application update instead.
-  nsCOMPtr<nsIPrefBranch> prefBranch;
-  nsCOMPtr<nsIPrefService> prefs =
-    do_GetService(NS_PREFSERVICE_CONTRACTID);
-  if (prefs) {
-    if (NS_SUCCEEDED(prefs->GetBranch(nsnull, getter_AddRefs(prefBranch)))) {
-      prefBranch->SetCharPref(kPrefetchClearedPref, MOZ_APP_VERSION);
-    }
-  }
-
-  // Starting the sevice can take a bit of time and we don't want to block the 
-  // main thread, so start an event on another thread to handle the operation
-  NS_NewThread(getter_AddRefs(sThread));
-  if (sThread) {
-    nsCOMPtr<nsIRunnable> prefetchEvent = new ClearPrefetchEvent();
-    sThread->Dispatch(prefetchEvent, NS_DISPATCH_NORMAL);
-  }
-}
-#endif
-
 NS_IMETHODIMP
 nsWindowsShellService::OpenApplicationWithURI(nsIFile* aApplication,
                                               const nsACString& aURI)
 {
   nsresult rv;
   nsCOMPtr<nsIProcess> process = 
     do_CreateInstance("@mozilla.org/process/util;1", &rv);
   if (NS_FAILED(rv))
--- a/browser/components/shell/src/nsWindowsShellService.h
+++ b/browser/components/shell/src/nsWindowsShellService.h
@@ -24,16 +24,12 @@ public:
   NS_DECL_NSISHELLSERVICE
   NS_DECL_NSIWINDOWSSHELLSERVICE
 
 protected:
   static nsresult IsDefaultBrowser(bool* aIsDefaultBrowser);
   static bool IsDefaultBrowserVista(bool* aIsDefaultBrowser);
 
 private:
-#if defined(MOZ_MAINTENANCE_SERVICE)
-  static void LaunchPrefetchClearCommand(nsITimer *aTimer, void*);
-  nsCOMPtr<nsITimer> mTimer;
-#endif
   bool      mCheckedThisSession;
 };
 
 #endif // nswindowsshellservice_h____
--- a/mobile/xul/app/nsBrowserApp.cpp
+++ b/mobile/xul/app/nsBrowserApp.cpp
@@ -195,28 +195,22 @@ int main(int argc, char* argv[])
 
   strcpy(++lastSlash, XPCOM_DLL);
 
   int gotCounters;
 #if defined(XP_UNIX)
   struct rusage initialRUsage;
   gotCounters = !getrusage(RUSAGE_SELF, &initialRUsage);
 #elif defined(XP_WIN)
-  // GetProcessIoCounters().ReadOperationCount seems to have little to
-  // do with actual read operations. It reports 0 or 1 at this stage
-  // in the program. Luckily 1 coincides with when prefetch is
-  // enabled. If Windows prefetch didn't happen we can do our own
-  // faster dll preloading.
   IO_COUNTERS ioCounters;
   gotCounters = GetProcessIoCounters(GetCurrentProcess(), &ioCounters);
-  if (gotCounters && !ioCounters.ReadOperationCount)
 #endif
-  {
-      XPCOMGlueEnablePreload();
-  }
+
+  // We do this because of data in bug 771745
+  XPCOMGlueEnablePreload();
 
 #if MOZ_PLATFORM_MAEMO == 6
   nsFastStartup startup;
   startup.CreateFastStartup(argc, argv, exePath, GeckoPreLoader);
 #else
   rv = XPCOMGlueStartup(exePath);
   if (NS_FAILED(rv)) {
     Output("Couldn't load XPCOM.\n");
--- a/toolkit/components/maintenanceservice/Makefile.in
+++ b/toolkit/components/maintenanceservice/Makefile.in
@@ -11,17 +11,16 @@ include $(DEPTH)/config/autoconf.mk
 
 CPPSRCS = \
   maintenanceservice.cpp \
   serviceinstall.cpp \
   workmonitor.cpp \
   certificatecheck.cpp \
   servicebase.cpp \
   registrycertificates.cpp \
-  prefetch.cpp \
   $(NULL)
 
 # For debugging purposes only
 #DEFINES += -DDISABLE_UPDATER_AUTHENTICODE_CHECK
 
 PROGRAM = maintenanceservice$(BIN_SUFFIX)
 DIST_PROGRAM = maintenanceservice$(BIN_SUFFIX)
 
--- a/toolkit/components/maintenanceservice/maintenanceservice.cpp
+++ b/toolkit/components/maintenanceservice/maintenanceservice.cpp
@@ -9,17 +9,16 @@
 #include <shlobj.h>
 
 #include "serviceinstall.h"
 #include "maintenanceservice.h"
 #include "servicebase.h"
 #include "workmonitor.h"
 #include "uachelper.h"
 #include "updatehelper.h"
-#include "prefetch.h"
 
 SERVICE_STATUS gSvcStatus = { 0 }; 
 SERVICE_STATUS_HANDLE gSvcStatusHandle = NULL; 
 HANDLE gWorkDoneEvent = NULL;
 HANDLE gThread = NULL;
 bool gServiceControlStopping = false;
 
 // logs are pretty small, about 20 lines, so 10 seems reasonable.
deleted file mode 100644
--- a/toolkit/components/maintenanceservice/prefetch.cpp
+++ /dev/null
@@ -1,261 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#include <shlwapi.h>
-#include "servicebase.h"
-#include "updatehelper.h"
-#include "nsWindowsHelpers.h"
-#define MAX_KEY_LENGTH 255
-
-/**
- * Writes a registry DWORD with a value of 1 at BASE_SERVICE_REG_KEY
- * if the prefetch was cleared successfully.
- *
- * @return TRUE if successful.
-*/
-BOOL
-WritePrefetchClearedReg()
-{
-  HKEY baseKeyRaw;
-  LONG retCode = RegOpenKeyExW(HKEY_LOCAL_MACHINE, 
-                               BASE_SERVICE_REG_KEY, 0,
-                               KEY_WRITE | KEY_WOW64_64KEY, &baseKeyRaw);
-  if (retCode != ERROR_SUCCESS) {
-    LOG(("Could not open key for prefetch. (%d)\n", retCode));
-    return FALSE;
-  }
-  nsAutoRegKey baseKey(baseKeyRaw);
-  DWORD disabledValue = 1;
-  if (RegSetValueExW(baseKey, L"FFPrefetchDisabled", 0, REG_DWORD,
-                     reinterpret_cast<LPBYTE>(&disabledValue),
-                     sizeof(disabledValue)) != ERROR_SUCCESS) {
-    LOG(("Could not write prefetch cleared value to registry. (%d)\n",
-         GetLastError()));
-    return FALSE;
-  }
-  return TRUE;
-}
-
-/** 
-  * Update: We found that prefetch clearing was a net negative, so this
-  * function has been updated to delete the read only prefetch files.
-  * -----------------------------------------------------------------------
-  * We found that prefetch actually causes large applications like Firefox
-  * to startup slower.  This will get rid of the Windows prefetch files for
-  * applications like firefox (FIREFOX-*.pf files) and instead replace them
-  * with 0 byte files which are read only.  Windows will not use prefetch
-  * if the associated prefetch file is a 0 byte read only file.
-  * Some of the problems with prefetch relating to Windows and Firefox:
-  * - Prefetch reads in a lot before we even run (fonts, plugins, etc...)
-  * - Prefetch happens before our code runs, so it delays UI showing.
-  * - Prefetch does not use windows readahead.
-  * Previous test data on an acer i7 laptop with a 5400rpm HD showed startup
-  * time difference was 1.6s (without prefetch) vs 2.6s+ with prefetch.
-  * The "Windows Internals" book mentions that prefetch can be disabled for 
-  * the whole system only, so there is no other application specific way to
-  * disable it.
-  *
-  * @param prefetchProcessName The name of the process who's prefetch files
-  *                            should be cleared.
-  * @return TRUE if no errors occurred during the clear operation.
-*/
-BOOL
-ClearPrefetch(LPCWSTR prefetchProcessName)
-{
-  LOG(("Clearing prefetch files...\n"));
-  size_t prefetchProcessNameLength = wcslen(prefetchProcessName);
-
-  // Make sure we were passed in a safe value for the prefetch process name
-  // because it will be appended to a filepath and deleted.
-  // We check for < 2 to avoid things like "." as the path 
-  // We check for a max path of MAX_PATH - 10 because we add \\ and '.EXE-*.pf'
-  if (wcsstr(prefetchProcessName, L"..") ||
-      wcsstr(prefetchProcessName, L"\\") ||
-      wcsstr(prefetchProcessName, L"*") ||
-      wcsstr(prefetchProcessName, L"/") ||
-      prefetchProcessNameLength < 2 ||
-      prefetchProcessNameLength >= (MAX_PATH - 10)) {
-    LOG(("Prefetch path to clear is not safe\n"));
-    return FALSE;
-  }
-
-  // Quick shortcut to make sure we don't try to clear multiple times for
-  // different FIREFOX installs.
-  static WCHAR lastPrefetchProcessName[MAX_PATH - 10] = { '\0' };
-  if (!wcscmp(lastPrefetchProcessName, prefetchProcessName)) {
-    LOG(("Already processed process name\n"));
-    return FALSE;
-  }
-  wcscpy(lastPrefetchProcessName, prefetchProcessName);
-
-  // Obtain the windows prefetch directory path.
-  WCHAR prefetchPath[MAX_PATH + 1];
-  if (!GetWindowsDirectoryW(prefetchPath,
-                            sizeof(prefetchPath) / 
-                            sizeof(prefetchPath[0]))) {
-    LOG(("Could not obtain windows directory\n"));
-    return FALSE;
-  }
-  if (!PathAppendSafe(prefetchPath, L"prefetch")) {
-    LOG(("Could not obtain prefetch directory\n"));
-    return FALSE;
-  }
-
-  size_t prefetchDirLen = wcslen(prefetchPath);
-  WCHAR prefetchSearchFile[MAX_PATH + 1];
-  // We know this is safe based on the check at the start of this function
-  wsprintf(prefetchSearchFile, L"\\%s.EXE-*.pf", prefetchProcessName);
-  // Append the search file to the full path
-  wcscpy(prefetchPath + prefetchDirLen, prefetchSearchFile);
-
-  // Find the first path matching and get a find handle for future calls.
-  WIN32_FIND_DATAW findFileData;
-  HANDLE findHandle = FindFirstFileW(prefetchPath, &findFileData);
-  if (INVALID_HANDLE_VALUE == findHandle) {
-    if (GetLastError() == ERROR_FILE_NOT_FOUND) {
-      LOG(("No files matching firefox.exe prefetch path.\n"));
-      return TRUE;
-    } else {
-      LOG(("Error finding firefox.exe prefetch files. (%d)\n",
-           GetLastError()));
-      return FALSE;
-    }
-  }
-  
-  BOOL deletedAllFFPrefetch = TRUE;
-  size_t deletedCount = 0;
-  do {
-    // Reset back to the prefetch directory, we know from an above check that
-    // we aren't exceeding MAX_PATH + 1 characters with prefetchDirLen + 1.
-    // From above we know: prefetchPath[prefetchDirLen] == L'\\';
-    prefetchPath[prefetchDirLen + 1] = L'\0';
-
-    // Get the new file's prefetch path
-    LPWSTR filenameOffsetInBuffer = prefetchPath + prefetchDirLen + 1;
-    if (wcslen(findFileData.cFileName) + prefetchDirLen + 1 > MAX_PATH) {
-      LOG(("Error appending prefetch path %ls, path is too long. (%d)\n",
-           findFileData.cFileName, GetLastError()));
-      deletedAllFFPrefetch = FALSE;
-      continue;
-    }
-    if (!PathAppendSafe(filenameOffsetInBuffer, findFileData.cFileName)) {
-      LOG(("Error appending prefetch path %ls. (%d)\n", findFileData.cFileName,
-           GetLastError()));
-      deletedAllFFPrefetch = FALSE;
-      continue;
-    }
-
-    DWORD attributes = GetFileAttributesW(prefetchPath);
-    if (INVALID_FILE_ATTRIBUTES == attributes) {
-      LOG(("Could not get/set attributes on prefetch file: %ls. (%d)\n", 
-           findFileData.cFileName, GetLastError()));
-      continue;
-    }
-    
-    if (!(attributes & FILE_ATTRIBUTE_READONLY)) {
-      LOG(("Prefetch file is not read-only, don't clear: %ls.\n", 
-           findFileData.cFileName));
-      continue;
-    }
-
-    // Remove the read only attribute so a DeleteFile call will work.
-    if (!SetFileAttributesW(prefetchPath,
-                            attributes & (~FILE_ATTRIBUTE_READONLY))) {
-      LOG(("Could not set read only on prefetch file: %ls. (%d)\n", 
-           findFileData.cFileName, GetLastError()));
-      continue;
-    } 
-
-    if (!DeleteFileW(prefetchPath)) {
-      LOG(("Could not delete read only prefetch file: %ls. (%d)\n",
-            findFileData.cFileName, GetLastError()));
-    }
-
-    ++deletedCount;
-    LOG(("Prefetch file cleared successfully: %ls\n",
-         prefetchPath));
-  } while (FindNextFileW(findHandle, &findFileData));
-  LOG(("Done searching prefetch paths. (%d)\n", GetLastError()));
-
-  // Cleanup after ourselves.
-  FindClose(findHandle);
-
-  if (deletedAllFFPrefetch && deletedCount > 0) {
-    WritePrefetchClearedReg();
-  }
-
-  return deletedAllFFPrefetch;
-}
-
-/**
- * Clears all prefetch files specified in the installation dirctories
- * @return FALSE if there was an error clearing the known prefetch directories
-*/
-BOOL
-ClearKnownPrefetch()
-{
-  // The service always uses the 64-bit registry key
-  HKEY baseKeyRaw;
-  LONG retCode = RegOpenKeyExW(HKEY_LOCAL_MACHINE,
-                               BASE_SERVICE_REG_KEY, 0,
-                               KEY_READ | KEY_WOW64_64KEY, &baseKeyRaw);
-  if (retCode != ERROR_SUCCESS) {
-    LOG(("Could not open maintenance service base key. (%d)\n", retCode));
-    return FALSE;
-  }
-  nsAutoRegKey baseKey(baseKeyRaw);
-
-  // Get the number of subkeys.
-  DWORD subkeyCount = 0;
-  retCode = RegQueryInfoKeyW(baseKey, NULL, NULL, NULL, &subkeyCount, NULL,
-                             NULL, NULL, NULL, NULL, NULL, NULL);
-  if (retCode != ERROR_SUCCESS) {
-    LOG(("Could not query info key: %d\n", retCode));
-    return FALSE;
-  }
-
-  // Enumerate the subkeys, each subkey represents an install
-  for (DWORD i = 0; i < subkeyCount; i++) { 
-    WCHAR subkeyBuffer[MAX_KEY_LENGTH];
-    DWORD subkeyBufferCount = MAX_KEY_LENGTH;  
-    retCode = RegEnumKeyExW(baseKey, i, subkeyBuffer, 
-                            &subkeyBufferCount, NULL, 
-                            NULL, NULL, NULL); 
-    if (retCode != ERROR_SUCCESS) {
-      LOG(("Could not enum installations: %d\n", retCode));
-      return FALSE;
-    }
-
-    // Open the subkey
-    HKEY subKeyRaw;
-    retCode = RegOpenKeyExW(baseKey, 
-                            subkeyBuffer, 
-                            0, 
-                            KEY_READ | KEY_WOW64_64KEY, 
-                            &subKeyRaw);
-    nsAutoRegKey subKey(subKeyRaw);
-    if (retCode != ERROR_SUCCESS) {
-      LOG(("Could not open subkey: %d\n", retCode));
-      continue; // Try the next subkey
-    }
-
-    const int MAX_CHAR_COUNT = 256;
-    DWORD valueBufSize = MAX_CHAR_COUNT * sizeof(WCHAR);
-    WCHAR prefetchProcessName[MAX_CHAR_COUNT] = { L'\0' };
-
-    // Get the prefetch process name from the registry
-    retCode = RegQueryValueExW(subKey, L"prefetchProcessName", 0, NULL, 
-                               (LPBYTE)prefetchProcessName, &valueBufSize);
-    if (retCode != ERROR_SUCCESS) {
-      LOG(("Could not obtain process name from registry: %d\n", retCode));
-      continue; // Try the next subkey
-    }
-
-    // The value for prefetch process name comes from HKLM so is trusted.
-    // We will do some sanity checks on it though inside ClearPrefetch.
-    ClearPrefetch(prefetchProcessName);
-  }
-
-  return TRUE;
-}
deleted file mode 100644
--- a/toolkit/components/maintenanceservice/prefetch.h
+++ /dev/null
@@ -1,5 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-BOOL ClearKnownPrefetch();
--- a/toolkit/components/maintenanceservice/workmonitor.cpp
+++ b/toolkit/components/maintenanceservice/workmonitor.cpp
@@ -19,17 +19,16 @@
 
 #include "workmonitor.h"
 #include "serviceinstall.h"
 #include "servicebase.h"
 #include "registrycertificates.h"
 #include "uachelper.h"
 #include "updatehelper.h"
 #include "errors.h"
-#include "prefetch.h"
 
 // Wait 15 minutes for an update operation to run at most.
 // Updates usually take less than a minute so this seems like a 
 // significantly large and safe amount of time to wait.
 static const int TIME_TO_WAIT_ON_UPDATER = 15 * 60 * 1000;
 PRUnichar* MakeCommandLine(int argc, PRUnichar **argv);
 BOOL WriteStatusFailure(LPCWSTR updateDirPath, int errorCode);
 BOOL PathGetSiblingFilePath(LPWSTR destinationBuffer,  LPCWSTR siblingFilePath, 
@@ -499,18 +498,16 @@ ExecuteServiceCommand(int argc, LPWSTR *
 
   BOOL result = FALSE;
   if (!lstrcmpi(argv[2], L"software-update")) {
     result = ProcessSoftwareUpdateCommand(argc - 3, argv + 3);
     // We might not reach here if the service install succeeded
     // because the service self updates itself and the service
     // installer will stop the service.
     LOG(("Service command %ls complete.\n", argv[2]));
-  } else if (!lstrcmpi(argv[2], L"clear-prefetch")) {
-    result = ClearKnownPrefetch();
   } else {
     LOG(("Service command not recognized: %ls.\n", argv[2]));
     // result is already set to FALSE
   }
 
   LOG(("service command %ls complete with result: %ls.\n", 
        argv[1], (result ? L"Success" : L"Failure")));
   return TRUE;