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
parent 037248b0ef
commit 90fb44fc74
2 changed files with 9 additions and 21 deletions

View File

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

View File

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