Bug 1253094, part 7 - Stop using DebugOnly for class/struct members in storage/. r=mak
MozReview-Commit-ID: EOIRlwurAmI
--- a/storage/mozStorageConnection.cpp
+++ b/storage/mozStorageConnection.cpp
@@ -468,17 +468,19 @@ private:
Connection::Connection(Service *aService,
int aFlags,
bool aAsyncOnly)
: sharedAsyncExecutionMutex("Connection::sharedAsyncExecutionMutex")
, sharedDBMutex("Connection::sharedDBMutex")
, threadOpenedOn(do_GetCurrentThread())
, mDBConn(nullptr)
, mAsyncExecutionThreadShuttingDown(false)
+#ifdef DEBUG
, mAsyncExecutionThreadIsAlive(false)
+#endif
, mConnectionClosed(false)
, mTransactionInProgress(false)
, mProgressHandler(nullptr)
, mFlags(aFlags)
, mStorageService(aService)
, mAsyncOnly(aAsyncOnly)
{
mStorageService->registerConnection(this);
@@ -554,17 +556,20 @@ Connection::getAsyncExecutionTarget()
NS_WARNING("Failed to create async thread.");
return nullptr;
}
static nsThreadPoolNaming naming;
naming.SetThreadPoolName(NS_LITERAL_CSTRING("mozStorage"),
mAsyncExecutionThread);
}
+#ifdef DEBUG
mAsyncExecutionThreadIsAlive = true;
+#endif
+
return mAsyncExecutionThread;
}
nsresult
Connection::initialize()
{
NS_ASSERTION (!mDBConn, "Initialize called on already opened database!");
PROFILER_LABEL("mozStorageConnection", "initialize",
@@ -890,17 +895,19 @@ Connection::isClosed()
void
Connection::shutdownAsyncThread(nsIThread *aThread) {
MOZ_ASSERT(!mAsyncExecutionThread);
MOZ_ASSERT(mAsyncExecutionThreadIsAlive);
MOZ_ASSERT(mAsyncExecutionThreadShuttingDown);
DebugOnly<nsresult> rv = aThread->Shutdown();
MOZ_ASSERT(NS_SUCCEEDED(rv));
+#ifdef DEBUG
mAsyncExecutionThreadIsAlive = false;
+#endif
}
nsresult
Connection::internalClose(sqlite3 *aNativeConnection)
{
// Sanity checks to make sure we are in the proper state before calling this.
// aNativeConnection can be null if OpenAsyncDatabase failed and is now just
// cleaning up the async thread.
--- a/storage/mozStorageConnection.h
+++ b/storage/mozStorageConnection.h
@@ -315,17 +315,19 @@ private:
* sharedAsyncExecutionMutex.
*/
bool mAsyncExecutionThreadShuttingDown;
/**
* Tracks whether the async thread has been initialized and Shutdown() has
* not yet been invoked on it.
*/
- DebugOnly<bool> mAsyncExecutionThreadIsAlive;
+#ifdef DEBUG
+ bool mAsyncExecutionThreadIsAlive;
+#endif
/**
* Set to true just prior to calling sqlite3_close on the
* connection.
*
* This variable should be accessed while holding the
* sharedAsyncExecutionMutex.
*/