Commit 5041c078 authored by hongchan's avatar hongchan Committed by Commit bot

Remove DCHECK_IS_ON() condition check around *.isGraphOwner() method

As a first step of ASSERT removal from modules/webaudio, this CL
removes all DCHECK_IS_ON() condition check from isGraphOwner() and put
the check inside of the method.

The method is only used inside of DCHECK() so it must be no-op in the
release build. That is why it returns false, so we can catch the
anomaly when it happens.

BUG=707643

Review-Url: https://codereview.chromium.org/2805823003
Cr-Commit-Position: refs/heads/master@{#462940}
parent f045f6df
...@@ -141,9 +141,7 @@ void AnalyserHandler::setSmoothingTimeConstant(double k, ...@@ -141,9 +141,7 @@ void AnalyserHandler::setSmoothingTimeConstant(double k,
} }
void AnalyserHandler::updatePullStatus() { void AnalyserHandler::updatePullStatus() {
#if DCHECK_IS_ON()
DCHECK(context()->isGraphOwner()); DCHECK(context()->isGraphOwner());
#endif
if (output(0).isConnected()) { if (output(0).isConnected()) {
// When an AudioBasicInspectorNode is connected to a downstream node, it // When an AudioBasicInspectorNode is connected to a downstream node, it
......
...@@ -290,10 +290,10 @@ class MODULES_EXPORT BaseAudioContext ...@@ -290,10 +290,10 @@ class MODULES_EXPORT BaseAudioContext
void lock() { deferredTaskHandler().lock(); } void lock() { deferredTaskHandler().lock(); }
bool tryLock() { return deferredTaskHandler().tryLock(); } bool tryLock() { return deferredTaskHandler().tryLock(); }
void unlock() { deferredTaskHandler().unlock(); } void unlock() { deferredTaskHandler().unlock(); }
#if DCHECK_IS_ON()
// Returns true if this thread owns the context's lock. // Returns true if this thread owns the context's lock.
bool isGraphOwner() { return deferredTaskHandler().isGraphOwner(); } bool isGraphOwner() { return deferredTaskHandler().isGraphOwner(); }
#endif
using AutoLocker = DeferredTaskHandler::AutoLocker; using AutoLocker = DeferredTaskHandler::AutoLocker;
// Returns the maximum numuber of channels we can support. // Returns the maximum numuber of channels we can support.
......
...@@ -224,9 +224,7 @@ void ConvolverHandler::setChannelCountMode(const String& mode, ...@@ -224,9 +224,7 @@ void ConvolverHandler::setChannelCountMode(const String& mode,
void ConvolverHandler::checkNumberOfChannelsForInput(AudioNodeInput* input) { void ConvolverHandler::checkNumberOfChannelsForInput(AudioNodeInput* input) {
DCHECK(context()->isAudioThread()); DCHECK(context()->isAudioThread());
#if DCHECK_IS_ON()
DCHECK(context()->isGraphOwner()); DCHECK(context()->isGraphOwner());
#endif
DCHECK(input); DCHECK(input);
DCHECK_EQ(input, &this->input(0)); DCHECK_EQ(input, &this->input(0));
......
...@@ -65,11 +65,15 @@ void DeferredTaskHandler::offlineLock() { ...@@ -65,11 +65,15 @@ void DeferredTaskHandler::offlineLock() {
m_contextGraphMutex.lock(); m_contextGraphMutex.lock();
} }
#if DCHECK_IS_ON()
bool DeferredTaskHandler::isGraphOwner() { bool DeferredTaskHandler::isGraphOwner() {
#if DCHECK_IS_ON()
return m_contextGraphMutex.locked(); return m_contextGraphMutex.locked();
} #else
// The method is only used inside of DCHECK() so it must be no-op in the
// release build. Returning false so we can catch when it happens.
return false;
#endif #endif
}
void DeferredTaskHandler::addDeferredBreakConnection(AudioHandler& node) { void DeferredTaskHandler::addDeferredBreakConnection(AudioHandler& node) {
DCHECK(isAudioThread()); DCHECK(isAudioThread());
......
...@@ -128,10 +128,8 @@ class MODULES_EXPORT DeferredTaskHandler final ...@@ -128,10 +128,8 @@ class MODULES_EXPORT DeferredTaskHandler final
// MUST NOT be used in the real-time audio context. // MUST NOT be used in the real-time audio context.
void offlineLock(); void offlineLock();
#if DCHECK_IS_ON()
// Returns true if this thread owns the context's lock. // Returns true if this thread owns the context's lock.
bool isGraphOwner(); bool isGraphOwner();
#endif
class MODULES_EXPORT AutoLocker { class MODULES_EXPORT AutoLocker {
STACK_ALLOCATED(); STACK_ALLOCATED();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment