mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 671282 - Replace nsDebugAutoBoolTrueSetter in docshell and AutoBoolSetter in SMIL with AutoRestore; r=bz
This commit is contained in:
parent
d27c027671
commit
1e063d88b5
@ -38,32 +38,7 @@
|
|||||||
#include "nsSMILInstanceTime.h"
|
#include "nsSMILInstanceTime.h"
|
||||||
#include "nsSMILInterval.h"
|
#include "nsSMILInterval.h"
|
||||||
#include "nsSMILTimeValueSpec.h"
|
#include "nsSMILTimeValueSpec.h"
|
||||||
|
#include "mozilla/AutoRestore.h"
|
||||||
//----------------------------------------------------------------------
|
|
||||||
// Helper classes
|
|
||||||
|
|
||||||
namespace
|
|
||||||
{
|
|
||||||
// Utility class to set a PRPackedBool value to PR_TRUE whilst it is in scope.
|
|
||||||
// Saves us having to remember to clear the flag at every possible return.
|
|
||||||
class AutoBoolSetter
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
AutoBoolSetter(PRPackedBool& aValue)
|
|
||||||
: mValue(aValue)
|
|
||||||
{
|
|
||||||
mValue = PR_TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
~AutoBoolSetter()
|
|
||||||
{
|
|
||||||
mValue = PR_FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
|
||||||
PRPackedBool& mValue;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
// Implementation
|
// Implementation
|
||||||
@ -146,7 +121,8 @@ nsSMILInstanceTime::HandleChangedInterval(
|
|||||||
PRBool objectChanged = mCreator->DependsOnBegin() ? aBeginObjectChanged :
|
PRBool objectChanged = mCreator->DependsOnBegin() ? aBeginObjectChanged :
|
||||||
aEndObjectChanged;
|
aEndObjectChanged;
|
||||||
|
|
||||||
AutoBoolSetter setVisited(mVisited);
|
mozilla::AutoRestore<PRPackedBool> setVisited(mVisited);
|
||||||
|
mVisited = PR_TRUE;
|
||||||
|
|
||||||
nsRefPtr<nsSMILInstanceTime> deathGrip(this);
|
nsRefPtr<nsSMILInstanceTime> deathGrip(this);
|
||||||
mCreator->HandleChangedInstanceTime(*GetBaseTime(), aSrcContainer, *this,
|
mCreator->HandleChangedInstanceTime(*GetBaseTime(), aSrcContainer, *this,
|
||||||
@ -224,7 +200,8 @@ nsSMILInstanceTime::IsDependentOn(const nsSMILInstanceTime& aOther) const
|
|||||||
return PR_TRUE;
|
return PR_TRUE;
|
||||||
|
|
||||||
// mVisited is mutable
|
// mVisited is mutable
|
||||||
AutoBoolSetter setVisited(const_cast<nsSMILInstanceTime*>(this)->mVisited);
|
mozilla::AutoRestore<PRPackedBool> setVisited(const_cast<nsSMILInstanceTime*>(this)->mVisited);
|
||||||
|
const_cast<nsSMILInstanceTime*>(this)->mVisited = PR_TRUE;
|
||||||
return myBaseTime->IsDependentOn(aOther);
|
return myBaseTime->IsDependentOn(aOther);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -110,6 +110,7 @@
|
|||||||
#include "mozilla/Services.h"
|
#include "mozilla/Services.h"
|
||||||
#include "mozilla/Preferences.h"
|
#include "mozilla/Preferences.h"
|
||||||
#include "mozilla/Telemetry.h"
|
#include "mozilla/Telemetry.h"
|
||||||
|
#include "mozilla/AutoRestore.h"
|
||||||
|
|
||||||
// we want to explore making the document own the load group
|
// we want to explore making the document own the load group
|
||||||
// so we can associate the document URI with the load group.
|
// so we can associate the document URI with the load group.
|
||||||
@ -10877,25 +10878,6 @@ nsDocShell::GetRootScrollFrame()
|
|||||||
return shell->GetRootScrollFrameAsScrollableExternal();
|
return shell->GetRootScrollFrameAsScrollableExternal();
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef DEBUG
|
|
||||||
class nsDebugAutoBoolTrueSetter
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
nsDebugAutoBoolTrueSetter(PRPackedBool *aBool)
|
|
||||||
: mBool(aBool)
|
|
||||||
{
|
|
||||||
*mBool = PR_TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
~nsDebugAutoBoolTrueSetter()
|
|
||||||
{
|
|
||||||
*mBool = PR_FALSE;
|
|
||||||
}
|
|
||||||
protected:
|
|
||||||
PRPackedBool *mBool;
|
|
||||||
};
|
|
||||||
#endif
|
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsDocShell::EnsureScriptEnvironment()
|
nsDocShell::EnsureScriptEnvironment()
|
||||||
{
|
{
|
||||||
@ -10915,7 +10897,8 @@ nsDocShell::EnsureScriptEnvironment()
|
|||||||
|
|
||||||
// Yeah, this isn't re-entrant safe, but that's ok since if we
|
// Yeah, this isn't re-entrant safe, but that's ok since if we
|
||||||
// re-enter this method, we'll infinitely loop...
|
// re-enter this method, we'll infinitely loop...
|
||||||
nsDebugAutoBoolTrueSetter boolSetter(&mInEnsureScriptEnv);
|
AutoRestore<PRPackedBool> boolSetter(mInEnsureScriptEnv);
|
||||||
|
mInEnsureScriptEnv = PR_TRUE;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
nsCOMPtr<nsIDOMScriptObjectFactory> factory =
|
nsCOMPtr<nsIDOMScriptObjectFactory> factory =
|
||||||
|
Loading…
Reference in New Issue
Block a user