Bug 774388 - Patch 2: remove sCompositorThreadID, it's redundant - r=nical,mattwoodrow

This commit is contained in:
Benoit Jacob 2014-06-05 16:42:13 -04:00
Родитель 7008eef9b0
Коммит 6e6c966de7
2 изменённых файлов: 9 добавлений и 21 удалений

Просмотреть файл

@ -80,8 +80,6 @@ static Thread* sCompositorThread = nullptr;
// manual reference count of the compositor thread. // manual reference count of the compositor thread.
static int sCompositorThreadRefCount = 0; static int sCompositorThreadRefCount = 0;
static MessageLoop* sMainLoop = nullptr; static MessageLoop* sMainLoop = nullptr;
// When ContentParent::StartUp() is called, we use the Thread global.
static PlatformThreadId sCompositorThreadID = 0;
static MessageLoop* sCompositorLoop = nullptr; static MessageLoop* sCompositorLoop = nullptr;
// See ImageBridgeChild.cpp // See ImageBridgeChild.cpp
@ -99,7 +97,6 @@ static void DeleteCompositorThread()
delete sCompositorThread; delete sCompositorThread;
sCompositorThread = nullptr; sCompositorThread = nullptr;
sCompositorLoop = nullptr; sCompositorLoop = nullptr;
sCompositorThreadID = 0;
} else { } else {
sMainLoop->PostTask(FROM_HERE, NewRunnableFunction(&DeleteCompositorThread)); sMainLoop->PostTask(FROM_HERE, NewRunnableFunction(&DeleteCompositorThread));
} }
@ -119,7 +116,6 @@ static void SetThreadPriority()
void CompositorParent::StartUp() void CompositorParent::StartUp()
{ {
MOZ_ASSERT(!sCompositorThreadID);
MOZ_ASSERT(!sCompositorLoop); MOZ_ASSERT(!sCompositorLoop);
CreateCompositorMap(); CreateCompositorMap();
CreateThread(); CreateThread();
@ -185,8 +181,8 @@ CompositorParent::CompositorParent(nsIWidget* aWidget,
, mOverrideComposeReadiness(false) , mOverrideComposeReadiness(false)
, mForceCompositionTask(nullptr) , mForceCompositionTask(nullptr)
{ {
NS_ABORT_IF_FALSE(sCompositorThread != nullptr || sCompositorThreadID, MOZ_ASSERT(sCompositorThread != nullptr,
"The compositor thread must be Initialized before instanciating a COmpositorParent."); "The compositor thread must be Initialized before instanciating a CmpositorParent.");
MOZ_COUNT_CTOR(CompositorParent); MOZ_COUNT_CTOR(CompositorParent);
mCompositorID = 0; mCompositorID = 0;
// FIXME: This holds on the the fact that right now the only thing that // FIXME: This holds on the the fact that right now the only thing that
@ -204,16 +200,10 @@ CompositorParent::CompositorParent(nsIWidget* aWidget,
++sCompositorThreadRefCount; ++sCompositorThreadRefCount;
} }
PlatformThreadId
CompositorParent::CompositorThreadID()
{
return sCompositorThread ? sCompositorThread->thread_id() : sCompositorThreadID;
}
bool bool
CompositorParent::IsInCompositorThread() CompositorParent::IsInCompositorThread()
{ {
return CompositorThreadID() == PlatformThread::CurrentId(); return sCompositorThread && sCompositorThread->thread_id() == PlatformThread::CurrentId();
} }
uint64_t uint64_t
@ -391,8 +381,8 @@ CompositorParent::ScheduleRenderOnCompositorThread()
void void
CompositorParent::PauseComposition() CompositorParent::PauseComposition()
{ {
NS_ABORT_IF_FALSE(CompositorThreadID() == PlatformThread::CurrentId(), MOZ_ASSERT(IsInCompositorThread(),
"PauseComposition() can only be called on the compositor thread"); "PauseComposition() can only be called on the compositor thread");
MonitorAutoLock lock(mPauseCompositionMonitor); MonitorAutoLock lock(mPauseCompositionMonitor);
@ -410,8 +400,8 @@ CompositorParent::PauseComposition()
void void
CompositorParent::ResumeComposition() CompositorParent::ResumeComposition()
{ {
NS_ABORT_IF_FALSE(CompositorThreadID() == PlatformThread::CurrentId(), MOZ_ASSERT(IsInCompositorThread(),
"ResumeComposition() can only be called on the compositor thread"); "ResumeComposition() can only be called on the compositor thread");
MonitorAutoLock lock(mResumeCompositionMonitor); MonitorAutoLock lock(mResumeCompositionMonitor);
@ -597,8 +587,8 @@ CompositorParent::CompositeToTarget(DrawTarget* aTarget, const nsIntRect* aRect)
PROFILER_LABEL("CompositorParent", "Composite", PROFILER_LABEL("CompositorParent", "Composite",
js::ProfileEntry::Category::GRAPHICS); js::ProfileEntry::Category::GRAPHICS);
NS_ABORT_IF_FALSE(CompositorThreadID() == PlatformThread::CurrentId(), MOZ_ASSERT(IsInCompositorThread(),
"Composite can only be called on the compositor thread"); "Composite can only be called on the compositor thread");
#ifdef COMPOSITOR_PERFORMANCE_WARNING #ifdef COMPOSITOR_PERFORMANCE_WARNING
TimeDuration scheduleDelta = TimeStamp::Now() - mExpectedComposeStartTime; TimeDuration scheduleDelta = TimeStamp::Now() - mExpectedComposeStartTime;

Просмотреть файл

@ -259,8 +259,6 @@ protected:
void ForceComposition(); void ForceComposition();
void CancelCurrentCompositeTask(); void CancelCurrentCompositeTask();
inline static PlatformThreadId CompositorThreadID();
/** /**
* Creates a global map referencing each compositor by ID. * Creates a global map referencing each compositor by ID.
* *