mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-01-31 11:01:40 +00:00
Bug 947737 - Build dom/indexedDB in unified mode; r=bent
This commit is contained in:
parent
223ded468f
commit
cfac900741
@ -34,7 +34,7 @@
|
||||
namespace {
|
||||
|
||||
#ifdef MOZ_ENABLE_PROFILER_SPS
|
||||
uint64_t gNextSerialNumber = 1;
|
||||
uint64_t gNextRequestSerialNumber = 1;
|
||||
#endif
|
||||
|
||||
} // anonymous namespace
|
||||
@ -47,7 +47,7 @@ IDBRequest::IDBRequest()
|
||||
: mResultVal(JSVAL_VOID),
|
||||
mActorParent(nullptr),
|
||||
#ifdef MOZ_ENABLE_PROFILER_SPS
|
||||
mSerialNumber(gNextSerialNumber++),
|
||||
mSerialNumber(gNextRequestSerialNumber++),
|
||||
#endif
|
||||
mErrorCode(NS_OK),
|
||||
mLineNo(0),
|
||||
|
@ -45,7 +45,7 @@ namespace {
|
||||
NS_DEFINE_CID(kAppShellCID, NS_APPSHELL_CID);
|
||||
|
||||
#ifdef MOZ_ENABLE_PROFILER_SPS
|
||||
uint64_t gNextSerialNumber = 1;
|
||||
uint64_t gNextTransactionSerialNumber = 1;
|
||||
#endif
|
||||
|
||||
PLDHashOperator
|
||||
@ -166,7 +166,7 @@ IDBTransaction::IDBTransaction()
|
||||
mActorParent(nullptr),
|
||||
mAbortCode(NS_OK),
|
||||
#ifdef MOZ_ENABLE_PROFILER_SPS
|
||||
mSerialNumber(gNextSerialNumber++),
|
||||
mSerialNumber(gNextTransactionSerialNumber++),
|
||||
#endif
|
||||
mCreating(false)
|
||||
#ifdef DEBUG
|
||||
|
@ -4,6 +4,9 @@
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#ifndef IndexedDatabaseInlines_h
|
||||
#define IndexedDatabaseInlines_h
|
||||
|
||||
#ifndef mozilla_dom_indexeddb_indexeddatabase_h__
|
||||
#error Must include IndexedDatabase.h first
|
||||
#endif
|
||||
@ -80,3 +83,5 @@ AppendConditionClause(const nsACString& aColumnName,
|
||||
}
|
||||
|
||||
END_INDEXEDDB_NAMESPACE
|
||||
|
||||
#endif
|
||||
|
@ -105,7 +105,7 @@ END_INDEXEDDB_NAMESPACE
|
||||
|
||||
namespace {
|
||||
|
||||
mozilla::StaticRefPtr<IndexedDatabaseManager> gInstance;
|
||||
mozilla::StaticRefPtr<IndexedDatabaseManager> gDBManager;
|
||||
|
||||
mozilla::Atomic<int32_t> gInitialized(0);
|
||||
mozilla::Atomic<int32_t> gClosed(0);
|
||||
@ -204,7 +204,7 @@ IndexedDatabaseManager::GetOrCreate()
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (!gInstance) {
|
||||
if (!gDBManager) {
|
||||
sIsMainProcess = XRE_GetProcessType() == GeckoProcessType_Default;
|
||||
|
||||
if (sIsMainProcess) {
|
||||
@ -234,12 +234,12 @@ IndexedDatabaseManager::GetOrCreate()
|
||||
NS_ERROR("Initialized more than once?!");
|
||||
}
|
||||
|
||||
gInstance = instance;
|
||||
gDBManager = instance;
|
||||
|
||||
ClearOnShutdown(&gInstance);
|
||||
ClearOnShutdown(&gDBManager);
|
||||
}
|
||||
|
||||
return gInstance;
|
||||
return gDBManager;
|
||||
}
|
||||
|
||||
// static
|
||||
@ -247,7 +247,7 @@ IndexedDatabaseManager*
|
||||
IndexedDatabaseManager::Get()
|
||||
{
|
||||
// Does not return an owning reference.
|
||||
return gInstance;
|
||||
return gDBManager;
|
||||
}
|
||||
|
||||
// static
|
||||
@ -458,7 +458,7 @@ IndexedDatabaseManager::IsClosed()
|
||||
bool
|
||||
IndexedDatabaseManager::IsMainProcess()
|
||||
{
|
||||
NS_ASSERTION(gInstance,
|
||||
NS_ASSERTION(gDBManager,
|
||||
"IsMainProcess() called before indexedDB has been initialized!");
|
||||
NS_ASSERTION((XRE_GetProcessType() == GeckoProcessType_Default) ==
|
||||
sIsMainProcess, "XRE_GetProcessType changed its tune!");
|
||||
@ -469,7 +469,7 @@ IndexedDatabaseManager::IsMainProcess()
|
||||
bool
|
||||
IndexedDatabaseManager::InLowDiskSpaceMode()
|
||||
{
|
||||
NS_ASSERTION(gInstance,
|
||||
NS_ASSERTION(gDBManager,
|
||||
"InLowDiskSpaceMode() called before indexedDB has been "
|
||||
"initialized!");
|
||||
return !!sLowDiskSpaceMode;
|
||||
|
@ -26,7 +26,7 @@ const uint32_t kThreadLimit = 20;
|
||||
const uint32_t kIdleThreadLimit = 5;
|
||||
const uint32_t kIdleThreadTimeoutMs = 30000;
|
||||
|
||||
TransactionThreadPool* gInstance = nullptr;
|
||||
TransactionThreadPool* gThreadPool = nullptr;
|
||||
bool gShutdown = false;
|
||||
|
||||
#ifdef MOZ_ENABLE_PROFILER_SPS
|
||||
@ -67,37 +67,37 @@ END_INDEXEDDB_NAMESPACE
|
||||
TransactionThreadPool::TransactionThreadPool()
|
||||
{
|
||||
NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
|
||||
NS_ASSERTION(!gInstance, "More than one instance!");
|
||||
NS_ASSERTION(!gThreadPool, "More than one instance!");
|
||||
}
|
||||
|
||||
TransactionThreadPool::~TransactionThreadPool()
|
||||
{
|
||||
NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
|
||||
NS_ASSERTION(gInstance == this, "Different instances!");
|
||||
gInstance = nullptr;
|
||||
NS_ASSERTION(gThreadPool == this, "Different instances!");
|
||||
gThreadPool = nullptr;
|
||||
}
|
||||
|
||||
// static
|
||||
TransactionThreadPool*
|
||||
TransactionThreadPool::GetOrCreate()
|
||||
{
|
||||
if (!gInstance && !gShutdown) {
|
||||
if (!gThreadPool && !gShutdown) {
|
||||
NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
|
||||
nsAutoPtr<TransactionThreadPool> pool(new TransactionThreadPool());
|
||||
|
||||
nsresult rv = pool->Init();
|
||||
NS_ENSURE_SUCCESS(rv, nullptr);
|
||||
|
||||
gInstance = pool.forget();
|
||||
gThreadPool = pool.forget();
|
||||
}
|
||||
return gInstance;
|
||||
return gThreadPool;
|
||||
}
|
||||
|
||||
// static
|
||||
TransactionThreadPool*
|
||||
TransactionThreadPool::Get()
|
||||
{
|
||||
return gInstance;
|
||||
return gThreadPool;
|
||||
}
|
||||
|
||||
// static
|
||||
@ -108,12 +108,12 @@ TransactionThreadPool::Shutdown()
|
||||
|
||||
gShutdown = true;
|
||||
|
||||
if (gInstance) {
|
||||
if (NS_FAILED(gInstance->Cleanup())) {
|
||||
if (gThreadPool) {
|
||||
if (NS_FAILED(gThreadPool->Cleanup())) {
|
||||
NS_WARNING("Failed to shutdown thread pool!");
|
||||
}
|
||||
delete gInstance;
|
||||
gInstance = nullptr;
|
||||
delete gThreadPool;
|
||||
gThreadPool = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
@ -646,12 +646,12 @@ FinishTransactionRunnable::Run()
|
||||
|
||||
PROFILER_MAIN_THREAD_LABEL("IndexedDB", "FinishTransactionRunnable::Run");
|
||||
|
||||
if (!gInstance) {
|
||||
if (!gThreadPool) {
|
||||
NS_ERROR("Running after shutdown!");
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
gInstance->FinishTransaction(mTransaction);
|
||||
gThreadPool->FinishTransaction(mTransaction);
|
||||
|
||||
if (mFinishRunnable) {
|
||||
mFinishRunnable->Run();
|
||||
|
@ -11,7 +11,7 @@ EXPORTS.mozilla.dom.indexedDB += [
|
||||
# Need to enable these tests sometime soon.
|
||||
#XPCSHELL_TESTS_MANIFESTS += ['unit/xpcshell.ini']
|
||||
|
||||
SOURCES += [
|
||||
UNIFIED_SOURCES += [
|
||||
'IndexedDBChild.cpp',
|
||||
'IndexedDBParent.cpp',
|
||||
]
|
||||
|
@ -35,21 +35,18 @@ EXPORTS.mozilla.dom.indexedDB += [
|
||||
'KeyPath.h',
|
||||
]
|
||||
|
||||
SOURCES += [
|
||||
UNIFIED_SOURCES += [
|
||||
'AsyncConnectionHelper.cpp',
|
||||
'CheckPermissionsHelper.cpp',
|
||||
'Client.cpp',
|
||||
'DatabaseInfo.cpp',
|
||||
'FileInfo.cpp',
|
||||
'FileManager.cpp',
|
||||
'IDBCursor.cpp',
|
||||
'IDBDatabase.cpp',
|
||||
'IDBEvents.cpp',
|
||||
'IDBFactory.cpp',
|
||||
'IDBFileHandle.cpp',
|
||||
'IDBIndex.cpp',
|
||||
'IDBKeyRange.cpp',
|
||||
'IDBObjectStore.cpp',
|
||||
'IDBRequest.cpp',
|
||||
'IDBTransaction.cpp',
|
||||
'IDBWrapperCache.cpp',
|
||||
@ -60,6 +57,13 @@ SOURCES += [
|
||||
'TransactionThreadPool.cpp',
|
||||
]
|
||||
|
||||
# These files cannot be built in unified mode because of name collisions
|
||||
SOURCES += [
|
||||
'IDBCursor.cpp',
|
||||
'IDBIndex.cpp',
|
||||
'IDBObjectStore.cpp',
|
||||
]
|
||||
|
||||
FAIL_ON_WARNINGS = True
|
||||
|
||||
include('/ipc/chromium/chromium-config.mozbuild')
|
||||
|
Loading…
x
Reference in New Issue
Block a user