Merge mozilla-inbound and mozilla-central on a CLOSED TREE to fix Android permaorange
authorMarco Bonardo <mbonardo@mozilla.com>
Thu, 28 Jul 2011 17:42:28 +0200
changeset 73476 2a797b4b48fdb9b2843d57772846e58d1940d8bc
parent 73471 fe48bbfeff94149e79f1e126ae6dfeed42e88d65 (current diff)
parent 73475 f7c8248747d6aa876546628d2b8bac5896ac2d39 (diff)
child 73491 150b7109ac0108feeaf43a031c9ec556b49f8c2b
child 75228 3ff331490e736fd2ffd1a712181336e633c55777
push id20872
push usermak77@bonardo.net
push dateThu, 28 Jul 2011 15:50:29 +0000
treeherdermozilla-central@2a797b4b48fd [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
milestone8.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
Merge mozilla-inbound and mozilla-central on a CLOSED TREE to fix Android permaorange
configure.in
--- a/configure.in
+++ b/configure.in
@@ -6979,24 +6979,26 @@ if test $MOZ_PLATFORM_MAEMO; then
    AC_SUBST(MOZ_PLATFORM_MAEMO_CFLAGS)
 fi
 
 dnl ========================================================
 dnl = ARM toolchain tweaks
 dnl ========================================================
 
 dnl Defaults
-case "${target}" in
-arm-android*|arm-linuxandroid*)
+case "${CPU_ARCH}-${OS_TARGET}" in
+arm-Android)
     MOZ_THUMB=yes
     MOZ_ARCH=armv7-a
     MOZ_FPU=vfp
     MOZ_FLOAT_ABI=softfp
-    ;;
-arm*-*)
+    # Temporarily set nspr flags via configure, until bug 674880 lands
+    NSPR_CONFIGURE_FLAGS="--with-thumb --with-arch=armv7-a --with-fpu=vfp --with-float-abi=softfp"
+    ;;
+arm-*)
     if test -n "$MOZ_PLATFORM_MAEMO"; then
         MOZ_THUMB=no
         MOZ_ARCH=armv7-a
         MOZ_FLOAT_ABI=softfp
     fi
     if test "$MOZ_PLATFORM_MAEMO" = 6; then
         MOZ_THUMB=yes
     fi
@@ -9547,16 +9549,17 @@ if test -z "$MOZ_NATIVE_NSPR"; then
        ac_configure_args="$ac_configure_args --enable-debug --disable-optimize"
     fi
     if test -n "$HAVE_64BIT_OS"; then
         ac_configure_args="$ac_configure_args --enable-64bit"
     fi
     if test -n "$USE_ARM_KUSER"; then
         ac_configure_args="$ac_configure_args --with-arm-kuser"
     fi
+    ac_configure_args="$ac_configure_args $NSPR_CONFIGURE_FLAGS"
     AC_OUTPUT_SUBDIRS(nsprpub)
     ac_configure_args="$_SUBDIR_CONFIG_ARGS"
 fi
 
 if test -z "$MOZ_NATIVE_NSPR"; then
     # Hack to deal with the fact that we use NSPR_CFLAGS everywhere
     AC_MSG_WARN([Recreating autoconf.mk with updated nspr-config output])
     if test "$OS_ARCH" != "WINNT"; then
--- a/content/base/src/nsFrameMessageManager.cpp
+++ b/content/base/src/nsFrameMessageManager.cpp
@@ -417,17 +417,17 @@ nsFrameMessageManager::ReceiveMessage(ns
         JS_DefineProperty(ctx, param, "sync",
                           BOOLEAN_TO_JSVAL(aSync), NULL, NULL, JSPROP_ENUMERATE);
         JS_DefineProperty(ctx, param, "json", json, NULL, NULL, JSPROP_ENUMERATE);
         JS_DefineProperty(ctx, param, "objects", objectsv.jsval_value(), NULL, NULL, JSPROP_ENUMERATE);
 
         jsval thisValue = JSVAL_VOID;
 
         jsval funval = JSVAL_VOID;
-        if (JS_ObjectIsFunction(ctx, object)) {
+        if (JS_ObjectIsCallable(ctx, object)) {
           // If the listener is a JS function:
           funval = OBJECT_TO_JSVAL(object);
 
           // A small hack to get 'this' value right on content side where
           // messageManager is wrapped in TabChildGlobal.
           nsCOMPtr<nsISupports> defaultThisValue;
           if (mChrome) {
             defaultThisValue =
@@ -440,17 +440,17 @@ nsFrameMessageManager::ReceiveMessage(ns
                                      defaultThisValue, &thisValue, nsnull, PR_TRUE);
         } else {
           // If the listener is a JS object which has receiveMessage function:
           NS_ENSURE_STATE(JS_GetProperty(ctx, object, "receiveMessage",
                                          &funval) &&
                           JSVAL_IS_OBJECT(funval) &&
                           !JSVAL_IS_NULL(funval));
           JSObject* funobject = JSVAL_TO_OBJECT(funval);
-          NS_ENSURE_STATE(JS_ObjectIsFunction(ctx, funobject));
+          NS_ENSURE_STATE(JS_ObjectIsCallable(ctx, funobject));
           thisValue = OBJECT_TO_JSVAL(object);
         }
 
         jsval rval = JSVAL_VOID;
 
         js::AutoValueRooter argv(ctx);
         argv.set(OBJECT_TO_JSVAL(param));
 
--- a/js/src/configure.in
+++ b/js/src/configure.in
@@ -4484,24 +4484,24 @@ dnl =
 dnl ========================================================
 MOZ_ARG_HEADER(Individual module options)
 
 dnl ========================================================
 dnl = ARM toolchain tweaks
 dnl ========================================================
 
 dnl Defaults
-case "${target}" in
-arm-android*|arm-linuxandroid*)
+case "${CPU_ARCH}-${OS_TARGET}" in
+arm-Android)
     MOZ_THUMB=yes
     MOZ_ARCH=armv7-a
     MOZ_FPU=vfp
     MOZ_FLOAT_ABI=softfp
     ;;
-arm*-*)
+arm-*)
     if test -n "$MOZ_PLATFORM_MAEMO"; then
         MOZ_THUMB=no
         MOZ_ARCH=armv7-a
         MOZ_FLOAT_ABI=softfp
     fi
     if test "$MOZ_PLATFORM_MAEMO" = 6; then
         MOZ_THUMB=yes
     fi
--- a/netwerk/cache/nsDeleteDir.cpp
+++ b/netwerk/cache/nsDeleteDir.cpp
@@ -35,74 +35,74 @@
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
 #include "nsDeleteDir.h"
 #include "nsIFile.h"
 #include "nsString.h"
 #include "prthread.h"
+#include "mozilla/Telemetry.h"
+
+using namespace mozilla;
 
 static void DeleteDirThreadFunc(void *arg)
 {
+  Telemetry::AutoTimer<Telemetry::NETWORK_DISK_CACHE_DELETEDIR> timer;
   nsIFile *dir = static_cast<nsIFile *>(arg);
   dir->Remove(PR_TRUE);
   NS_RELEASE(dir);
 }
 
 nsresult DeleteDir(nsIFile *dirIn, PRBool moveToTrash, PRBool sync)
 {
+  Telemetry::AutoTimer<Telemetry::NETWORK_DISK_CACHE_TRASHRENAME> timer;
   nsresult rv;
   nsCOMPtr<nsIFile> trash, dir;
 
   // Need to make a clone of this since we don't want to modify the input
   // file object.
   rv = dirIn->Clone(getter_AddRefs(dir));
   if (NS_FAILED(rv))
     return rv;
 
-  if (moveToTrash)
-  {
+  if (moveToTrash) {
     rv = GetTrashDir(dir, &trash);
     if (NS_FAILED(rv))
       return rv;
-
-    nsCOMPtr<nsIFile> subDir;
-    rv = trash->Clone(getter_AddRefs(subDir));
+    nsCAutoString leaf;
+    rv = trash->GetNativeLeafName(leaf);
     if (NS_FAILED(rv))
       return rv;
 
-    rv = subDir->AppendNative(NS_LITERAL_CSTRING("Trash"));
-    if (NS_FAILED(rv))
-      return rv;
-
-    rv = subDir->CreateUnique(nsIFile::DIRECTORY_TYPE, 0700);
-    if (NS_FAILED(rv))
-      return rv;
-
-    rv = dir->MoveToNative(subDir, EmptyCString());
-    if (NS_FAILED(rv))
-      return rv;
-  }
-  else
-  {
+    // Important: must rename directory w/o changing parent directory: else on
+    // NTFS we'll wait (with cache lock) while nsIFile's ACL reset walks file
+    // tree: was hanging GUI for *minutes* on large cache dirs.
+    rv = dir->MoveToNative(nsnull, leaf);
+    if (NS_FAILED(rv)) {
+      nsresult rvMove = rv;
+      // TrashDir may already exist (if we crashed while deleting it, etc.)
+      // In that case current Cache dir should be small--just move it to
+      // subdirectory of TrashDir and eat the NTFS ACL overhead.
+      rv = dir->MoveToNative(trash, leaf);
+      if (NS_FAILED(rv))
+        return rvMove;
+    }
+  } else {
     // we want to pass a clone of the original off to the worker thread.
     trash.swap(dir);
   }
 
   // Steal ownership of trash directory; let the thread release it.
   nsIFile *trashRef = nsnull;
   trash.swap(trashRef);
 
-  if (sync)
-  {
+  if (sync) {
     DeleteDirThreadFunc(trashRef);
-  }
-  else
-  {
+  } else {
     // now, invoke the worker thread
     PRThread *thread = PR_CreateThread(PR_USER_THREAD,
                                        DeleteDirThreadFunc,
                                        trashRef,
                                        PR_PRIORITY_LOW,
                                        PR_GLOBAL_THREAD,
                                        PR_UNJOINABLE_THREAD,
                                        0);
--- a/toolkit/components/telemetry/TelemetryHistograms.h
+++ b/toolkit/components/telemetry/TelemetryHistograms.h
@@ -131,10 +131,12 @@ HISTOGRAM(MOZ_SQLITE_URLCLASSIFIER_WRITE
 HISTOGRAM(MOZ_SQLITE_OTHER_WRITE_B, 1, 32768, 3, LINEAR, "SQLite write (bytes)")
 HISTOGRAM(MOZ_SQLITE_TRUNCATE, 1, 3000, 10, EXPONENTIAL, "Time spent on SQLite truncate() (ms)")
 HISTOGRAM(MOZ_SQLITE_PLACES_SYNC, 1, 10000, 10, EXPONENTIAL, "Time spent on SQLite fsync() (ms)")
 HISTOGRAM(MOZ_SQLITE_COOKIES_SYNC, 1, 10000, 10, EXPONENTIAL, "Time spent on SQLite fsync() (ms)")
 HISTOGRAM(MOZ_SQLITE_URLCLASSIFIER_SYNC, 1, 10000, 10, EXPONENTIAL, "Time spent on SQLite fsync() (ms)")
 HISTOGRAM(MOZ_SQLITE_OTHER_SYNC, 1, 10000, 10, EXPONENTIAL, "Time spent on SQLite fsync() (ms)")
 HISTOGRAM(STARTUP_MEASUREMENT_ERRORS, 1, 3, 4, LINEAR, "Flags errors in startup calculation()")
 HISTOGRAM(NETWORK_DISK_CACHE_OPEN, 1, 10000, 10, EXPONENTIAL, "Time spent opening disk cache (ms)")
+HISTOGRAM(NETWORK_DISK_CACHE_TRASHRENAME, 1, 10000, 10, EXPONENTIAL, "Time spent renaming bad Cache to Cache.Trash (ms)")
+HISTOGRAM(NETWORK_DISK_CACHE_DELETEDIR, 1, 10000, 10, EXPONENTIAL, "Time spent deleting disk cache (ms)")
 HISTOGRAM(MOZ_SQLITE_MAIN_THREAD_WAIT_MS, 1, 3000, 10, EXPONENTIAL, "Time spent waiting on SQLite IO on main thread (ms)")
 HISTOGRAM(MOZ_SQLITE_OTHER_THREAD_WAIT_MS, 1, 3000, 10, EXPONENTIAL, "Time spent waiting on SQLite IO off main thread (ms)")
--- a/xpcom/io/nsLocalFileWin.cpp
+++ b/xpcom/io/nsLocalFileWin.cpp
@@ -1351,17 +1351,18 @@ nsLocalFile::GetVersionInfoField(const c
     free(ver);
     
     return rv;
 }
 
 nsresult
 nsLocalFile::CopySingleFile(nsIFile *sourceFile, nsIFile *destParent,
                             const nsAString &newName, 
-                            PRBool followSymlinks, PRBool move)
+                            PRBool followSymlinks, PRBool move,
+                            PRBool skipNtfsAclReset)
 {
     nsresult rv;
     nsAutoString filePath;
 
     // get the path that we are going to copy to.
     // Since windows does not know how to auto
     // resolve shortcuts, we must work with the
     // target.
@@ -1437,18 +1438,20 @@ nsLocalFile::CopySingleFile(nsIFile *sou
                 if (copyOK)
                     DeleteFile(filePath.get());
             }
         }
     }
 
     if (!copyOK)  // CopyFileEx and MoveFileEx return zero at failure.
         rv = ConvertWinError(GetLastError());
-    else if (move) // Set security permissions to inherit from parent.
+    else if (move && !skipNtfsAclReset)
     {
+        // Set security permissions to inherit from parent.
+        // Note: propagates to all children: slow for big file trees
         PACL pOldDACL = NULL;
         PSECURITY_DESCRIPTOR pSD = NULL;
         ::GetNamedSecurityInfoW((LPWSTR)destPath.get(), SE_FILE_OBJECT,
                                 DACL_SECURITY_INFORMATION,
                                 NULL, NULL, &pOldDACL, NULL, &pSD);
         if (pOldDACL)
             ::SetNamedSecurityInfoW((LPWSTR)destPath.get(), SE_FILE_OBJECT,
                                     DACL_SECURITY_INFORMATION |
@@ -1471,17 +1474,16 @@ nsLocalFile::CopyMove(nsIFile *aParentDi
     // hence we can use the |followSymlinks| parameter.
     nsresult rv  = ResolveAndStat();
     if (NS_FAILED(rv))
         return rv;
 
     if (!newParentDir)
     {
         // no parent was specified.  We must rename.
-
         if (newName.IsEmpty())
             return NS_ERROR_INVALID_ARG;
 
         rv = GetParent(getter_AddRefs(newParentDir));
         if (NS_FAILED(rv))
             return rv;
     }
 
@@ -1537,17 +1539,18 @@ nsLocalFile::CopyMove(nsIFile *aParentDi
     IsDirectory(&isDir);
     PRBool isSymlink;
     IsSymlink(&isSymlink);
 
     // Try to move the file or directory, or try to copy a single file (or non-followed symlink)
     if (move || !isDir || (isSymlink && !followSymlinks))
     {
         // Copy/Move single file, or move a directory
-        rv = CopySingleFile(this, newParentDir, newName, followSymlinks, move);
+        rv = CopySingleFile(this, newParentDir, newName, followSymlinks, move,
+                            !aParentDir);
         done = NS_SUCCEEDED(rv);
         // If we are moving a directory and that fails, fallback on directory
         // enumeration.  See bug 231300 for details.
         if (!done && !(move && isDir))
             return rv;  
     }
     
     // Not able to copy or move directly, so enumerate it
--- a/xpcom/io/nsLocalFileWin.h
+++ b/xpcom/io/nsLocalFileWin.h
@@ -118,17 +118,18 @@ private:
     nsresult ResolveShortcut();
 
     void EnsureShortPath();
     
     nsresult CopyMove(nsIFile *newParentDir, const nsAString &newName,
                       PRBool followSymlinks, PRBool move);
     nsresult CopySingleFile(nsIFile *source, nsIFile* dest,
                             const nsAString &newName,
-                            PRBool followSymlinks, PRBool move);
+                            PRBool followSymlinks, PRBool move,
+                            PRBool skipNtfsAclReset = PR_FALSE);
 
     nsresult SetModDate(PRInt64 aLastModifiedTime, const PRUnichar *filePath);
     nsresult HasFileAttribute(DWORD fileAttrib, PRBool *_retval);
     nsresult AppendInternal(const nsAFlatString &node,
                             PRBool multipleComponents);
 };
 
 #endif