Quellcode-Bibliothek TestRacingServiceManager.cpp
Sprache: C
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * 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/. */
class Component1 final : public nsISupports {
~Component1() = default;
public:
NS_DECL_THREADSAFE_ISUPPORTS
Component1() { // This is the real test - make sure that only one instance is ever created.
int32_t count = PR_AtomicIncrement(&gComponent1Count);
MOZ_RELEASE_ASSERT(count == 1, "Too many components created!");
}
};
class Component2 final : public nsISupports {
~Component2() = default;
public:
NS_DECL_THREADSAFE_ISUPPORTS
Component2() { // This is the real test - make sure that only one instance is ever created.
int32_t count = PR_AtomicIncrement(&gComponent2Count);
EXPECT_EQ(count, int32_t(1)) << "Too many components created!";
}
};
NS_IMETHODIMP
Factory::CreateInstance(const nsIID& aIID, void** aResult) { // Make sure that the second thread beat the main thread to the getService // call.
MOZ_RELEASE_ASSERT(!NS_IsMainThread(), "Wrong thread!");
RefPtr<TestRunnable> runnable = new TestRunnable();
ASSERT_TRUE(runnable);
// Run the classID test
nsCOMPtr<nsIThread> newThread;
rv = NS_NewNamedThread("RacingServMan", getter_AddRefs(newThread), runnable);
ASSERT_NS_SUCCEEDED(rv);
¤ Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.0.29Bemerkung:
(vorverarbeitet)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.