зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1497007 - Extracted GetIndexedDBThreadLocal function. r=ttung,asuth
Differential Revision: https://phabricator.services.mozilla.com/D46949 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
bb8fe42e53
Коммит
cdbb1aa771
|
@ -32,6 +32,9 @@
|
|||
#include "ActorsChild.h"
|
||||
|
||||
namespace {
|
||||
using namespace mozilla::dom::indexedDB;
|
||||
using namespace mozilla::ipc;
|
||||
|
||||
// TODO: Move this to xpcom/ds.
|
||||
template <typename T, typename Range, typename Transformation>
|
||||
nsTHashtable<T> TransformToHashtable(const Range& aRange,
|
||||
|
@ -51,6 +54,17 @@ nsTHashtable<T> TransformToHashtable(const Range& aRange,
|
|||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
ThreadLocal* GetIndexedDBThreadLocal() {
|
||||
BackgroundChildImpl::ThreadLocal* const threadLocal =
|
||||
BackgroundChildImpl::GetThreadLocalForCurrentThread();
|
||||
MOZ_ASSERT(threadLocal);
|
||||
|
||||
ThreadLocal* idbThreadLocal = threadLocal->mIndexedDBThreadLocal;
|
||||
MOZ_ASSERT(idbThreadLocal);
|
||||
|
||||
return idbThreadLocal;
|
||||
}
|
||||
} // namespace
|
||||
|
||||
namespace mozilla {
|
||||
|
@ -81,7 +95,7 @@ IDBTransaction::IDBTransaction(IDBDatabase* const aDatabase,
|
|||
: DOMEventTargetHelper(aDatabase),
|
||||
mDatabase(aDatabase),
|
||||
mObjectStoreNames(aObjectStoreNames),
|
||||
mLoggingSerialNumber(0),
|
||||
mLoggingSerialNumber(GetIndexedDBThreadLocal()->NextTransactionSN(aMode)),
|
||||
mNextObjectStoreId(0),
|
||||
mNextIndexId(0),
|
||||
mAbortCode(NS_OK),
|
||||
|
@ -106,16 +120,6 @@ IDBTransaction::IDBTransaction(IDBDatabase* const aDatabase,
|
|||
|
||||
mBackgroundActor.mNormalBackgroundActor = nullptr;
|
||||
|
||||
BackgroundChildImpl::ThreadLocal* const threadLocal =
|
||||
BackgroundChildImpl::GetThreadLocalForCurrentThread();
|
||||
MOZ_ASSERT(threadLocal);
|
||||
|
||||
ThreadLocal* idbThreadLocal = threadLocal->mIndexedDBThreadLocal;
|
||||
MOZ_ASSERT(idbThreadLocal);
|
||||
|
||||
const_cast<int64_t&>(mLoggingSerialNumber) =
|
||||
idbThreadLocal->NextTransactionSN(aMode);
|
||||
|
||||
#ifdef DEBUG
|
||||
if (!aObjectStoreNames.IsEmpty()) {
|
||||
// Make sure the array is properly sorted.
|
||||
|
@ -256,14 +260,7 @@ IDBTransaction* IDBTransaction::GetCurrent() {
|
|||
|
||||
MOZ_ASSERT(BackgroundChild::GetForCurrentThread());
|
||||
|
||||
BackgroundChildImpl::ThreadLocal* const threadLocal =
|
||||
BackgroundChildImpl::GetThreadLocalForCurrentThread();
|
||||
MOZ_ASSERT(threadLocal);
|
||||
|
||||
ThreadLocal* idbThreadLocal = threadLocal->mIndexedDBThreadLocal;
|
||||
MOZ_ASSERT(idbThreadLocal);
|
||||
|
||||
return idbThreadLocal->GetCurrentTransaction();
|
||||
return GetIndexedDBThreadLocal()->GetCurrentTransaction();
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
|
|
Загрузка…
Ссылка в новой задаче