summaryrefslogtreecommitdiff
path: root/storage/mozStorageAsyncStatementExecution.h
diff options
context:
space:
mode:
authorwolfbeast <mcwerewolf@gmail.com>2018-02-08 11:43:07 +0100
committerwolfbeast <mcwerewolf@gmail.com>2018-02-08 11:43:07 +0100
commitbfa65f5d5f4fc1a1330acc91945d0587ddf65104 (patch)
tree37e97a62f8983a758a0ef96a56ec22f5ecb9005d /storage/mozStorageAsyncStatementExecution.h
parentb827a3a9cd60b10526e3bc99274a1465f1b6f2d1 (diff)
downloaduxp-bfa65f5d5f4fc1a1330acc91945d0587ddf65104.tar.gz
Cleanup async mozStorage callback management.
Also avoid raw pointers in mozStorageAsyncStatementExecution.cpp.
Diffstat (limited to 'storage/mozStorageAsyncStatementExecution.h')
-rw-r--r--storage/mozStorageAsyncStatementExecution.h13
1 files changed, 12 insertions, 1 deletions
diff --git a/storage/mozStorageAsyncStatementExecution.h b/storage/mozStorageAsyncStatementExecution.h
index c8493fd771..14ea49c2d9 100644
--- a/storage/mozStorageAsyncStatementExecution.h
+++ b/storage/mozStorageAsyncStatementExecution.h
@@ -82,6 +82,14 @@ public:
*/
bool shouldNotify();
+ /**
+ * Used by notifyComplete(), notifyError() and notifyResults() to notify on
+ * the calling thread.
+ */
+ nsresult notifyCompleteOnCallingThread();
+ nsresult notifyErrorOnCallingThread(mozIStorageError *aError);
+ nsresult notifyResultsOnCallingThread(ResultSet *aResultSet);
+
private:
AsyncExecuteStatements(StatementDataArray &aStatements,
Connection *aConnection,
@@ -186,7 +194,10 @@ private:
RefPtr<Connection> mConnection;
sqlite3 *mNativeConnection;
bool mHasTransaction;
- mozIStorageStatementCallback *mCallback;
+ // Note, this may not be a threadsafe object - never addref/release off
+ // the calling thread. We take a reference when this is created, and
+ // release it in the CompletionNotifier::Run() call back to this thread.
+ nsCOMPtr<mozIStorageStatementCallback> mCallback;
nsCOMPtr<nsIThread> mCallingThread;
RefPtr<ResultSet> mResultSet;