Backout change 3f62597c7e66 (bug 1156611) due to backout of bug 970307.
authorCervantes Yu <cyu@mozilla.com>
Tue, 19 May 2015 11:26:23 +0800
changeset 266161 7e71880f7a2e75d4815691a90973e258ef1694d9
parent 266160 dd47867000d3042ae570b31d428f6625c8a9dc13
child 266162 3385678d8fd580f049a59fe9a84b295800ccae5d
push id2231
push usermichael.l.comella@gmail.com
push dateFri, 22 May 2015 20:04:59 +0000
bugs1156611, 970307
milestone41.0a1
backs out3f62597c7e66716ff5e8a37057e29b58a063fd06
Backout change 3f62597c7e66 (bug 1156611) due to backout of bug 970307.
dom/indexedDB/ActorsParent.cpp
--- a/dom/indexedDB/ActorsParent.cpp
+++ b/dom/indexedDB/ActorsParent.cpp
@@ -87,20 +87,16 @@
 #include "nsString.h"
 #include "nsThreadUtils.h"
 #include "nsXPCOMCID.h"
 #include "PermissionRequestBase.h"
 #include "ProfilerHelpers.h"
 #include "ReportInternalError.h"
 #include "snappy/snappy.h"
 
-#ifdef MOZ_NUWA_PROCESS
-#include "nsThread.h"
-#endif
-
 #define DISABLE_ASSERTS_FOR_FUZZING 0
 
 #if DISABLE_ASSERTS_FOR_FUZZING
 #define ASSERT_UNLESS_FUZZING(...) do { } while (0)
 #else
 #define ASSERT_UNLESS_FUZZING(...) MOZ_ASSERT(false, __VA_ARGS__)
 #endif
 
@@ -4817,37 +4813,23 @@ private:
 
   NS_DECL_NSIRUNNABLE
 };
 
 struct ConnectionPool::ThreadInfo
 {
   nsCOMPtr<nsIThread> mThread;
   nsRefPtr<ThreadRunnable> mRunnable;
-#ifdef MOZ_NUWA_PROCESS
-  bool mNuwaWorking;
-#endif
 
   ThreadInfo();
 
   explicit
   ThreadInfo(const ThreadInfo& aOther);
 
   ~ThreadInfo();
-
-  void
-  NuwaSetWorking(bool aWorking)
-#ifdef MOZ_NUWA_PROCESS
-    ;
-#else
-  {
-    AssertIsOnBackgroundThread();
-    MOZ_ASSERT(mThread);
-  }
-#endif
 };
 
 struct ConnectionPool::DatabaseInfo final
 {
   friend class nsAutoPtr<DatabaseInfo>;
 
   nsRefPtr<ConnectionPool> mConnectionPool;
   const nsCString mDatabaseId;
@@ -9960,18 +9942,16 @@ ConnectionPool::CancelIdleTimer()
 void
 ConnectionPool::ShutdownThread(ThreadInfo& aThreadInfo)
 {
   AssertIsOnOwningThread();
   MOZ_ASSERT(aThreadInfo.mThread);
   MOZ_ASSERT(aThreadInfo.mRunnable);
   MOZ_ASSERT(mTotalThreadCount);
 
-  aThreadInfo.NuwaSetWorking(/* aWorking */ false);
-
   nsRefPtr<ThreadRunnable> runnable;
   aThreadInfo.mRunnable.swap(runnable);
 
   nsCOMPtr<nsIThread> thread;
   aThreadInfo.mThread.swap(thread);
 
   IDB_DEBUG_LOG(("ConnectionPool shutting down thread %lu",
                  runnable->SerialNumber()));
@@ -10090,18 +10070,16 @@ ConnectionPool::ScheduleTransaction(Tran
 
       dbInfo->mThreadInfo.mRunnable.swap(threadInfo.mRunnable);
       dbInfo->mThreadInfo.mThread.swap(threadInfo.mThread);
 
       mIdleThreads.RemoveElementAt(lastIndex);
 
       AdjustIdleTimer();
     }
-
-    dbInfo->mThreadInfo.NuwaSetWorking(/* aWorking */ true);
   }
 
   MOZ_ASSERT(dbInfo->mThreadInfo.mThread);
   MOZ_ASSERT(dbInfo->mThreadInfo.mRunnable);
 
   if (aTransactionInfo->mIsWriteTransaction) {
     if (dbInfo->mRunningWriteTransaction) {
       // SQLite only allows one write transaction at a time so queue this
@@ -10311,18 +10289,16 @@ ConnectionPool::NoteIdleDatabase(Databas
       // thread down immediately instead of going through the idle thread
       // mechanism.
       ShutdownThread(aDatabaseInfo->mThreadInfo);
     }
 
     return;
   }
 
-  aDatabaseInfo->mThreadInfo.NuwaSetWorking(/* aWorking */ false);
-
   mIdleDatabases.InsertElementSorted(aDatabaseInfo);
 
   AdjustIdleTimer();
 }
 
 void
 ConnectionPool::NoteClosedDatabase(DatabaseInfo* aDatabaseInfo)
 {
@@ -10356,18 +10332,16 @@ ConnectionPool::NoteClosedDatabase(Datab
       // Give the thread to another database.
       ScheduleQueuedTransactions(aDatabaseInfo->mThreadInfo);
     } else if (!aDatabaseInfo->TotalTransactionCount()) {
       if (mShutdownRequested) {
         ShutdownThread(aDatabaseInfo->mThreadInfo);
       } else {
         MOZ_ASSERT(!mIdleThreads.Contains(aDatabaseInfo->mThreadInfo));
 
-        aDatabaseInfo->mThreadInfo.NuwaSetWorking(/* aWorking */ false);
-
         mIdleThreads.InsertElementSorted(aDatabaseInfo->mThreadInfo);
 
         aDatabaseInfo->mThreadInfo.mRunnable = nullptr;
         aDatabaseInfo->mThreadInfo.mThread = nullptr;
 
         if (mIdleThreads.Length() > kMaxIdleConnectionThreadCount) {
           ShutdownThread(mIdleThreads[0].mThreadInfo);
           mIdleThreads.RemoveElementAt(0);
@@ -10490,18 +10464,16 @@ ConnectionPool::CloseDatabase(DatabaseIn
   MOZ_ASSERT(aDatabaseInfo->mThreadInfo.mRunnable);
   MOZ_ASSERT(!aDatabaseInfo->mClosing);
 
   aDatabaseInfo->mNeedsCheckpoint = false;
   aDatabaseInfo->mClosing = true;
 
   nsCOMPtr<nsIRunnable> runnable = new CloseConnectionRunnable(aDatabaseInfo);
 
-  aDatabaseInfo->mThreadInfo.NuwaSetWorking(/* aWorking */ true);
-
   MOZ_ALWAYS_TRUE(NS_SUCCEEDED(
     aDatabaseInfo->mThreadInfo.mThread->Dispatch(runnable,
                                                  NS_DISPATCH_NORMAL)));
 }
 
 bool
 ConnectionPool::CloseDatabaseWhenIdleInternal(const nsACString& aDatabaseId)
 {
@@ -10840,91 +10812,42 @@ ThreadRunnable::Run()
   profiler_unregister_thread();
 #endif // MOZ_ENABLE_PROFILER_SPS
 
   return NS_OK;
 }
 
 ConnectionPool::
 ThreadInfo::ThreadInfo()
-#ifdef MOZ_NUWA_PROCESS
-  : mNuwaWorking(false)
-#endif
 {
   AssertIsOnBackgroundThread();
 
   MOZ_COUNT_CTOR(ConnectionPool::ThreadInfo);
 }
 
 ConnectionPool::
 ThreadInfo::ThreadInfo(const ThreadInfo& aOther)
   : mThread(aOther.mThread)
   , mRunnable(aOther.mRunnable)
-#ifdef MOZ_NUWA_PROCESS
-  , mNuwaWorking(false)
-#endif
 {
   AssertIsOnBackgroundThread();
   MOZ_ASSERT(aOther.mThread);
   MOZ_ASSERT(aOther.mRunnable);
 
   MOZ_COUNT_CTOR(ConnectionPool::ThreadInfo);
 }
 
 ConnectionPool::
 ThreadInfo::~ThreadInfo()
 {
   AssertIsOnBackgroundThread();
 
-#ifdef MOZ_NUWA_PROCESS
-  MOZ_ASSERT(!mNuwaWorking);
-#endif
-
   MOZ_COUNT_DTOR(ConnectionPool::ThreadInfo);
 }
 
-#ifdef MOZ_NUWA_PROCESS
-
-void
-ConnectionPool::
-ThreadInfo::NuwaSetWorking(bool aWorking)
-{
-  AssertIsOnBackgroundThread();
-  MOZ_ASSERT(mThread);
-
-  if (mNuwaWorking == aWorking) {
-    return;
-  }
-
-  nsCOMPtr<nsIRunnable> runnable = NS_NewRunnableFunction(
-    [aWorking]
-    {
-      MOZ_ASSERT(!IsOnBackgroundThread());
-      MOZ_ASSERT(!NS_IsMainThread());
-
-      auto* thread = static_cast<nsThread*>(NS_GetCurrentThread());
-      MOZ_ASSERT(thread);
-
-      if (aWorking) {
-        thread->SetWorking();
-      } else {
-        thread->SetIdle();
-      }
-    }
-  );
-  MOZ_ASSERT(runnable);
-
-  MOZ_ALWAYS_TRUE(NS_SUCCEEDED(
-    mThread->Dispatch(runnable, NS_DISPATCH_NORMAL)));
-
-  mNuwaWorking = aWorking;
-}
-
-#endif // MOZ_NUWA_PROCESS
-
 ConnectionPool::
 IdleResource::IdleResource(const TimeStamp& aIdleTime)
   : mIdleTime(aIdleTime)
 {
   AssertIsOnBackgroundThread();
   MOZ_ASSERT(!aIdleTime.IsNull());
 
   MOZ_COUNT_CTOR(ConnectionPool::IdleResource);