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,
}
void AnalyserHandler::updatePullStatus() {
#if DCHECK_IS_ON()
DCHECK(context()->isGraphOwner());
#endif
if (output(0).isConnected()) {
// When an AudioBasicInspectorNode is connected to a downstream node, it
......
......@@ -290,10 +290,10 @@ class MODULES_EXPORT BaseAudioContext
void lock() { deferredTaskHandler().lock(); }
bool tryLock() { return deferredTaskHandler().tryLock(); }
void unlock() { deferredTaskHandler().unlock(); }
#if DCHECK_IS_ON()
// Returns true if this thread owns the context's lock.
bool isGraphOwner() { return deferredTaskHandler().isGraphOwner(); }
#endif
using AutoLocker = DeferredTaskHandler::AutoLocker;
// Returns the maximum numuber of channels we can support.
......
......@@ -224,9 +224,7 @@ void ConvolverHandler::setChannelCountMode(const String& mode,
void ConvolverHandler::checkNumberOfChannelsForInput(AudioNodeInput* input) {
DCHECK(context()->isAudioThread());
#if DCHECK_IS_ON()
DCHECK(context()->isGraphOwner());
#endif
DCHECK(input);
DCHECK_EQ(input, &this->input(0));
......
......@@ -65,11 +65,15 @@ void DeferredTaskHandler::offlineLock() {
m_contextGraphMutex.lock();
}
#if DCHECK_IS_ON()
bool DeferredTaskHandler::isGraphOwner() {
#if DCHECK_IS_ON()
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
}
void DeferredTaskHandler::addDeferredBreakConnection(AudioHandler& node) {
DCHECK(isAudioThread());
......
......@@ -128,10 +128,8 @@ class MODULES_EXPORT DeferredTaskHandler final
// MUST NOT be used in the real-time audio context.
void offlineLock();
#if DCHECK_IS_ON()
// Returns true if this thread owns the context's lock.
bool isGraphOwner();
#endif
class MODULES_EXPORT AutoLocker {
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