mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-23 21:01:08 +00:00
Bug 1733308 - Fix non-unified builds errors in xpcom/tests/gtest. r=xpcom-reviewers,mccr8
objdir/dist/include/mozilla/Queue.h:251:31: error: use of undeclared identifier 'moz_xcalloc' xpcom/base/nsCOMPtr.h:436:5: error: static_assert failed due to requirement '1 < sizeof (TestForIID<nsIEventTarget>(nullptr))' "nsCOMPtr only works for types with IIDs. Either use RefPtr; add an IID to your type with NS_DECLARE_STATIC_IID_ACCESSOR/NS_DEFINE_STATIC_IID_ACCESSOR; or make the nsCOMPtr point to a base class with an IID." xpcom/tests/gtest/TestDelayedRunnable.cpp:16:28: error: field has incomplete type '(anonymous namespace)::ReleaseDetector' xpcom/tests/gtest/TestDelayedRunnable.cpp:16:3: error: 'explicit' can only appear on non-static member functions xpcom/tests/gtest/TestDelayedRunnable.cpp:16:40: error: expected ')' xpcom/tests/gtest/TestDelayedRunnable.cpp:16:61: error: use of undeclared identifier 'aActive' xpcom/tests/gtest/TestDelayedRunnable.cpp:28:3: error: no template named 'Atomic'; did you mean 'mozilla::Atomic'? xpcom/tests/gtest/TestDelayedRunnable.cpp:34:3: error: no template named 'Atomic'; did you mean 'mozilla::Atomic'? xpcom/tests/gtest/TestDelayedRunnable.cpp:36:18: error: use of undeclared identifier 'TaskQueue'; did you mean 'taskQueue'? xpcom/tests/gtest/TestDelayedRunnable.cpp:36:18: error: variable 'taskQueue' declared with deduced type 'auto' cannot appear in its own initializer xpcom/tests/gtest/TestDelayedRunnable.cpp:36:48: error: use of undeclared identifier 'MediaThreadType' xpcom/tests/gtest/TestDelayedRunnable.cpp:36:48: error: use of undeclared identifier 'MediaThreadType'; did you mean 'mozilla::MediaThreadType'? xpcom/tests/gtest/TestDelayedRunnable.cpp:38:51: error: no matching conversion for functional-style cast from 'Atomic<bool> *' to '(anonymous namespace)::ReleaseDetector' xpcom/tests/gtest/TestDelayedRunnable.cpp:54:3: error: no template named 'Atomic'; did you mean 'mozilla::Atomic'? xpcom/tests/gtest/TestDelayedRunnable.cpp:58:51: error: no matching conversion for functional-style cast from 'Atomic<bool> *' to '(anonymous namespace)::ReleaseDetector' xpcom/tests/gtest/TestDelayedRunnable.cpp:88:3: error: use of undeclared identifier 'Unused'; did you mean 'mozilla::Unused'? xpcom/tests/gtest/TestDelayedRunnable.cpp:104:3: error: use of undeclared identifier 'Unused'; did you mean 'mozilla::Unused'? xpcom/tests/gtest/TestDelayedRunnable.cpp:109:10: error: unknown type name 'SharedThreadPool'; did you mean 'mozilla::SharedThreadPool'? xpcom/tests/gtest/TestDelayedRunnable.cpp:109:35: error: use of undeclared identifier 'SharedThreadPool' xpcom/tests/gtest/TestDelayedRunnable.cpp:109:35: error: use of undeclared identifier 'SharedThreadPool'; did you mean 'mozilla::SharedThreadPool'? xpcom/tests/gtest/TestDelayedRunnable.cpp:110:25: error: use of function template name with no prior declaration in function call with explicit template arguments is a C++20 extension [-Werror,-Wc++20-extensions] xpcom/tests/gtest/TestDelayedRunnable.cpp:110:36: error: unknown type name 'TaskQueue'; did you mean 'mozilla::TaskQueue'? xpcom/tests/gtest/TestDelayedRunnable.cpp:112:36: error: unknown type name 'TaskQueue'; did you mean 'mozilla::TaskQueue'? xpcom/tests/gtest/TestFileNTFSSpecialPaths.cpp:18:28: error: use of undeclared identifier 'do_CreateInstance' xpcom/tests/gtest/TestFileNTFSSpecialPaths.cpp:26:28: error: use of undeclared identifier 'do_CreateInstance' xpcom/tests/gtest/TestFileNTFSSpecialPaths.cpp:39:28: error: use of undeclared identifier 'do_CreateInstance' xpcom/tests/gtest/TestFileNTFSSpecialPaths.cpp:279:28: error: use of undeclared identifier 'do_CreateInstance' xpcom/tests/gtest/TestFilePreferencesWin.cpp:113:26: error: use of undeclared identifier 'do_CreateInstance' xpcom/tests/gtest/TestFilePreferencesWin.cpp:140:26: error: use of undeclared identifier 'do_CreateInstance' xpcom/tests/gtest/TestFilePreferencesWin.cpp:156:31: error: use of undeclared identifier 'NS_OS_TEMP_DIR' xpcom/tests/gtest/TestJSHolderMap.cpp:50:28: error: unknown type name 'JSHolderMap' xpcom/tests/gtest/TestJSHolderMap.cpp:52:35: error: use of undeclared identifier 'i' xpcom/tests/gtest/TestJSHolderMap.cpp:52:45: error: use of undeclared identifier 'i' xpcom/tests/gtest/TestJSHolderMap.cpp:52:8: error: use of undeclared identifier 'JSHolderMap' xpcom/tests/gtest/TestJSHolderMap.cpp:52:8: error: use of undeclared identifier 'JSHolderMap'; did you mean 'mozilla::JSHolderMap'? xpcom/tests/gtest/TestJSHolderMap.cpp:53:24: error: use of undeclared identifier 'i' xpcom/tests/gtest/TestJSHolderMap.cpp:54:24: error: use of undeclared identifier 'i' xpcom/tests/gtest/TestJSHolderMap.cpp:68:3: error: unknown type name 'JSHolderMap'; did you mean 'mozilla::JSHolderMap'? xpcom/tests/gtest/TestJSHolderMap.cpp:73:3: error: unknown type name 'JSHolderMap'; did you mean 'mozilla::JSHolderMap'? xpcom/tests/gtest/TestJSHolderMap.cpp:99:3: error: unknown type name 'JSHolderMap'; did you mean 'mozilla::JSHolderMap'? xpcom/tests/gtest/TestJSHolderMap.cpp:104:9: error: use of undeclared identifier 'JSHolderMap' xpcom/tests/gtest/TestJSHolderMap.cpp:104:9: error: use of undeclared identifier 'JSHolderMap'; did you mean 'mozilla::JSHolderMap'? xpcom/tests/gtest/TestJSHolderMap.cpp:125:41: error: use of undeclared identifier 'MakeUnique' xpcom/tests/gtest/TestJSHolderMap.cpp:147:3: error: unknown type name 'JSHolderMap'; did you mean 'mozilla::JSHolderMap'? xpcom/tests/gtest/TestJSHolderMap.cpp:151:41: error: use of undeclared identifier 'MakeUnique' xpcom/tests/gtest/TestRWLock.cpp:92:3: error: no template named 'Maybe'; did you mean 'mozilla::Maybe'? xpcom/tests/gtest/TestRWLock.cpp:95:23: error: use of undeclared identifier 'SyncRunnable'; did you mean 'mozilla::SyncRunnable'? xpcom/tests/gtest/TestRWLock.cpp:103:5: error: unknown type name 'AutoTryReadLock'; did you mean 'mozilla::AutoTryReadLock'? xpcom/tests/gtest/TestRWLock.cpp:107:5: error: unknown type name 'AutoTryReadLock'; did you mean 'mozilla::AutoTryReadLock'? xpcom/tests/gtest/TestRWLock.cpp:111:7: error: unknown type name 'AutoTryReadLock'; did you mean 'mozilla::AutoTryReadLock'? xpcom/tests/gtest/TestRWLock.cpp:120:7: error: unknown type name 'AutoTryReadLock'; did you mean 'mozilla::AutoTryReadLock'? xpcom/tests/gtest/TestRWLock.cpp:130:5: error: unknown type name 'AutoWriteLock'; did you mean 'mozilla::AutoWriteLock'? xpcom/tests/gtest/TestRWLock.cpp:133:5: error: unknown type name 'AutoTryReadLock'; did you mean 'mozilla::AutoTryReadLock'? xpcom/tests/gtest/TestRWLock.cpp:137:7: error: unknown type name 'AutoTryReadLock'; did you mean 'mozilla::AutoTryReadLock'? xpcom/tests/gtest/TestRWLock.cpp:142:3: error: unknown type name 'AutoTryReadLock'; did you mean 'mozilla::AutoTryReadLock'? xpcom/tests/gtest/TestRWLock.cpp:146:5: error: unknown type name 'AutoTryReadLock'; did you mean 'mozilla::AutoTryReadLock'? xpcom/tests/gtest/TestRWLock.cpp:155:5: error: unknown type name 'AutoTryWriteLock'; did you mean 'mozilla::AutoTryWriteLock'? xpcom/tests/gtest/TestRWLock.cpp:159:5: error: unknown type name 'AutoTryReadLock'; did you mean 'mozilla::AutoTryReadLock'? xpcom/tests/gtest/TestRWLock.cpp:163:7: error: unknown type name 'AutoTryWriteLock'; did you mean 'mozilla::AutoTryWriteLock'? xpcom/tests/gtest/TestRWLock.cpp:172:7: error: unknown type name 'AutoTryWriteLock'; did you mean 'mozilla::AutoTryWriteLock'? xpcom/tests/gtest/TestRWLock.cpp:182:5: error: unknown type name 'AutoReadLock'; did you mean 'mozilla::AutoReadLock'? xpcom/tests/gtest/TestRWLock.cpp:184:5: error: unknown type name 'AutoTryWriteLock'; did you mean 'mozilla::AutoTryWriteLock'? xpcom/tests/gtest/TestRWLock.cpp:188:7: error: unknown type name 'AutoTryWriteLock'; did you mean 'mozilla::AutoTryWriteLock'? xpcom/tests/gtest/TestRWLock.cpp:194:5: error: unknown type name 'AutoWriteLock'; did you mean 'mozilla::AutoWriteLock'? xpcom/tests/gtest/TestRWLock.cpp:197:5: error: unknown type name 'AutoTryWriteLock'; did you mean 'mozilla::AutoTryWriteLock'? xpcom/tests/gtest/TestRWLock.cpp:201:7: error: unknown type name 'AutoTryWriteLock'; did you mean 'mozilla::AutoTryWriteLock'? Differential Revision: https://phabricator.services.mozilla.com/D127042
This commit is contained in:
parent
25134bc800
commit
2d21eb6e9e
@ -5,12 +5,21 @@
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "mozilla/DelayedRunnable.h"
|
||||
#include "mozilla/Atomics.h"
|
||||
#include "mozilla/RefPtr.h"
|
||||
#include "mozilla/TaskQueue.h"
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
#include "MediaTimer.h"
|
||||
#include "mozilla/media/MediaUtils.h"
|
||||
#include "VideoUtils.h"
|
||||
|
||||
using mozilla::Atomic;
|
||||
using mozilla::MakeRefPtr;
|
||||
using mozilla::Monitor;
|
||||
using mozilla::MonitorAutoLock;
|
||||
using mozilla::TaskQueue;
|
||||
|
||||
namespace {
|
||||
struct ReleaseDetector {
|
||||
explicit ReleaseDetector(Atomic<bool>* aActive) : mActive(aActive) {
|
||||
@ -32,8 +41,8 @@ struct ReleaseDetector {
|
||||
TEST(DelayedRunnable, TaskQueueShutdownLeak)
|
||||
{
|
||||
Atomic<bool> active{false};
|
||||
auto taskQueue =
|
||||
MakeRefPtr<TaskQueue>(GetMediaThreadPool(MediaThreadType::SUPERVISOR));
|
||||
auto taskQueue = MakeRefPtr<TaskQueue>(
|
||||
GetMediaThreadPool(mozilla::MediaThreadType::SUPERVISOR));
|
||||
taskQueue->DelayedDispatch(
|
||||
NS_NewRunnableFunction(__func__, [release = ReleaseDetector(&active)] {}),
|
||||
60e3 /* 1 minute */);
|
||||
@ -85,7 +94,7 @@ TEST(DelayedRunnable, BackgroundTaskQueueShutdownTask)
|
||||
|
||||
// Leak the queue, so it gets cleaned up by xpcom-shutdown.
|
||||
nsISerialEventTarget* tq = taskQueue.forget().take();
|
||||
Unused << tq;
|
||||
mozilla::Unused << tq;
|
||||
}
|
||||
|
||||
/*
|
||||
@ -101,12 +110,13 @@ TEST(DelayedRunnable, nsThreadShutdownTask)
|
||||
|
||||
// Leak the thread, so it gets cleaned up by xpcom-shutdown.
|
||||
nsIThread* t = thread.forget().take();
|
||||
Unused << t;
|
||||
mozilla::Unused << t;
|
||||
}
|
||||
|
||||
TEST(DelayedRunnable, TimerFiresBeforeRunnableRuns)
|
||||
{
|
||||
RefPtr<SharedThreadPool> pool = SharedThreadPool::Get("Test Pool"_ns);
|
||||
RefPtr<mozilla::SharedThreadPool> pool =
|
||||
mozilla::SharedThreadPool::Get("Test Pool"_ns);
|
||||
auto tailTaskQueue1 = MakeRefPtr<TaskQueue>(
|
||||
do_AddRef(pool), /* aSupportsTailDispatch = */ true);
|
||||
auto tailTaskQueue2 = MakeRefPtr<TaskQueue>(
|
||||
@ -125,8 +135,8 @@ TEST(DelayedRunnable, TimerFiresBeforeRunnableRuns)
|
||||
NS_NewRunnableFunction(__func__, [&] {}), 1);
|
||||
Monitor innerMonitor(__func__);
|
||||
MonitorAutoLock lock(innerMonitor);
|
||||
auto timer = MakeRefPtr<MediaTimer>();
|
||||
timer->WaitFor(TimeDuration::FromMilliseconds(1), __func__)
|
||||
auto timer = MakeRefPtr<mozilla::MediaTimer>();
|
||||
timer->WaitFor(mozilla::TimeDuration::FromMilliseconds(1), __func__)
|
||||
->Then(noTailTaskQueue, __func__, [&] {
|
||||
MonitorAutoLock lock(innerMonitor);
|
||||
innerMonitor.NotifyAll();
|
||||
|
@ -6,6 +6,7 @@
|
||||
#include "prio.h"
|
||||
#include "prsystem.h"
|
||||
|
||||
#include "nsComponentManagerUtils.h"
|
||||
#include "nsIFile.h"
|
||||
#include "nsILocalFileWin.h"
|
||||
#include "nsString.h"
|
||||
|
@ -1,6 +1,8 @@
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
#include "mozilla/FilePreferences.h"
|
||||
#include "nsComponentManagerUtils.h"
|
||||
#include "nsDirectoryServiceDefs.h"
|
||||
#include "nsIFile.h"
|
||||
#include "nsXPCOMCID.h"
|
||||
|
||||
|
@ -13,6 +13,7 @@
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
using mozilla::JSHolderMap;
|
||||
using mozilla::Maybe;
|
||||
using mozilla::UniquePtr;
|
||||
using mozilla::Vector;
|
||||
@ -122,7 +123,8 @@ static void TestIterate(HolderKind kind) {
|
||||
Vector<UniquePtr<MyHolder>, 0, InfallibleAllocPolicy> holders;
|
||||
bool seen[count] = {};
|
||||
for (size_t i = 1; i < count; i++) {
|
||||
MOZ_ALWAYS_TRUE(holders.emplaceBack(MakeUnique<MyHolder>(kind, i)));
|
||||
MOZ_ALWAYS_TRUE(
|
||||
holders.emplaceBack(mozilla::MakeUnique<MyHolder>(kind, i)));
|
||||
map.Put(holders.back().get(), tracer, ZoneForKind(kind));
|
||||
}
|
||||
for (iter.emplace(map); !iter->Done(); iter->Next()) {
|
||||
@ -148,7 +150,7 @@ static void TestAddRemoveMany(HolderKind kind, size_t count) {
|
||||
|
||||
Vector<UniquePtr<MyHolder>, 0, InfallibleAllocPolicy> holders;
|
||||
for (size_t i = 0; i < count; i++) {
|
||||
MOZ_ALWAYS_TRUE(holders.emplaceBack(MakeUnique<MyHolder>(kind)));
|
||||
MOZ_ALWAYS_TRUE(holders.emplaceBack(mozilla::MakeUnique<MyHolder>(kind)));
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < count; i++) {
|
||||
|
@ -11,6 +11,10 @@
|
||||
#include "nsIThread.h"
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
using mozilla::AutoReadLock;
|
||||
using mozilla::AutoTryReadLock;
|
||||
using mozilla::AutoTryWriteLock;
|
||||
using mozilla::AutoWriteLock;
|
||||
using mozilla::RWLock;
|
||||
|
||||
static const size_t sNumThreads = 4;
|
||||
@ -89,10 +93,11 @@ static std::invoke_result_t<Function> RunOnBackgroundThread(
|
||||
nsCOMPtr<nsISerialEventTarget> thread;
|
||||
MOZ_ALWAYS_SUCCEEDS(NS_CreateBackgroundTaskQueue(
|
||||
"TestRWLock Background Thread", getter_AddRefs(thread)));
|
||||
Maybe<Result> tryResult;
|
||||
mozilla::Maybe<Result> tryResult;
|
||||
RefPtr<nsIRunnable> runnable =
|
||||
NS_NewRunnableFunction(__func__, [&] { tryResult.emplace(aFunction()); });
|
||||
MOZ_ALWAYS_SUCCEEDS(SyncRunnable::DispatchToThread(thread.get(), runnable));
|
||||
MOZ_ALWAYS_SUCCEEDS(
|
||||
mozilla::SyncRunnable::DispatchToThread(thread.get(), runnable));
|
||||
return *tryResult;
|
||||
}
|
||||
|
||||
|
@ -4,6 +4,7 @@
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
#include "../../io/nsSegmentedBuffer.h"
|
||||
#include "nsIEventTarget.h"
|
||||
|
||||
using namespace mozilla;
|
||||
|
||||
|
@ -159,5 +159,3 @@ TEST_HARNESS_FILES.gtest += [
|
||||
FINAL_LIBRARY = "xul-gtest"
|
||||
|
||||
include("/ipc/chromium/chromium-config.mozbuild")
|
||||
|
||||
REQUIRES_UNIFIED_BUILD = True
|
||||
|
@ -11,6 +11,7 @@
|
||||
#include <stdint.h>
|
||||
#include "mozilla/MemoryReporting.h"
|
||||
#include "mozilla/Assertions.h"
|
||||
#include "mozalloc.h"
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user