Merge from mozilla-central to mozilla-inbound - DONTBUILD (no actual diffs from 7134aa74087d)

This commit is contained in:
Matt Brubeck 2011-09-29 22:08:14 -07:00
commit 8e44d827ce
50 changed files with 743 additions and 651 deletions

View File

@ -180,13 +180,16 @@ HTMLLabelIterator::Next()
nsAccessible* walkUp = mAcc->Parent();
while (walkUp && !walkUp->IsDoc()) {
nsIContent* walkUpElm = walkUp->GetContent();
if (walkUpElm->Tag() == nsGkAtoms::label) {
if (walkUpElm->IsHTML()) {
if (walkUpElm->Tag() == nsGkAtoms::label &&
!walkUpElm->HasAttr(kNameSpaceID_None, nsGkAtoms::_for)) {
mLabelFilter = eSkipAncestorLabel; // prevent infinite loop
return walkUp;
}
if (walkUpElm->Tag() == nsGkAtoms::form)
break;
}
walkUp = walkUp->Parent();
}

View File

@ -49,6 +49,18 @@ namespace statistics {
inline void A11yInitialized()
{ Telemetry::Accumulate(Telemetry::A11Y_INSTANTIATED, true); }
/**
* Report that ISimpleDOM* has been used.
*/
inline void ISimpleDOMUsed()
{ Telemetry::Accumulate(Telemetry::ISIMPLE_DOM_USAGE, 1); }
/**
* Report that IAccessibleTable has been used.
*/
inline void IAccessibleTableUsed()
{ Telemetry::Accumulate(Telemetry::IACCESSIBLE_TABLE_USAGE, 1); }
} // namespace statistics
} // namespace a11y
} // namespace mozilla

View File

@ -49,10 +49,13 @@
#include "nsIWinAccessNode.h"
#include "nsAccessNodeWrap.h"
#include "nsWinUtils.h"
#include "Statistics.h"
#include "nsCOMPtr.h"
#include "nsString.h"
using namespace mozilla::a11y;
#define CANT_QUERY_ASSERTION_MSG \
"Subclass of CAccessibleTable doesn't implement nsIAccessibleTable"\
@ -64,6 +67,7 @@ CAccessibleTable::QueryInterface(REFIID iid, void** ppv)
*ppv = NULL;
if (IID_IAccessibleTable == iid) {
statistics::IAccessibleTableUsed();
*ppv = static_cast<IAccessibleTable*>(this);
(reinterpret_cast<IUnknown*>(*ppv))->AddRef();
return S_OK;

View File

@ -46,6 +46,7 @@
#include "nsCoreUtils.h"
#include "nsRootAccessible.h"
#include "nsWinUtils.h"
#include "Statistics.h"
#include "nsAttrName.h"
#include "nsIDocument.h"
@ -59,6 +60,7 @@
#include "mozilla/Preferences.h"
using namespace mozilla;
using namespace mozilla::a11y;
/// the accessible library and cached methods
HINSTANCE nsAccessNodeWrap::gmAccLib = nsnull;
@ -120,11 +122,14 @@ STDMETHODIMP nsAccessNodeWrap::QueryInterface(REFIID iid, void** ppv)
{
*ppv = nsnull;
if (IID_IUnknown == iid || IID_ISimpleDOMNode == iid)
if (IID_IUnknown == iid) {
*ppv = static_cast<ISimpleDOMNode*>(this);
if (nsnull == *ppv)
} else if (IID_ISimpleDOMNode == iid) {
statistics::ISimpleDOMUsed();
*ppv = static_cast<ISimpleDOMNode*>(this);
} else {
return E_NOINTERFACE; //iid not supported.
}
(reinterpret_cast<IUnknown*>(*ppv))->AddRef();
return S_OK;

View File

@ -43,6 +43,7 @@
#include "nsIAccessibilityService.h"
#include "nsRootAccessible.h"
#include "nsWinUtils.h"
#include "Statistics.h"
#include "nsIDocShell.h"
#include "nsIDocShellTreeNode.h"
@ -54,6 +55,8 @@
#include "nsIViewManager.h"
#include "nsIWebNavigation.h"
using namespace mozilla::a11y;
/* For documentation of the accessibility architecture,
* see http://lxr.mozilla.org/seamonkey/source/accessible/accessible-docs.html
*/
@ -91,12 +94,11 @@ STDMETHODIMP nsDocAccessibleWrap::QueryInterface(REFIID iid, void** ppv)
{
*ppv = NULL;
if (IID_ISimpleDOMDocument == iid)
*ppv = static_cast<ISimpleDOMDocument*>(this);
if (NULL == *ppv)
if (IID_ISimpleDOMDocument != iid)
return nsHyperTextAccessibleWrap::QueryInterface(iid, ppv);
statistics::ISimpleDOMUsed();
*ppv = static_cast<ISimpleDOMDocument*>(this);
(reinterpret_cast<IUnknown*>(*ppv))->AddRef();
return S_OK;
}

View File

@ -41,6 +41,7 @@
#include "nsCoreUtils.h"
#include "nsDocAccessible.h"
#include "Statistics.h"
#include "nsIFrame.h"
#include "nsFontMetrics.h"
#include "nsPresContext.h"
@ -48,6 +49,8 @@
#include "gfxFont.h"
using namespace mozilla::a11y;
////////////////////////////////////////////////////////////////////////////////
// nsTextAccessibleWrap Accessible
////////////////////////////////////////////////////////////////////////////////
@ -72,11 +75,14 @@ STDMETHODIMP nsTextAccessibleWrap::QueryInterface(REFIID iid, void** ppv)
{
*ppv = nsnull;
if (IID_IUnknown == iid || IID_ISimpleDOMText == iid)
if (IID_IUnknown == iid) {
*ppv = static_cast<ISimpleDOMText*>(this);
if (nsnull == *ppv)
} else if (IID_ISimpleDOMText == iid) {
statistics::ISimpleDOMUsed();
*ppv = static_cast<ISimpleDOMText*>(this);
} else {
return nsAccessibleWrap::QueryInterface(iid, ppv);
}
(reinterpret_cast<IUnknown*>(*ppv))->AddRef();
return S_OK;

View File

@ -170,11 +170,13 @@
testName("combo4", "Subscribe to ATOM feed.");
testName("comboinmiddle2", "Play the Haliluya sound when new mail arrives");
testName("combo5", "Play the Haliluya sound when new mail arrives");
testName("combo5", null); // label isn't used as a name for control
testName("checkbox", "Play the Haliluya sound when new mail arrives");
testName("comboinmiddle3", "Play the Haliluya sound when new mail arrives");
testName("combo6", "Play the Haliluya sound when new mail arrives");
testName("comboinend", "This day was sunny");
testName("combo6", "This day was");
testName("combo7", "This day was");
testName("textboxinend", "This day was sunny");
testName("textbox2", "This day was");
@ -213,6 +215,11 @@
title="Use placeholder as name if name is otherwise empty">
Mozilla Bug 604391
</a>
<a target="_blank"
href="https://bugzilla.mozilla.org/show_bug.cgi?id=669312"
title="Accessible name is duplicated when input has a label associated uisng for/id and is wrapped around the input">
Mozilla Bug 669312
</a>
<p id="display"></p>
<div id="content" style="display: none"></div>
<pre id="test">
@ -437,10 +444,18 @@
</label>
<input id="checkbox" type="checkbox" />
<label id="comboinmiddle3" for="combo6">Play the
<select id="combo6">
<option>Haliluya</option>
<option>Hurra</option>
</select>
sound when new mail arrives
</label>
<!-- at the end (without and with whitespaces) -->
<label id="comboinend">
This day was
<select id="combo6" name="occupation">
<select id="combo7" name="occupation">
<option>sunny</option>
<option>rainy</option>
</select></label>

View File

@ -41,6 +41,10 @@
testRelation("control1_11", RELATION_LABELLED_BY, "label1_11");
testRelation("control1_12", RELATION_LABELLED_BY, "label1_12");
testRelation("label1_13", RELATION_LABEL_FOR, null);
testRelation("control1_13", RELATION_LABELLED_BY, null);
testRelation("control1_14", RELATION_LABELLED_BY, "label1_14");
// aria-labelledby
testRelation("label2", RELATION_LABEL_FOR, "checkbox2");
testRelation("checkbox2", RELATION_LABELLED_BY, "label2");
@ -157,6 +161,11 @@
title="make HTML <output> accessible">
Mozilla Bug 558036
</a>
<a target="_blank"
href="https://bugzilla.mozilla.org/show_bug.cgi?id=682790"
title="Ignore implicit label association when it's associated explicitly">
Mozilla Bug 682790
</a>
<a target="_blank"
href="https://bugzilla.mozilla.org/show_bug.cgi?id=687393"
title="HTML select options gets relation from containing label">
@ -204,6 +213,13 @@
<progress id="control1_12"></progress>
</label>
<label id="label1_13" for="">Label
<input id="control1_13">
</label>
<label id="label1_14" for="control1_14">Label
<input id="control1_14">
</label>
<span id="label2">label</span>
<span role="checkbox" id="checkbox2" aria-labelledby="label2"></span>

View File

@ -323,7 +323,7 @@ public:
already_AddRefed<nsILoadGroup> GetDocumentLoadGroup();
/**
* Returns PR_TRUE if the media has played or completed a seek.
* Returns true if the media has played or completed a seek.
* Used by video frame to determine whether to paint the poster.
*/
bool GetPlayedOrSeeked() const { return mHasPlayedOrSeeked; }
@ -343,7 +343,7 @@ public:
void SetRequestHeaders(nsIHttpChannel* aChannel);
/**
* Fires a timeupdate event. If aPeriodic is PR_TRUE, the event will only
* Fires a timeupdate event. If aPeriodic is true, the event will only
* be fired if we've not fired a timeupdate event (for any reason) in the
* last 250ms, as required by the spec when the current time is periodically
* increasing during playback.
@ -639,7 +639,7 @@ protected:
// An audio stream for writing audio directly from JS.
nsRefPtr<nsAudioStream> mAudioStream;
// PR_TRUE if MozAudioAvailable events can be safely dispatched, based on
// True if MozAudioAvailable events can be safely dispatched, based on
// a media and element same-origin check.
bool mAllowAudioData;
@ -679,57 +679,57 @@ protected:
// to raise the 'waiting' event as per 4.7.1.8 in HTML 5 specification.
bool mPlayingBeforeSeek;
// PR_TRUE iff this element is paused because the document is inactive
// True iff this element is paused because the document is inactive
bool mPausedForInactiveDocument;
// PR_TRUE if we've reported a "waiting" event since the last
// True if we've reported a "waiting" event since the last
// readyState change to HAVE_CURRENT_DATA.
bool mWaitingFired;
// PR_TRUE if we're running the "load()" method.
// True if we're running the "load()" method.
bool mIsRunningLoadMethod;
// PR_TRUE if we're loading the resource from the child source elements.
// True if we're loading the resource from the child source elements.
bool mIsLoadingFromSourceChildren;
// PR_TRUE if we're delaying the "load" event. They are delayed until either
// True if we're delaying the "load" event. They are delayed until either
// an error occurs, or the first frame is loaded.
bool mDelayingLoadEvent;
// PR_TRUE when we've got a task queued to call SelectResource(),
// True when we've got a task queued to call SelectResource(),
// or while we're running SelectResource().
bool mIsRunningSelectResource;
// PR_TRUE if we suspended the decoder because we were paused,
// True if we suspended the decoder because we were paused,
// preloading metadata is enabled, autoplay was not enabled, and we loaded
// the first frame.
bool mSuspendedAfterFirstFrame;
// PR_TRUE if we are allowed to suspend the decoder because we were paused,
// True if we are allowed to suspend the decoder because we were paused,
// preloading metdata was enabled, autoplay was not enabled, and we loaded
// the first frame.
bool mAllowSuspendAfterFirstFrame;
// PR_TRUE if we've played or completed a seek. We use this to determine
// True if we've played or completed a seek. We use this to determine
// when the poster frame should be shown.
bool mHasPlayedOrSeeked;
// PR_TRUE if we've added a reference to ourselves to keep the element
// True if we've added a reference to ourselves to keep the element
// alive while no-one is referencing it but the element may still fire
// events of its own accord.
bool mHasSelfReference;
// PR_TRUE if we've received a notification that the engine is shutting
// True if we've received a notification that the engine is shutting
// down.
bool mShuttingDown;
// PR_TRUE if we've suspended a load in the resource selection algorithm
// due to loading a preload:none media. When PR_TRUE, the resource we'll
// True if we've suspended a load in the resource selection algorithm
// due to loading a preload:none media. When true, the resource we'll
// load when the user initiates either playback or an explicit load is
// stored in mPreloadURI.
bool mLoadIsSuspended;
// PR_TRUE if a same-origin check has been done for the media element and resource.
// True if a same-origin check has been done for the media element and resource.
bool mMediaSecurityVerified;
};

View File

@ -125,7 +125,7 @@ nsHTMLAudioElement::Initialize(nsISupports* aOwner, JSContext* aContext,
// 'preload' set to 'auto' (since the script must intend to
// play the audio)
nsresult rv = SetAttr(kNameSpaceID_None, nsGkAtoms::preload,
NS_LITERAL_STRING("auto"), PR_TRUE);
NS_LITERAL_STRING("auto"), true);
if (NS_FAILED(rv))
return rv;
@ -143,7 +143,7 @@ nsHTMLAudioElement::Initialize(nsISupports* aOwner, JSContext* aContext,
if (!str.init(aContext, jsstr))
return NS_ERROR_FAILURE;
rv = SetAttr(kNameSpaceID_None, nsGkAtoms::src, str, PR_TRUE);
rv = SetAttr(kNameSpaceID_None, nsGkAtoms::src, str, true);
if (NS_FAILED(rv))
return rv;
@ -267,5 +267,5 @@ nsresult nsHTMLAudioElement::SetAcceptHeader(nsIHttpChannel* aChannel)
return aChannel->SetRequestHeader(NS_LITERAL_CSTRING("Accept"),
value,
PR_FALSE);
false);
}

View File

@ -227,8 +227,8 @@ public:
return nsContentUtils::DispatchTrustedEvent(mElement->GetOwnerDoc(),
mSource,
NS_LITERAL_STRING("error"),
PR_FALSE,
PR_TRUE);
false,
true);
}
};
@ -416,7 +416,7 @@ NS_IMETHODIMP nsHTMLMediaElement::GetError(nsIDOMMediaError * *aError)
/* readonly attribute boolean ended; */
NS_IMETHODIMP nsHTMLMediaElement::GetEnded(bool *aEnded)
{
*aEnded = mDecoder ? mDecoder->IsEnded() : PR_FALSE;
*aEnded = mDecoder ? mDecoder->IsEnded() : false;
return NS_OK;
}
@ -460,7 +460,7 @@ nsHTMLMediaElement::OnChannelRedirect(nsIChannel *aChannel,
http = do_QueryInterface(aNewChannel);
NS_ENSURE_STATE(http);
nsresult rv = http->SetRequestHeader(rangeHdr, rangeVal, PR_FALSE);
nsresult rv = http->SetRequestHeader(rangeHdr, rangeVal, false);
NS_ENSURE_SUCCESS(rv, rv);
}
@ -490,11 +490,11 @@ void nsHTMLMediaElement::AbortExistingLoads()
}
mError = nsnull;
mLoadedFirstFrame = PR_FALSE;
mAutoplaying = PR_TRUE;
mIsLoadingFromSourceChildren = PR_FALSE;
mSuspendedAfterFirstFrame = PR_FALSE;
mAllowSuspendAfterFirstFrame = PR_TRUE;
mLoadedFirstFrame = false;
mAutoplaying = true;
mIsLoadingFromSourceChildren = false;
mSuspendedAfterFirstFrame = false;
mAllowSuspendAfterFirstFrame = true;
mSourcePointer = nsnull;
// TODO: The playback rate must be set to the default playback rate.
@ -502,14 +502,14 @@ void nsHTMLMediaElement::AbortExistingLoads()
if (mNetworkState != nsIDOMHTMLMediaElement::NETWORK_EMPTY) {
mNetworkState = nsIDOMHTMLMediaElement::NETWORK_EMPTY;
ChangeReadyState(nsIDOMHTMLMediaElement::HAVE_NOTHING);
mPaused = PR_TRUE;
mPaused = true;
if (fireTimeUpdate) {
// Since we destroyed the decoder above, the current playback position
// will now be reported as 0. The playback position was non-zero when
// we destroyed the decoder, so fire a timeupdate event so that the
// change will be reflected in the controls.
FireTimeUpdate(PR_FALSE);
FireTimeUpdate(false);
}
DispatchEvent(NS_LITERAL_STRING("emptied"));
}
@ -518,7 +518,7 @@ void nsHTMLMediaElement::AbortExistingLoads()
// things which can affect AddRemoveSelfReference
AddRemoveSelfReference();
mIsRunningSelectResource = PR_FALSE;
mIsRunningSelectResource = false;
}
void nsHTMLMediaElement::NoSupportedMediaSourceError()
@ -529,7 +529,7 @@ void nsHTMLMediaElement::NoSupportedMediaSourceError()
mNetworkState = nsIDOMHTMLMediaElement::NETWORK_NO_SOURCE;
DispatchAsyncEvent(NS_LITERAL_STRING("error"));
// This clears mDelayingLoadEvent, so AddRemoveSelfReference will be called
ChangeDelayLoadStatus(PR_FALSE);
ChangeDelayLoadStatus(false);
}
typedef void (nsHTMLMediaElement::*SyncSectionFn)();
@ -573,7 +573,7 @@ void AsyncAwaitStableState(nsHTMLMediaElement* aElement,
void nsHTMLMediaElement::QueueLoadFromSourceTask()
{
ChangeDelayLoadStatus(PR_TRUE);
ChangeDelayLoadStatus(true);
mNetworkState = nsIDOMHTMLMediaElement::NETWORK_LOADING;
AsyncAwaitStableState(this, &nsHTMLMediaElement::LoadFromSourceChildren);
}
@ -583,7 +583,7 @@ void nsHTMLMediaElement::QueueSelectResourceTask()
// Don't allow multiple async select resource calls to be queued.
if (mIsRunningSelectResource)
return;
mIsRunningSelectResource = PR_TRUE;
mIsRunningSelectResource = true;
mNetworkState = nsIDOMHTMLMediaElement::NETWORK_NO_SOURCE;
AsyncAwaitStableState(this, &nsHTMLMediaElement::SelectResource);
}
@ -593,11 +593,11 @@ NS_IMETHODIMP nsHTMLMediaElement::Load()
{
if (mIsRunningLoadMethod)
return NS_OK;
SetPlayedOrSeeked(PR_FALSE);
mIsRunningLoadMethod = PR_TRUE;
SetPlayedOrSeeked(false);
mIsRunningLoadMethod = true;
AbortExistingLoads();
QueueSelectResourceTask();
mIsRunningLoadMethod = PR_FALSE;
mIsRunningLoadMethod = false;
return NS_OK;
}
@ -608,10 +608,10 @@ static bool HasSourceChildren(nsIContent *aElement)
child = child->GetNextSibling()) {
if (child->IsHTML(nsGkAtoms::source))
{
return PR_TRUE;
return true;
}
}
return PR_FALSE;
return false;
}
void nsHTMLMediaElement::SelectResource()
@ -621,12 +621,12 @@ void nsHTMLMediaElement::SelectResource()
// element children, abort the load.
mNetworkState = nsIDOMHTMLMediaElement::NETWORK_EMPTY;
// This clears mDelayingLoadEvent, so AddRemoveSelfReference will be called
ChangeDelayLoadStatus(PR_FALSE);
mIsRunningSelectResource = PR_FALSE;
ChangeDelayLoadStatus(false);
mIsRunningSelectResource = false;
return;
}
ChangeDelayLoadStatus(PR_TRUE);
ChangeDelayLoadStatus(true);
mNetworkState = nsIDOMHTMLMediaElement::NETWORK_LOADING;
// Load event was delayed, and still is, so no need to call
@ -648,23 +648,23 @@ void nsHTMLMediaElement::SelectResource()
// preload:none media, suspend the load here before we make any
// network requests.
SuspendLoad(uri);
mIsRunningSelectResource = PR_FALSE;
mIsRunningSelectResource = false;
return;
}
rv = LoadResource(uri);
if (NS_SUCCEEDED(rv)) {
mIsRunningSelectResource = PR_FALSE;
mIsRunningSelectResource = false;
return;
}
}
NoSupportedMediaSourceError();
} else {
// Otherwise, the source elements will be used.
mIsLoadingFromSourceChildren = PR_TRUE;
mIsLoadingFromSourceChildren = true;
LoadFromSourceChildren();
}
mIsRunningSelectResource = PR_FALSE;
mIsRunningSelectResource = false;
}
void nsHTMLMediaElement::NotifyLoadError()
@ -694,7 +694,7 @@ void nsHTMLMediaElement::NotifyAudioAvailable(float* aFrameBuffer,
nsCOMPtr<nsIPrincipal> principal = GetCurrentPrincipal();
nsresult rv = NodePrincipal()->Subsumes(principal, &mAllowAudioData);
if (NS_FAILED(rv)) {
mAllowAudioData = PR_FALSE;
mAllowAudioData = false;
}
}
@ -708,12 +708,12 @@ bool nsHTMLMediaElement::MayHaveAudioAvailableEventListener()
// |var a = new Audio()| with no parent document.
nsIDocument *document = GetDocument();
if (!document) {
return PR_TRUE;
return true;
}
nsPIDOMWindow *window = document->GetInnerWindow();
if (!window) {
return PR_TRUE;
return true;
}
return window->HasAudioAvailableEventListeners();
@ -725,7 +725,7 @@ void nsHTMLMediaElement::LoadFromSourceChildren()
"Should delay load event (if in document) during load");
NS_ASSERTION(mIsLoadingFromSourceChildren,
"Must remember we're loading from source children");
while (PR_TRUE) {
while (true) {
nsresult rv;
nsIContent* child = GetNextSource();
if (!child) {
@ -733,7 +733,7 @@ void nsHTMLMediaElement::LoadFromSourceChildren()
// the media element.
mLoadWaitStatus = WAITING_FOR_SOURCE;
mNetworkState = nsIDOMHTMLMediaElement::NETWORK_NO_SOURCE;
ChangeDelayLoadStatus(PR_FALSE);
ChangeDelayLoadStatus(false);
return;
}
@ -785,19 +785,19 @@ void nsHTMLMediaElement::LoadFromSourceChildren()
void nsHTMLMediaElement::SuspendLoad(nsIURI* aURI)
{
mLoadIsSuspended = PR_TRUE;
mLoadIsSuspended = true;
mNetworkState = nsIDOMHTMLMediaElement::NETWORK_IDLE;
DispatchAsyncEvent(NS_LITERAL_STRING("suspend"));
ChangeDelayLoadStatus(PR_FALSE);
ChangeDelayLoadStatus(false);
}
void nsHTMLMediaElement::ResumeLoad(PreloadAction aAction)
{
NS_ASSERTION(mLoadIsSuspended, "Can only resume preload if halted for one");
nsCOMPtr<nsIURI> uri = mLoadingSrc;
mLoadIsSuspended = PR_FALSE;
mLoadIsSuspended = false;
mPreloadAction = aAction;
ChangeDelayLoadStatus(PR_TRUE);
ChangeDelayLoadStatus(true);
mNetworkState = nsIDOMHTMLMediaElement::NETWORK_LOADING;
if (!mIsLoadingFromSourceChildren) {
// We were loading from the element's src attribute.
@ -881,7 +881,7 @@ void nsHTMLMediaElement::UpdatePreloadAction()
} else if (nextAction == nsHTMLMediaElement::PRELOAD_METADATA) {
// Ensure that the video can be suspended after first frame.
mAllowSuspendAfterFirstFrame = PR_TRUE;
mAllowSuspendAfterFirstFrame = true;
if (mLoadIsSuspended) {
// Our load was previouly suspended due to the media having preload
// value "none". The preload value has changed to preload:metadata, so
@ -964,7 +964,7 @@ nsresult nsHTMLMediaElement::LoadResource(nsIURI* aURI)
new nsCORSListenerProxy(loadListener,
NodePrincipal(),
channel,
PR_FALSE,
false,
&rv);
} else {
rv = nsContentUtils::GetSecurityManager()->
@ -982,7 +982,7 @@ nsresult nsHTMLMediaElement::LoadResource(nsIURI* aURI)
// requests, and therefore seeking, early.
hc->SetRequestHeader(NS_LITERAL_CSTRING("Range"),
NS_LITERAL_CSTRING("bytes=0-"),
PR_FALSE);
false);
SetRequestHeaders(hc);
}
@ -1011,11 +1011,11 @@ nsresult nsHTMLMediaElement::LoadWithChannel(nsIChannel *aChannel,
AbortExistingLoads();
ChangeDelayLoadStatus(PR_TRUE);
ChangeDelayLoadStatus(true);
nsresult rv = InitializeDecoderForChannel(aChannel, aListener);
if (NS_FAILED(rv)) {
ChangeDelayLoadStatus(PR_FALSE);
ChangeDelayLoadStatus(false);
return rv;
}
@ -1035,11 +1035,11 @@ NS_IMETHODIMP nsHTMLMediaElement::MozLoadFrom(nsIDOMHTMLMediaElement* aOther)
if (!other || !other->mDecoder)
return NS_OK;
ChangeDelayLoadStatus(PR_TRUE);
ChangeDelayLoadStatus(true);
nsresult rv = InitializeDecoderAsClone(other->mDecoder);
if (NS_FAILED(rv)) {
ChangeDelayLoadStatus(PR_FALSE);
ChangeDelayLoadStatus(false);
return rv;
}
@ -1150,13 +1150,13 @@ NS_IMETHODIMP nsHTMLMediaElement::Pause()
}
bool oldPaused = mPaused;
mPaused = PR_TRUE;
mAutoplaying = PR_FALSE;
mPaused = true;
mAutoplaying = false;
// We changed mPaused and mAutoplaying which can affect AddRemoveSelfReference
AddRemoveSelfReference();
if (!oldPaused) {
FireTimeUpdate(PR_FALSE);
FireTimeUpdate(false);
DispatchAsyncEvent(NS_LITERAL_STRING("pause"));
}
@ -1276,27 +1276,27 @@ nsHTMLMediaElement::nsHTMLMediaElement(already_AddRefed<nsINodeInfo> aNodeInfo)
mLastCurrentTime(0.0),
mFragmentStart(-1.0),
mFragmentEnd(-1.0),
mAllowAudioData(PR_FALSE),
mBegun(PR_FALSE),
mLoadedFirstFrame(PR_FALSE),
mAutoplaying(PR_TRUE),
mAutoplayEnabled(PR_TRUE),
mPaused(PR_TRUE),
mMuted(PR_FALSE),
mPlayingBeforeSeek(PR_FALSE),
mPausedForInactiveDocument(PR_FALSE),
mWaitingFired(PR_FALSE),
mIsRunningLoadMethod(PR_FALSE),
mIsLoadingFromSourceChildren(PR_FALSE),
mDelayingLoadEvent(PR_FALSE),
mIsRunningSelectResource(PR_FALSE),
mSuspendedAfterFirstFrame(PR_FALSE),
mAllowSuspendAfterFirstFrame(PR_TRUE),
mHasPlayedOrSeeked(PR_FALSE),
mHasSelfReference(PR_FALSE),
mShuttingDown(PR_FALSE),
mLoadIsSuspended(PR_FALSE),
mMediaSecurityVerified(PR_FALSE)
mAllowAudioData(false),
mBegun(false),
mLoadedFirstFrame(false),
mAutoplaying(true),
mAutoplayEnabled(true),
mPaused(true),
mMuted(false),
mPlayingBeforeSeek(false),
mPausedForInactiveDocument(false),
mWaitingFired(false),
mIsRunningLoadMethod(false),
mIsLoadingFromSourceChildren(false),
mDelayingLoadEvent(false),
mIsRunningSelectResource(false),
mSuspendedAfterFirstFrame(false),
mAllowSuspendAfterFirstFrame(true),
mHasPlayedOrSeeked(false),
mHasSelfReference(false),
mShuttingDown(false),
mLoadIsSuspended(false),
mMediaSecurityVerified(false)
{
#ifdef PR_LOGGING
if (!gMediaElementLog) {
@ -1333,12 +1333,12 @@ nsHTMLMediaElement::~nsHTMLMediaElement()
void nsHTMLMediaElement::StopSuspendingAfterFirstFrame()
{
mAllowSuspendAfterFirstFrame = PR_FALSE;
mAllowSuspendAfterFirstFrame = false;
if (!mSuspendedAfterFirstFrame)
return;
mSuspendedAfterFirstFrame = PR_FALSE;
mSuspendedAfterFirstFrame = false;
if (mDecoder) {
mDecoder->Resume(PR_TRUE);
mDecoder->Resume(true);
}
}
@ -1360,7 +1360,7 @@ void nsHTMLMediaElement::SetPlayedOrSeeked(bool aValue)
NS_IMETHODIMP nsHTMLMediaElement::Play()
{
StopSuspendingAfterFirstFrame();
SetPlayedOrSeeked(PR_TRUE);
SetPlayedOrSeeked(true);
if (mNetworkState == nsIDOMHTMLMediaElement::NETWORK_EMPTY) {
nsresult rv = Load();
@ -1388,7 +1388,7 @@ NS_IMETHODIMP nsHTMLMediaElement::Play()
break;
case nsIDOMHTMLMediaElement::HAVE_METADATA:
case nsIDOMHTMLMediaElement::HAVE_CURRENT_DATA:
FireTimeUpdate(PR_FALSE);
FireTimeUpdate(false);
DispatchAsyncEvent(NS_LITERAL_STRING("waiting"));
break;
case nsIDOMHTMLMediaElement::HAVE_FUTURE_DATA:
@ -1398,8 +1398,8 @@ NS_IMETHODIMP nsHTMLMediaElement::Play()
}
}
mPaused = PR_FALSE;
mAutoplaying = PR_FALSE;
mPaused = false;
mAutoplaying = false;
// We changed mPaused and mAutoplaying which can affect AddRemoveSelfReference
// and our preload status.
AddRemoveSelfReference();
@ -1430,10 +1430,10 @@ bool nsHTMLMediaElement::ParseAttribute(PRInt32 aNamespaceID,
return aResult.ParseDoubleValue(aValue);
}
else if (ParseImageAttribute(aAttribute, aValue, aResult)) {
return PR_TRUE;
return true;
}
else if (aAttribute == nsGkAtoms::preload) {
return aResult.ParseEnumValue(aValue, kPreloadTable, PR_FALSE);
return aResult.ParseEnumValue(aValue, kPreloadTable, false);
}
}
@ -1535,12 +1535,12 @@ static bool IsRawEnabled()
static bool IsRawType(const nsACString& aType)
{
if (!IsRawEnabled())
return PR_FALSE;
return false;
for (PRUint32 i = 0; i < NS_ARRAY_LENGTH(gRawTypes); ++i) {
if (aType.EqualsASCII(gRawTypes[i]))
return PR_TRUE;
return true;
}
return PR_FALSE;
return false;
}
#endif
#ifdef MOZ_OGG
@ -1568,12 +1568,12 @@ bool
nsHTMLMediaElement::IsOggType(const nsACString& aType)
{
if (!IsOggEnabled())
return PR_FALSE;
return false;
for (PRUint32 i = 0; i < NS_ARRAY_LENGTH(gOggTypes); ++i) {
if (aType.EqualsASCII(gOggTypes[i]))
return PR_TRUE;
return true;
}
return PR_FALSE;
return false;
}
#endif
@ -1603,12 +1603,12 @@ bool
nsHTMLMediaElement::IsWaveType(const nsACString& aType)
{
if (!IsWaveEnabled())
return PR_FALSE;
return false;
for (PRUint32 i = 0; i < NS_ARRAY_LENGTH(gWaveTypes); ++i) {
if (aType.EqualsASCII(gWaveTypes[i]))
return PR_TRUE;
return true;
}
return PR_FALSE;
return false;
}
#endif
@ -1635,12 +1635,12 @@ bool
nsHTMLMediaElement::IsWebMType(const nsACString& aType)
{
if (!IsWebMEnabled())
return PR_FALSE;
return false;
for (PRUint32 i = 0; i < NS_ARRAY_LENGTH(gWebMTypes); ++i) {
if (aType.EqualsASCII(gWebMTypes[i]))
return PR_TRUE;
return true;
}
return PR_FALSE;
return false;
}
#endif
@ -1681,22 +1681,22 @@ bool nsHTMLMediaElement::ShouldHandleMediaType(const char* aMIMEType)
{
#ifdef MOZ_RAW
if (IsRawType(nsDependentCString(aMIMEType)))
return PR_TRUE;
return true;
#endif
#ifdef MOZ_OGG
if (IsOggType(nsDependentCString(aMIMEType)))
return PR_TRUE;
return true;
#endif
#ifdef MOZ_WEBM
if (IsWebMType(nsDependentCString(aMIMEType)))
return PR_TRUE;
return true;
#endif
// We should not return true for Wave types, since there are some
// Wave codecs actually in use in the wild that we don't support, and
// we should allow those to be handled by plugins or helper apps.
// Furthermore people can play Wave files on most platforms by other
// means.
return PR_FALSE;
return false;
}
static bool
@ -1704,9 +1704,9 @@ CodecListContains(char const *const * aCodecs, const nsAString& aCodec)
{
for (PRInt32 i = 0; aCodecs[i]; ++i) {
if (aCodec.EqualsASCII(aCodecs[i]))
return PR_TRUE;
return true;
}
return PR_FALSE;
return false;
}
/* static */
@ -1879,10 +1879,10 @@ nsresult nsHTMLMediaElement::FinishDecoderSetup(nsMediaDecoder* aDecoder)
mLoadingSrc = nsnull;
// Force a same-origin check before allowing events for this media resource.
mMediaSecurityVerified = PR_FALSE;
mMediaSecurityVerified = false;
// The new stream has not been suspended by us.
mPausedForInactiveDocument = PR_FALSE;
mPausedForInactiveDocument = false;
// But we may want to suspend it now.
// This will also do an AddRemoveSelfReference.
NotifyOwnerDocumentActivityChanged();
@ -1892,13 +1892,13 @@ nsresult nsHTMLMediaElement::FinishDecoderSetup(nsMediaDecoder* aDecoder)
mDecoder->SetVolume(mMuted ? 0.0 : mVolume);
if (!mPaused) {
SetPlayedOrSeeked(PR_TRUE);
SetPlayedOrSeeked(true);
if (!mPausedForInactiveDocument) {
rv = mDecoder->Play();
}
}
mBegun = PR_TRUE;
mBegun = true;
return rv;
}
@ -1977,7 +1977,7 @@ void nsHTMLMediaElement::FirstFrameLoaded(bool aResourceFullyLoaded)
ChangeReadyState(aResourceFullyLoaded ?
nsIDOMHTMLMediaElement::HAVE_ENOUGH_DATA :
nsIDOMHTMLMediaElement::HAVE_CURRENT_DATA);
ChangeDelayLoadStatus(PR_FALSE);
ChangeDelayLoadStatus(false);
NS_ASSERTION(!mSuspendedAfterFirstFrame, "Should not have already suspended");
@ -1985,14 +1985,14 @@ void nsHTMLMediaElement::FirstFrameLoaded(bool aResourceFullyLoaded)
!aResourceFullyLoaded &&
!HasAttr(kNameSpaceID_None, nsGkAtoms::autoplay) &&
mPreloadAction == nsHTMLMediaElement::PRELOAD_METADATA) {
mSuspendedAfterFirstFrame = PR_TRUE;
mSuspendedAfterFirstFrame = true;
mDecoder->Suspend();
}
}
void nsHTMLMediaElement::ResourceLoaded()
{
mBegun = PR_FALSE;
mBegun = false;
mNetworkState = nsIDOMHTMLMediaElement::NETWORK_IDLE;
AddRemoveSelfReference();
if (mReadyState >= nsIDOMHTMLMediaElement::HAVE_METADATA) {
@ -2040,7 +2040,7 @@ void nsHTMLMediaElement::Error(PRUint16 aErrorCode)
aErrorCode == nsIDOMMediaError::MEDIA_ERR_ABORTED,
"Only use nsIDOMMediaError codes!");
mError = new nsMediaError(aErrorCode);
mBegun = PR_FALSE;
mBegun = false;
DispatchAsyncEvent(NS_LITERAL_STRING("error"));
if (mReadyState == nsIDOMHTMLMediaElement::HAVE_NOTHING) {
mNetworkState = nsIDOMHTMLMediaElement::NETWORK_EMPTY;
@ -2049,7 +2049,7 @@ void nsHTMLMediaElement::Error(PRUint16 aErrorCode)
mNetworkState = nsIDOMHTMLMediaElement::NETWORK_IDLE;
}
AddRemoveSelfReference();
ChangeDelayLoadStatus(PR_FALSE);
ChangeDelayLoadStatus(false);
}
void nsHTMLMediaElement::PlaybackEnded()
@ -2063,20 +2063,20 @@ void nsHTMLMediaElement::PlaybackEnded()
DispatchAsyncEvent(NS_LITERAL_STRING("durationchange"));
}
FireTimeUpdate(PR_FALSE);
FireTimeUpdate(false);
DispatchAsyncEvent(NS_LITERAL_STRING("ended"));
}
void nsHTMLMediaElement::SeekStarted()
{
DispatchAsyncEvent(NS_LITERAL_STRING("seeking"));
FireTimeUpdate(PR_FALSE);
FireTimeUpdate(false);
}
void nsHTMLMediaElement::SeekCompleted()
{
mPlayingBeforeSeek = PR_FALSE;
SetPlayedOrSeeked(PR_TRUE);
mPlayingBeforeSeek = false;
SetPlayedOrSeeked(true);
DispatchAsyncEvent(NS_LITERAL_STRING("seeked"));
// We changed whether we're seeking so we need to AddRemoveSelfReference
AddRemoveSelfReference();
@ -2125,9 +2125,9 @@ void nsHTMLMediaElement::UpdateReadyStateForData(NextFrameStatus aNextFrame)
if (aNextFrame != NEXT_FRAME_AVAILABLE) {
ChangeReadyState(nsIDOMHTMLMediaElement::HAVE_CURRENT_DATA);
if (!mWaitingFired && aNextFrame == NEXT_FRAME_UNAVAILABLE_BUFFERING) {
FireTimeUpdate(PR_FALSE);
FireTimeUpdate(false);
DispatchAsyncEvent(NS_LITERAL_STRING("waiting"));
mWaitingFired = PR_TRUE;
mWaitingFired = true;
}
return;
}
@ -2184,11 +2184,11 @@ void nsHTMLMediaElement::ChangeReadyState(nsMediaReadyState aState)
!mLoadedFirstFrame)
{
DispatchAsyncEvent(NS_LITERAL_STRING("loadeddata"));
mLoadedFirstFrame = PR_TRUE;
mLoadedFirstFrame = true;
}
if (mReadyState == nsIDOMHTMLMediaElement::HAVE_CURRENT_DATA) {
mWaitingFired = PR_FALSE;
mWaitingFired = false;
}
if (oldState < nsIDOMHTMLMediaElement::HAVE_FUTURE_DATA &&
@ -2224,12 +2224,12 @@ bool nsHTMLMediaElement::CanActivateAutoplay()
void nsHTMLMediaElement::NotifyAutoplayDataReady()
{
if (CanActivateAutoplay()) {
mPaused = PR_FALSE;
mPaused = false;
// We changed mPaused which can affect AddRemoveSelfReference
AddRemoveSelfReference();
if (mDecoder) {
SetPlayedOrSeeked(PR_TRUE);
SetPlayedOrSeeked(true);
mDecoder->Play();
}
DispatchAsyncEvent(NS_LITERAL_STRING("play"));
@ -2258,7 +2258,7 @@ ImageContainer* nsHTMLMediaElement::GetImageContainer()
mImageContainer = manager->CreateImageContainer();
if (manager->IsCompositingCheap()) {
mImageContainer->SetDelayedConversion(PR_TRUE);
mImageContainer->SetDelayedConversion(true);
}
return mImageContainer;
}
@ -2284,7 +2284,7 @@ nsresult nsHTMLMediaElement::DispatchAudioAvailableEvent(float* aFrameBuffer,
NS_ENSURE_SUCCESS(rv, rv);
rv = audioavailableEvent->InitAudioAvailableEvent(NS_LITERAL_STRING("MozAudioAvailable"),
PR_TRUE, PR_TRUE, frameBuffer.forget(), aFrameBufferLength,
true, true, frameBuffer.forget(), aFrameBufferLength,
aTime, mAllowAudioData);
NS_ENSURE_SUCCESS(rv, rv);
@ -2307,8 +2307,8 @@ nsresult nsHTMLMediaElement::DispatchEvent(const nsAString& aName)
return nsContentUtils::DispatchTrustedEvent(GetOwnerDoc(),
static_cast<nsIContent*>(this),
aName,
PR_FALSE,
PR_TRUE);
false,
true);
}
nsresult nsHTMLMediaElement::DispatchAsyncEvent(const nsAString& aName)
@ -2353,7 +2353,7 @@ bool nsHTMLMediaElement::IsPlaybackEnded() const
// the current playback position is equal to the effective end of the media resource.
// See bug 449157.
return mNetworkState >= nsIDOMHTMLMediaElement::HAVE_METADATA &&
mDecoder ? mDecoder->IsEnded() : PR_FALSE;
mDecoder ? mDecoder->IsEnded() : false;
}
already_AddRefed<nsIPrincipal> nsHTMLMediaElement::GetCurrentPrincipal()
@ -2384,7 +2384,7 @@ void nsHTMLMediaElement::NotifyOwnerDocumentActivityChanged()
mDecoder->Pause();
mDecoder->Suspend();
} else {
mDecoder->Resume(PR_FALSE);
mDecoder->Resume(false);
DispatchPendingMediaEvents();
if (!mPaused && !mDecoder->IsEnded()) {
mDecoder->Play();
@ -2445,7 +2445,7 @@ nsresult nsHTMLMediaElement::Observe(nsISupports* aSubject,
NS_ENSURE_TRUE(nsContentUtils::IsCallerChrome(), NS_ERROR_NOT_AVAILABLE);
if (strcmp(aTopic, NS_XPCOM_SHUTDOWN_OBSERVER_ID) == 0) {
mShuttingDown = PR_TRUE;
mShuttingDown = true;
AddRemoveSelfReference();
}
return NS_OK;
@ -2498,11 +2498,11 @@ nsIContent* nsHTMLMediaElement::GetNextSource()
rv = mSourcePointer->SelectNodeContents(thisDomNode);
if (NS_FAILED(rv)) return nsnull;
rv = mSourcePointer->Collapse(PR_TRUE);
rv = mSourcePointer->Collapse(true);
if (NS_FAILED(rv)) return nsnull;
}
while (PR_TRUE) {
while (true) {
#ifdef DEBUG
nsCOMPtr<nsIDOMNode> startContainer;
rv = mSourcePointer->GetStartContainer(getter_AddRefs(startContainer));
@ -2552,7 +2552,7 @@ void nsHTMLMediaElement::ChangeDelayLoadStatus(bool aDelay) {
LOG(PR_LOG_DEBUG, ("%p ChangeDelayLoadStatus(%d) doc=0x%p", this, aDelay, mLoadBlockedDoc.get()));
// mLoadBlockedDoc might be null due to GC unlinking
if (mLoadBlockedDoc) {
mLoadBlockedDoc->UnblockOnload(PR_FALSE);
mLoadBlockedDoc->UnblockOnload(false);
mLoadBlockedDoc = nsnull;
}
}
@ -2622,7 +2622,7 @@ void nsHTMLMediaElement::SetRequestHeaders(nsIHttpChannel* aChannel)
// So, disable the standard "Accept-Encoding: gzip,deflate" that we usually send.
// See bug 614760.
aChannel->SetRequestHeader(NS_LITERAL_CSTRING("Accept-Encoding"),
NS_LITERAL_CSTRING(""), PR_FALSE);
NS_LITERAL_CSTRING(""), false);
// Set the Referer header
nsIDocument* doc = GetOwnerDoc();

View File

@ -176,7 +176,7 @@ nsresult nsHTMLVideoElement::SetAcceptHeader(nsIHttpChannel* aChannel)
return aChannel->SetRequestHeader(NS_LITERAL_CSTRING("Accept"),
value,
PR_FALSE);
false);
}
NS_IMPL_URI_ATTR(nsHTMLVideoElement, Poster, poster)

View File

@ -39,12 +39,12 @@
#include "nsMathUtils.h"
#include "prtypes.h"
// Adds two 32bit unsigned numbers, retuns PR_TRUE if addition succeeded,
// or PR_FALSE the if addition would result in an overflow.
// Adds two 32bit unsigned numbers, retuns true if addition succeeded,
// or false the if addition would result in an overflow.
bool AddOverflow32(PRUint32 a, PRUint32 b, PRUint32& aResult) {
PRUint64 rl = static_cast<PRUint64>(a) + static_cast<PRUint64>(b);
if (rl > PR_UINT32_MAX) {
return PR_FALSE;
return false;
}
aResult = static_cast<PRUint32>(rl);
return true;
@ -52,35 +52,35 @@ bool AddOverflow32(PRUint32 a, PRUint32 b, PRUint32& aResult) {
bool MulOverflow32(PRUint32 a, PRUint32 b, PRUint32& aResult)
{
// 32 bit integer multiplication with overflow checking. Returns PR_TRUE
// if the multiplication was successful, or PR_FALSE if the operation resulted
// 32 bit integer multiplication with overflow checking. Returns true
// if the multiplication was successful, or false if the operation resulted
// in an integer overflow.
PRUint64 a64 = a;
PRUint64 b64 = b;
PRUint64 r64 = a64 * b64;
if (r64 > PR_UINT32_MAX)
return PR_FALSE;
return false;
aResult = static_cast<PRUint32>(r64);
return PR_TRUE;
return true;
}
// Adds two 64bit numbers, retuns PR_TRUE if addition succeeded, or PR_FALSE
// Adds two 64bit numbers, retuns true if addition succeeded, or false
// if addition would result in an overflow.
bool AddOverflow(PRInt64 a, PRInt64 b, PRInt64& aResult) {
if (b < 1) {
if (PR_INT64_MIN - b <= a) {
aResult = a + b;
return PR_TRUE;
return true;
}
} else if (PR_INT64_MAX - b >= a) {
aResult = a + b;
return PR_TRUE;
return true;
}
return PR_FALSE;
return false;
}
// 64 bit integer multiplication with overflow checking. Returns PR_TRUE
// if the multiplication was successful, or PR_FALSE if the operation resulted
// 64 bit integer multiplication with overflow checking. Returns true
// if the multiplication was successful, or false if the operation resulted
// in an integer overflow.
bool MulOverflow(PRInt64 a, PRInt64 b, PRInt64& aResult) {
// We break a multiplication a * b into of sign_a * sign_b * abs(a) * abs(b)
@ -113,9 +113,9 @@ bool MulOverflow(PRInt64 a, PRInt64 b, PRInt64& aResult) {
NS_ASSERTION(a == PR_INT64_MIN, "How else can this happen?");
if (b == 0 || b == 1) {
aResult = a * b;
return PR_TRUE;
return true;
} else {
return PR_FALSE;
return false;
}
}
@ -123,9 +123,9 @@ bool MulOverflow(PRInt64 a, PRInt64 b, PRInt64& aResult) {
NS_ASSERTION(b == PR_INT64_MIN, "How else can this happen?");
if (a == 0 || a == 1) {
aResult = a * b;
return PR_TRUE;
return true;
} else {
return PR_FALSE;
return false;
}
}
@ -143,7 +143,7 @@ bool MulOverflow(PRInt64 a, PRInt64 b, PRInt64& aResult) {
// are non-zero, this will overflow as it's shifted by 64.
// Abort if this overflows.
if (a_hi != 0 && b_hi != 0) {
return PR_FALSE;
return false;
}
// We can now assume that either a_hi or b_hi is 0.
@ -156,24 +156,24 @@ bool MulOverflow(PRInt64 a, PRInt64 b, PRInt64& aResult) {
PRInt64 q = a_hi * b_lo + a_lo * b_hi;
if (q > PR_INT32_MAX) {
// q will overflow when we shift by 32; abort.
return PR_FALSE;
return false;
}
q <<= 32;
// Both a_lo and b_lo are less than INT32_MAX, so can't overflow.
PRUint64 lo = a_lo * b_lo;
if (lo > PR_INT64_MAX) {
return PR_FALSE;
return false;
}
// Add the final result. We must check for overflow during addition.
if (!AddOverflow(q, static_cast<PRInt64>(lo), aResult)) {
return PR_FALSE;
return false;
}
aResult *= sign;
NS_ASSERTION(a * b == aResult, "We didn't overflow, but result is wrong!");
return PR_TRUE;
return true;
}
// Converts from number of audio frames to microseconds, given the specified
@ -182,9 +182,9 @@ bool FramesToUsecs(PRInt64 aFrames, PRUint32 aRate, PRInt64& aOutUsecs)
{
PRInt64 x;
if (!MulOverflow(aFrames, USECS_PER_S, x))
return PR_FALSE;
return false;
aOutUsecs = x / aRate;
return PR_TRUE;
return true;
}
// Converts from microseconds to number of audio frames, given the specified
@ -193,9 +193,9 @@ bool UsecsToFrames(PRInt64 aUsecs, PRUint32 aRate, PRInt64& aOutFrames)
{
PRInt64 x;
if (!MulOverflow(aUsecs, aRate, x))
return PR_FALSE;
return false;
aOutFrames = x / USECS_PER_S;
return PR_TRUE;
return true;
}
static PRInt32 ConditionDimension(float aValue)

View File

@ -110,33 +110,33 @@ private:
} // namespace mozilla
// Adds two 32bit unsigned numbers, retuns PR_TRUE if addition succeeded,
// or PR_FALSE the if addition would result in an overflow.
// Adds two 32bit unsigned numbers, retuns true if addition succeeded,
// or false the if addition would result in an overflow.
bool AddOverflow32(PRUint32 a, PRUint32 b, PRUint32& aResult);
// 32 bit integer multiplication with overflow checking. Returns PR_TRUE
// if the multiplication was successful, or PR_FALSE if the operation resulted
// 32 bit integer multiplication with overflow checking. Returns true
// if the multiplication was successful, or false if the operation resulted
// in an integer overflow.
bool MulOverflow32(PRUint32 a, PRUint32 b, PRUint32& aResult);
// Adds two 64bit numbers, retuns PR_TRUE if addition succeeded, or PR_FALSE
// Adds two 64bit numbers, retuns true if addition succeeded, or false
// if addition would result in an overflow.
bool AddOverflow(PRInt64 a, PRInt64 b, PRInt64& aResult);
// 64 bit integer multiplication with overflow checking. Returns PR_TRUE
// if the multiplication was successful, or PR_FALSE if the operation resulted
// 64 bit integer multiplication with overflow checking. Returns true
// if the multiplication was successful, or false if the operation resulted
// in an integer overflow.
bool MulOverflow(PRInt64 a, PRInt64 b, PRInt64& aResult);
// Converts from number of audio frames (aFrames) to microseconds, given
// the specified audio rate (aRate). Stores result in aOutUsecs. Returns PR_TRUE
// if the operation succeeded, or PR_FALSE if there was an integer overflow
// the specified audio rate (aRate). Stores result in aOutUsecs. Returns true
// if the operation succeeded, or false if there was an integer overflow
// while calulating the conversion.
bool FramesToUsecs(PRInt64 aFrames, PRUint32 aRate, PRInt64& aOutUsecs);
// Converts from microseconds (aUsecs) to number of audio frames, given the
// specified audio rate (aRate). Stores the result in aOutFrames. Returns
// PR_TRUE if the operation succeeded, or PR_FALSE if there was an integer
// true if the operation succeeded, or false if there was an integer
// overflow while calulating the conversion.
bool UsecsToFrames(PRInt64 aUsecs, PRUint32 aRate, PRInt64& aOutFrames);

View File

@ -110,10 +110,10 @@ class nsNativeAudioStream : public nsAudioStream
SampleFormat mFormat;
// PR_TRUE if this audio stream is paused.
// True if this audio stream is paused.
bool mPaused;
// PR_TRUE if this stream has encountered an error.
// True if this stream has encountered an error.
bool mInError;
};
@ -148,7 +148,7 @@ private:
PRInt32 mBytesPerFrame;
// PR_TRUE if this audio stream is paused.
// True if this audio stream is paused.
bool mPaused;
friend class AudioInitEvent;
@ -393,8 +393,8 @@ nsNativeAudioStream::nsNativeAudioStream() :
mRate(0),
mChannels(0),
mFormat(FORMAT_S16_LE),
mPaused(PR_FALSE),
mInError(PR_FALSE)
mPaused(false),
mInError(false)
{
}
@ -418,7 +418,7 @@ nsresult nsNativeAudioStream::Init(PRInt32 aNumChannels, PRInt32 aRate, SampleFo
aRate,
aNumChannels) != SA_SUCCESS) {
mAudioHandle = nsnull;
mInError = PR_TRUE;
mInError = true;
PR_LOG(gAudioStreamLog, PR_LOG_ERROR, ("nsNativeAudioStream: sa_stream_create_pcm error"));
return NS_ERROR_FAILURE;
}
@ -426,11 +426,11 @@ nsresult nsNativeAudioStream::Init(PRInt32 aNumChannels, PRInt32 aRate, SampleFo
if (sa_stream_open(static_cast<sa_stream_t*>(mAudioHandle)) != SA_SUCCESS) {
sa_stream_destroy(static_cast<sa_stream_t*>(mAudioHandle));
mAudioHandle = nsnull;
mInError = PR_TRUE;
mInError = true;
PR_LOG(gAudioStreamLog, PR_LOG_ERROR, ("nsNativeAudioStream: sa_stream_open error"));
return NS_ERROR_FAILURE;
}
mInError = PR_FALSE;
mInError = false;
return NS_OK;
}
@ -442,7 +442,7 @@ void nsNativeAudioStream::Shutdown()
sa_stream_destroy(static_cast<sa_stream_t*>(mAudioHandle));
mAudioHandle = nsnull;
mInError = PR_TRUE;
mInError = true;
}
nsresult nsNativeAudioStream::Write(const void* aBuf, PRUint32 aFrames)
@ -501,7 +501,7 @@ nsresult nsNativeAudioStream::Write(const void* aBuf, PRUint32 aFrames)
samples * sizeof(short)) != SA_SUCCESS)
{
PR_LOG(gAudioStreamLog, PR_LOG_ERROR, ("nsNativeAudioStream: sa_stream_write error"));
mInError = PR_TRUE;
mInError = true;
return NS_ERROR_FAILURE;
}
}
@ -528,7 +528,7 @@ void nsNativeAudioStream::SetVolume(double aVolume)
#if defined(SA_PER_STREAM_VOLUME)
if (sa_stream_set_volume_abs(static_cast<sa_stream_t*>(mAudioHandle), aVolume) != SA_SUCCESS) {
PR_LOG(gAudioStreamLog, PR_LOG_ERROR, ("nsNativeAudioStream: sa_stream_set_volume_abs error"));
mInError = PR_TRUE;
mInError = true;
}
#else
mVolume = aVolume;
@ -545,7 +545,7 @@ void nsNativeAudioStream::Drain()
int r = sa_stream_drain(static_cast<sa_stream_t*>(mAudioHandle));
if (r != SA_SUCCESS && r != SA_ERROR_INVALID) {
PR_LOG(gAudioStreamLog, PR_LOG_ERROR, ("nsNativeAudioStream: sa_stream_drain error"));
mInError = PR_TRUE;
mInError = true;
}
}
@ -553,7 +553,7 @@ void nsNativeAudioStream::Pause()
{
if (mInError)
return;
mPaused = PR_TRUE;
mPaused = true;
sa_stream_pause(static_cast<sa_stream_t*>(mAudioHandle));
}
@ -561,7 +561,7 @@ void nsNativeAudioStream::Resume()
{
if (mInError)
return;
mPaused = PR_FALSE;
mPaused = false;
sa_stream_resume(static_cast<sa_stream_t*>(mAudioHandle));
}
@ -617,7 +617,7 @@ nsRemotedAudioStream::nsRemotedAudioStream()
mRate(0),
mChannels(0),
mBytesPerFrame(0),
mPaused(PR_FALSE)
mPaused(false)
{}
nsRemotedAudioStream::~nsRemotedAudioStream()
@ -715,20 +715,20 @@ nsRemotedAudioStream::Drain()
void
nsRemotedAudioStream::Pause()
{
mPaused = PR_TRUE;
mPaused = true;
if (!mAudioChild)
return;
nsCOMPtr<nsIRunnable> event = new AudioPauseEvent(mAudioChild, PR_TRUE);
nsCOMPtr<nsIRunnable> event = new AudioPauseEvent(mAudioChild, true);
NS_DispatchToMainThread(event);
}
void
nsRemotedAudioStream::Resume()
{
mPaused = PR_FALSE;
mPaused = false;
if (!mAudioChild)
return;
nsCOMPtr<nsIRunnable> event = new AudioPauseEvent(mAudioChild, PR_FALSE);
nsCOMPtr<nsIRunnable> event = new AudioPauseEvent(mAudioChild, false);
NS_DispatchToMainThread(event);
}

View File

@ -114,7 +114,7 @@ public:
// was opened, of the audio hardware.
virtual PRInt64 GetPositionInFrames() = 0;
// Returns PR_TRUE when the audio stream is paused.
// Returns true when the audio stream is paused.
virtual bool IsPaused() = 0;
// Returns the minimum number of audio frames which must be written before

View File

@ -113,13 +113,13 @@ nsBuiltinDecoder::nsBuiltinDecoder() :
mInitialVolume(0.0),
mRequestedSeekTime(-1.0),
mDuration(-1),
mSeekable(PR_TRUE),
mSeekable(true),
mReentrantMonitor("media.decoder"),
mPlayState(PLAY_STATE_PAUSED),
mNextState(PLAY_STATE_PAUSED),
mResourceLoaded(PR_FALSE),
mIgnoreProgressData(PR_FALSE),
mInfiniteStream(PR_FALSE)
mResourceLoaded(false),
mIgnoreProgressData(false),
mInfiniteStream(false)
{
MOZ_COUNT_CTOR(nsBuiltinDecoder);
NS_ASSERTION(NS_IsMainThread(), "Should be on main thread.");
@ -134,11 +134,11 @@ bool nsBuiltinDecoder::Init(nsHTMLMediaElement* aElement)
{
NS_ASSERTION(NS_IsMainThread(), "Should be on main thread.");
if (!nsMediaDecoder::Init(aElement))
return PR_FALSE;
return false;
nsContentUtils::RegisterShutdownObserver(this);
mImageContainer = aElement->GetImageContainer();
return PR_TRUE;
return true;
}
void nsBuiltinDecoder::Shutdown()
@ -148,7 +148,7 @@ void nsBuiltinDecoder::Shutdown()
if (mShuttingDown)
return;
mShuttingDown = PR_TRUE;
mShuttingDown = true;
// This changes the decoder state to SHUTDOWN and does other things
// necessary to unblock the state machine thread if it's blocked, so
@ -270,9 +270,9 @@ nsresult nsBuiltinDecoder::Play()
}
/**
* Returns PR_TRUE if aValue is inside a range of aRanges, and put the range
* Returns true if aValue is inside a range of aRanges, and put the range
* index in aIntervalIndex if it is not null.
* If aValue is not inside a range, PR_FALSE is returned, and aIntervalIndex, if
* If aValue is not inside a range, false is returned, and aIntervalIndex, if
* not null, is set to the index of the range which ends immediatly before aValue
* (and can be -1 if aValue is before aRanges.Start(0)).
*/
@ -284,16 +284,16 @@ static bool IsInRanges(nsTimeRanges& aRanges, double aValue, PRInt32& aIntervalI
aRanges.Start(i, &start);
if (start > aValue) {
aIntervalIndex = i - 1;
return PR_FALSE;
return false;
}
aRanges.End(i, &end);
if (aValue <= end) {
aIntervalIndex = i;
return PR_TRUE;
return true;
}
}
aIntervalIndex = length - 1;
return PR_FALSE;
return false;
}
nsresult nsBuiltinDecoder::Seek(double aTime)
@ -429,7 +429,7 @@ void nsBuiltinDecoder::MetadataLoaded(PRUint32 aChannels,
}
if (mDuration == -1) {
SetInfinite(PR_TRUE);
SetInfinite(true);
}
if (mElement && notifyElement) {
@ -492,9 +492,9 @@ void nsBuiltinDecoder::ResourceLoaded()
if (mIgnoreProgressData || mResourceLoaded || mPlayState == PLAY_STATE_LOADING)
return;
Progress(PR_FALSE);
Progress(false);
mResourceLoaded = PR_TRUE;
mResourceLoaded = true;
StopProgress();
}
@ -554,7 +554,7 @@ void nsBuiltinDecoder::PlaybackEnded()
// This must be called after |mElement->PlaybackEnded()| call above, in order
// to fire the required durationchange.
if (IsInfinite()) {
SetInfinite(PR_FALSE);
SetInfinite(false);
}
}
@ -590,9 +590,9 @@ nsBuiltinDecoder::GetStatistics()
}
else {
result.mDownloadRate = 0;
result.mDownloadRateReliable = PR_TRUE;
result.mDownloadRateReliable = true;
result.mPlaybackRate = 0;
result.mPlaybackRateReliable = PR_TRUE;
result.mPlaybackRateReliable = true;
result.mDecoderPosition = 0;
result.mPlaybackPosition = 0;
result.mDownloadPosition = 0;
@ -610,7 +610,7 @@ double nsBuiltinDecoder::ComputePlaybackRate(bool* aReliable)
PRInt64 length = mStream ? mStream->GetLength() : -1;
if (mDuration >= 0 && length >= 0) {
*aReliable = PR_TRUE;
*aReliable = true;
return length * static_cast<double>(USECS_PER_S) / mDuration;
}
return mPlaybackStatistics.GetRateAtLastStop(aReliable);
@ -653,7 +653,7 @@ void nsBuiltinDecoder::NotifyBytesDownloaded()
{
NS_ASSERTION(NS_IsMainThread(), "Should be on main thread.");
UpdateReadyStateForData();
Progress(PR_FALSE);
Progress(false);
}
void nsBuiltinDecoder::NotifyDownloadEnded(nsresult aStatus)
@ -744,7 +744,7 @@ void nsBuiltinDecoder::SeekingStopped()
// in operation.
if (mRequestedSeekTime >= 0.0) {
ChangeState(PLAY_STATE_SEEKING);
seekWasAborted = PR_TRUE;
seekWasAborted = true;
} else {
UnpinForSeek();
ChangeState(mNextState);
@ -777,10 +777,10 @@ void nsBuiltinDecoder::SeekingStoppedAtEnd()
// in operation.
if (mRequestedSeekTime >= 0.0) {
ChangeState(PLAY_STATE_SEEKING);
seekWasAborted = PR_TRUE;
seekWasAborted = true;
} else {
UnpinForSeek();
fireEnded = PR_TRUE;
fireEnded = true;
ChangeState(PLAY_STATE_ENDED);
}
}
@ -952,7 +952,7 @@ void nsBuiltinDecoder::Suspend()
{
NS_ASSERTION(NS_IsMainThread(), "Should be on main thread.");
if (mStream) {
mStream->Suspend(PR_TRUE);
mStream->Suspend(true);
}
}
@ -973,7 +973,7 @@ void nsBuiltinDecoder::StopProgressUpdates()
NS_ASSERTION(OnStateMachineThread() || OnDecodeThread(),
"Should be on state machine or decode thread.");
GetReentrantMonitor().AssertCurrentThreadIn();
mIgnoreProgressData = PR_TRUE;
mIgnoreProgressData = true;
if (mStream) {
mStream->SetReadMode(nsMediaCacheStream::MODE_METADATA);
}
@ -984,7 +984,7 @@ void nsBuiltinDecoder::StartProgressUpdates()
NS_ASSERTION(OnStateMachineThread() || OnDecodeThread(),
"Should be on state machine or decode thread.");
GetReentrantMonitor().AssertCurrentThreadIn();
mIgnoreProgressData = PR_FALSE;
mIgnoreProgressData = false;
if (mStream) {
mStream->SetReadMode(nsMediaCacheStream::MODE_PLAYBACK);
mDecoderPosition = mPlaybackPosition = mStream->Tell();

View File

@ -288,7 +288,7 @@ public:
// on the appropriate threads.
virtual bool OnDecodeThread() const = 0;
// Returns PR_TRUE if the current thread is the state machine thread.
// Returns true if the current thread is the state machine thread.
virtual bool OnStateMachineThread() const = 0;
virtual nsHTMLMediaElement::NextFrameStatus GetNextFrameStatus() = 0;
@ -316,7 +316,7 @@ public:
// before calling this.
virtual void SetSeekable(bool aSeekable) = 0;
// Returns PR_TRUE if the media resource can seek into unbuffered ranges,
// Returns true if the media resource can seek into unbuffered ranges,
// as set by SetSeekable(). The decoder monitor must be obtained before
// calling this.
virtual bool IsSeekable() = 0;
@ -419,11 +419,11 @@ class nsBuiltinDecoder : public nsMediaDecoder
// Call on the main thread only.
virtual void NetworkError();
// Call from any thread safely. Return PR_TRUE if we are currently
// Call from any thread safely. Return true if we are currently
// seeking in the media resource.
virtual bool IsSeeking() const;
// Return PR_TRUE if the decoder has reached the end of playback.
// Return true if the decoder has reached the end of playback.
// Call on the main thread only.
virtual bool IsEnded() const;
@ -435,7 +435,7 @@ class nsBuiltinDecoder : public nsMediaDecoder
// Set a flag indicating whether seeking is supported
virtual void SetSeekable(bool aSeekable);
// Return PR_TRUE if seeking is supported.
// Return true if seeking is supported.
virtual bool IsSeekable();
virtual nsresult GetSeekable(nsTimeRanges* aSeekable);
@ -704,7 +704,7 @@ public:
// locked before accessing.
bool mIgnoreProgressData;
// PR_TRUE if the stream is infinite (e.g. a webradio).
// True if the stream is infinite (e.g. a webradio).
bool mInfiniteStream;
};

View File

@ -58,11 +58,11 @@ public:
mAudioChannels(0),
mDisplay(0,0),
mStereoMode(mozilla::layers::STEREO_MODE_MONO),
mHasAudio(PR_FALSE),
mHasVideo(PR_FALSE)
mHasAudio(false),
mHasVideo(false)
{}
// Returns PR_TRUE if it's safe to use aPicture as the picture to be
// Returns true if it's safe to use aPicture as the picture to be
// extracted inside a frame of size aFrame, and scaled up to and displayed
// at a size of aDisplay. You should validate the frame, picture, and
// display regions before using them to display video frames.
@ -83,10 +83,10 @@ public:
// Indicates the frame layout for single track stereo videos.
mozilla::layers::StereoMode mStereoMode;
// PR_TRUE if we have an active audio bitstream.
// True if we have an active audio bitstream.
bool mHasAudio;
// PR_TRUE if we have an active video bitstream.
// True if we have an active video bitstream.
bool mHasVideo;
};
@ -225,7 +225,7 @@ public:
// This frame's image.
nsRefPtr<Image> mImage;
// When PR_TRUE, denotes that this frame is identical to the frame that
// When true, denotes that this frame is identical to the frame that
// came before; it's a duplicate. mBuffer will be empty.
bool mDuplicate;
bool mKeyframe;
@ -236,8 +236,8 @@ public:
mTime(aTime),
mEndTime(aEndTime),
mTimecode(aTimecode),
mDuplicate(PR_TRUE),
mKeyframe(PR_FALSE)
mDuplicate(true),
mKeyframe(false)
{
MOZ_COUNT_CTOR(VideoData);
NS_ASSERTION(aEndTime >= aTime, "Frame must start before it ends.");
@ -254,7 +254,7 @@ public:
mTime(aTime),
mEndTime(aEndTime),
mTimecode(aTimecode),
mDuplicate(PR_FALSE),
mDuplicate(false),
mKeyframe(aKeyframe)
{
MOZ_COUNT_CTOR(VideoData);
@ -338,7 +338,7 @@ template <class T> class MediaQueue : private nsDeque {
T* x = PopFront();
delete x;
}
mEndOfStream = PR_FALSE;
mEndOfStream = false;
}
bool AtEndOfStream() {
@ -346,7 +346,7 @@ template <class T> class MediaQueue : private nsDeque {
return GetSize() == 0 && mEndOfStream;
}
// Returns PR_TRUE if the media queue has had it last item added to it.
// Returns true if the media queue has had it last item added to it.
// This happens when the media stream has been completely decoded. Note this
// does not mean that the corresponding stream has finished playback.
bool IsFinished() {
@ -357,7 +357,7 @@ template <class T> class MediaQueue : private nsDeque {
// Informs the media queue that it won't be receiving any more items.
void Finish() {
ReentrantMonitorAutoEnter mon(mReentrantMonitor);
mEndOfStream = PR_TRUE;
mEndOfStream = true;
}
// Returns the approximate number of microseconds of items in the queue.
@ -379,7 +379,7 @@ template <class T> class MediaQueue : private nsDeque {
private:
mutable ReentrantMonitor mReentrantMonitor;
// PR_TRUE when we've decoded the last frame of data in the
// True when we've decoded the last frame of data in the
// bitstream for which we're queueing frame data.
bool mEndOfStream;
};
@ -404,14 +404,14 @@ public:
virtual nsresult ResetDecode();
// Decodes an unspecified amount of audio data, enqueuing the audio data
// in mAudioQueue. Returns PR_TRUE when there's more audio to decode,
// PR_FALSE if the audio is finished, end of file has been reached,
// in mAudioQueue. Returns true when there's more audio to decode,
// false if the audio is finished, end of file has been reached,
// or an un-recoverable read error has occured.
virtual bool DecodeAudioData() = 0;
// Reads and decodes one video frame. Packets with a timestamp less
// than aTimeThreshold will be decoded (unless they're not keyframes
// and aKeyframeSkip is PR_TRUE), but will not be added to the queue.
// and aKeyframeSkip is true), but will not be added to the queue.
virtual bool DecodeVideoFrame(bool &aKeyframeSkip,
PRInt64 aTimeThreshold) = 0;

View File

@ -204,20 +204,20 @@ nsBuiltinDecoderStateMachine::nsBuiltinDecoderStateMachine(nsBuiltinDecoder* aDe
mAudioEndTime(-1),
mVideoFrameEndTime(-1),
mVolume(1.0),
mSeekable(PR_TRUE),
mPositionChangeQueued(PR_FALSE),
mAudioCompleted(PR_FALSE),
mGotDurationFromMetaData(PR_FALSE),
mStopDecodeThread(PR_TRUE),
mDecodeThreadIdle(PR_FALSE),
mStopAudioThread(PR_TRUE),
mQuickBuffering(PR_FALSE),
mIsRunning(PR_FALSE),
mRunAgain(PR_FALSE),
mDispatchedRunEvent(PR_FALSE),
mDecodeThreadWaiting(PR_FALSE),
mEventManager(aDecoder),
mRealTime(aRealTime)
mSeekable(true),
mPositionChangeQueued(false),
mAudioCompleted(false),
mGotDurationFromMetaData(false),
mStopDecodeThread(true),
mDecodeThreadIdle(false),
mStopAudioThread(true),
mQuickBuffering(false),
mIsRunning(false),
mRunAgain(false),
mDispatchedRunEvent(false),
mDecodeThreadWaiting(false),
mRealTime(aRealTime),
mEventManager(aDecoder)
{
MOZ_COUNT_CTOR(nsBuiltinDecoderStateMachine);
NS_ASSERTION(NS_IsMainThread(), "Should be on main thread.");
@ -232,7 +232,7 @@ nsBuiltinDecoderStateMachine::nsBuiltinDecoderStateMachine(nsBuiltinDecoder* aDe
// only enable realtime mode when "media.realtime_decoder.enabled" is true.
if (Preferences::GetBool("media.realtime_decoder.enabled", false) == false)
mRealTime = PR_FALSE;
mRealTime = false;
mBufferingWait = mRealTime ? 0 : BUFFERING_WAIT;
mLowDataThresholdUsecs = mRealTime ? 0 : LOW_DATA_THRESHOLD_USECS;
@ -311,7 +311,7 @@ void nsBuiltinDecoderStateMachine::DecodeThreadRun()
}
}
mDecodeThreadIdle = PR_TRUE;
mDecodeThreadIdle = true;
LOG(PR_LOG_DEBUG, ("%p Decode thread finished", mDecoder.get()));
}
@ -329,7 +329,7 @@ void nsBuiltinDecoderStateMachine::DecodeLoop()
// If the video decode is falling behind the audio, we'll start dropping the
// inter-frames up until the next keyframe which is at or before the current
// playback position. skipToNextKeyframe is PR_TRUE if we're currently
// playback position. skipToNextKeyframe is true if we're currently
// skipping up to the next keyframe.
bool skipToNextKeyframe = false;
@ -367,14 +367,14 @@ void nsBuiltinDecoderStateMachine::DecodeLoop()
if (videoPump &&
static_cast<PRUint32>(videoQueue.GetSize()) >= videoPumpThreshold)
{
videoPump = PR_FALSE;
videoPump = false;
}
// We don't want to consider skipping to the next keyframe if we've
// only just started up the decode loop, so wait until we've decoded
// some audio data before enabling the keyframe skip logic on audio.
if (audioPump && GetDecodedAudioDuration() >= audioPumpThreshold) {
audioPump = PR_FALSE;
audioPump = false;
}
// We'll skip the video decode to the nearest keyframe if we're low on
@ -393,7 +393,7 @@ void nsBuiltinDecoderStateMachine::DecodeLoop()
!HasLowUndecodedData())
{
skipToNextKeyframe = PR_TRUE;
skipToNextKeyframe = true;
LOG(PR_LOG_DEBUG, ("%p Skipping video decode to the next keyframe", mDecoder.get()));
}
@ -459,7 +459,7 @@ void nsBuiltinDecoderStateMachine::DecodeLoop()
// monitor which will wake us up shortly after we sleep, thus preventing
// both the decode and audio push threads waiting at the same time.
// See bug 620326.
mDecodeThreadWaiting = PR_TRUE;
mDecodeThreadWaiting = true;
if (mDecoder->GetState() != nsBuiltinDecoder::PLAY_STATE_PLAYING) {
// We're not playing, and the decode is about to wait. This means
// the decode thread may not be needed in future. Signal the state
@ -468,7 +468,7 @@ void nsBuiltinDecoderStateMachine::DecodeLoop()
ScheduleStateMachine();
}
mDecoder->GetReentrantMonitor().Wait();
mDecodeThreadWaiting = PR_FALSE;
mDecodeThreadWaiting = false;
}
} // End decode loop.
@ -504,7 +504,7 @@ void nsBuiltinDecoderStateMachine::AudioLoop()
PRInt32 minWriteFrames = -1;
{
ReentrantMonitorAutoEnter mon(mDecoder->GetReentrantMonitor());
mAudioCompleted = PR_FALSE;
mAudioCompleted = false;
audioStartTime = mAudioStartTime;
channels = mInfo.mAudioChannels;
rate = mInfo.mAudioRate;
@ -707,7 +707,7 @@ void nsBuiltinDecoderStateMachine::AudioLoop()
ReentrantMonitorAutoEnter mon(mDecoder->GetReentrantMonitor());
mAudioStream = nsnull;
mEventManager.Clear();
mAudioCompleted = PR_TRUE;
mAudioCompleted = true;
UpdateReadyState();
// Kick the decode thread; it may be sleeping waiting for this to finish.
mDecoder->GetReentrantMonitor().NotifyAll();
@ -859,7 +859,7 @@ void nsBuiltinDecoderStateMachine::UpdatePlaybackPosition(PRInt64 aTime)
bool fragmentEnded = mFragmentEndTime >= 0 && GetMediaTime() >= mFragmentEndTime;
if (!mPositionChangeQueued || fragmentEnded) {
mPositionChangeQueued = PR_TRUE;
mPositionChangeQueued = true;
nsCOMPtr<nsIRunnable> event =
NS_NewRunnableMethod(mDecoder, &nsBuiltinDecoder::PlaybackPositionChanged);
NS_DispatchToMainThread(event, NS_DISPATCH_NORMAL);
@ -878,7 +878,7 @@ void nsBuiltinDecoderStateMachine::ClearPositionChangeFlag()
NS_ASSERTION(NS_IsMainThread(), "Should be on main thread.");
mDecoder->GetReentrantMonitor().AssertCurrentThreadIn();
mPositionChangeQueued = PR_FALSE;
mPositionChangeQueued = false;
}
nsHTMLMediaElement::NextFrameStatus nsBuiltinDecoderStateMachine::GetNextFrameStatus()
@ -1007,7 +1007,7 @@ void nsBuiltinDecoderStateMachine::ResetPlayback()
mVideoFrameEndTime = -1;
mAudioStartTime = -1;
mAudioEndTime = -1;
mAudioCompleted = PR_FALSE;
mAudioCompleted = false;
}
void nsBuiltinDecoderStateMachine::Seek(double aTime)
@ -1044,7 +1044,7 @@ void nsBuiltinDecoderStateMachine::StopDecodeThread()
{
NS_ASSERTION(OnStateMachineThread(), "Should be on state machine thread.");
mDecoder->GetReentrantMonitor().AssertCurrentThreadIn();
mStopDecodeThread = PR_TRUE;
mStopDecodeThread = true;
mDecoder->GetReentrantMonitor().NotifyAll();
if (mDecodeThread) {
LOG(PR_LOG_DEBUG, ("%p Shutdown decode thread", mDecoder.get()));
@ -1053,14 +1053,14 @@ void nsBuiltinDecoderStateMachine::StopDecodeThread()
mDecodeThread->Shutdown();
}
mDecodeThread = nsnull;
mDecodeThreadIdle = PR_FALSE;
mDecodeThreadIdle = false;
}
}
void nsBuiltinDecoderStateMachine::StopAudioThread()
{
mDecoder->GetReentrantMonitor().AssertCurrentThreadIn();
mStopAudioThread = PR_TRUE;
mStopAudioThread = true;
mDecoder->GetReentrantMonitor().NotifyAll();
if (mAudioThread) {
LOG(PR_LOG_DEBUG, ("%p Shutdown audio thread", mDecoder.get()));
@ -1077,7 +1077,7 @@ nsBuiltinDecoderStateMachine::StartDecodeThread()
{
NS_ASSERTION(OnStateMachineThread(), "Should be on state machine thread.");
mDecoder->GetReentrantMonitor().AssertCurrentThreadIn();
mStopDecodeThread = PR_FALSE;
mStopDecodeThread = false;
if ((mDecodeThread && !mDecodeThreadIdle) || mState >= DECODER_STATE_COMPLETED)
return NS_OK;
@ -1093,7 +1093,7 @@ nsBuiltinDecoderStateMachine::StartDecodeThread()
nsCOMPtr<nsIRunnable> event =
NS_NewRunnableMethod(this, &nsBuiltinDecoderStateMachine::DecodeThreadRun);
mDecodeThread->Dispatch(event, NS_DISPATCH_NORMAL);
mDecodeThreadIdle = PR_FALSE;
mDecodeThreadIdle = false;
return NS_OK;
}
@ -1103,7 +1103,7 @@ nsBuiltinDecoderStateMachine::StartAudioThread()
NS_ASSERTION(OnStateMachineThread() || OnDecodeThread(),
"Should be on state machine or decode thread.");
mDecoder->GetReentrantMonitor().AssertCurrentThreadIn();
mStopAudioThread = PR_FALSE;
mStopAudioThread = false;
if (HasAudio() && !mAudioThread) {
nsresult rv = NS_NewThread(getter_AddRefs(mAudioThread),
nsnull,
@ -1384,7 +1384,7 @@ void nsBuiltinDecoderStateMachine::DecodeSeek()
// Reset quick buffering status. This ensures that if we began the
// seek while quick-buffering, we won't bypass quick buffering mode
// if we need to buffer after the seek.
mQuickBuffering = PR_FALSE;
mQuickBuffering = false;
ScheduleStateMachine();
}
@ -1918,22 +1918,22 @@ nsresult nsBuiltinDecoderStateMachine::CallRunStateMachine()
{
mDecoder->GetReentrantMonitor().AssertCurrentThreadIn();
NS_ASSERTION(OnStateMachineThread(), "Should be on state machine thread.");
// This will be set to PR_TRUE by ScheduleStateMachine() if it's called
// This will be set to true by ScheduleStateMachine() if it's called
// while we're in RunStateMachine().
mRunAgain = PR_FALSE;
mRunAgain = false;
// Set to PR_TRUE whenever we dispatch an event to run this state machine.
// Set to true whenever we dispatch an event to run this state machine.
// This flag prevents us from dispatching
mDispatchedRunEvent = PR_FALSE;
mDispatchedRunEvent = false;
mTimeout = TimeStamp();
mIsRunning = PR_TRUE;
mIsRunning = true;
nsresult res = RunStateMachine();
mIsRunning = PR_FALSE;
mIsRunning = false;
if (mRunAgain && !mDispatchedRunEvent) {
mDispatchedRunEvent = PR_TRUE;
mDispatchedRunEvent = true;
return NS_DispatchToCurrentThread(this);
}
@ -1952,7 +1952,7 @@ void nsBuiltinDecoderStateMachine::TimeoutExpired()
ReentrantMonitorAutoEnter mon(mDecoder->GetReentrantMonitor());
NS_ASSERTION(OnStateMachineThread(), "Must be on state machine thread");
if (mIsRunning) {
mRunAgain = PR_TRUE;
mRunAgain = true;
} else if (!mDispatchedRunEvent) {
// We don't have an event dispatched to run the state machine, so we
// can just run it from here.
@ -1998,12 +1998,12 @@ nsresult nsBuiltinDecoderStateMachine::ScheduleStateMachine(PRInt64 aUsecs) {
if (mIsRunning) {
// We're currently running this state machine on the state machine
// thread. Signal it to run again once it finishes its current cycle.
mRunAgain = PR_TRUE;
mRunAgain = true;
return NS_OK;
} else if (!mDispatchedRunEvent) {
// We're not currently running this state machine on the state machine
// thread. Dispatch an event to run one cycle of the state machine.
mDispatchedRunEvent = PR_TRUE;
mDispatchedRunEvent = true;
return gStateMachineThread->Dispatch(this, NS_DISPATCH_NORMAL);
}
// We're not currently running this state machine on the state machine

View File

@ -269,11 +269,11 @@ public:
protected:
// Returns PR_TRUE if we've got less than aAudioUsecs microseconds of decoded
// Returns true if we've got less than aAudioUsecs microseconds of decoded
// and playable data. The decoder monitor must be held.
bool HasLowDecodedData(PRInt64 aAudioUsecs) const;
// Returns PR_TRUE if we're running low on data which is not yet decoded.
// Returns true if we're running low on data which is not yet decoded.
// The decoder monitor must be held.
bool HasLowUndecodedData() const;
@ -287,11 +287,11 @@ protected:
// must be held.
PRInt64 AudioDecodedUsecs() const;
// Returns PR_TRUE when there's decoded audio waiting to play.
// Returns true when there's decoded audio waiting to play.
// The decoder monitor must be held.
bool HasFutureAudio() const;
// Returns PR_TRUE if we recently exited "quick buffering" mode.
// Returns true if we recently exited "quick buffering" mode.
bool JustExitedQuickBuffering();
// Waits on the decoder ReentrantMonitor for aUsecs microseconds. If the decoder
@ -388,7 +388,7 @@ protected:
// thread. The decoder monitor must be held.
void StartDecoding();
// Returns PR_TRUE if we're currently playing. The decoder monitor must
// Returns true if we're currently playing. The decoder monitor must
// be held.
bool IsPlaying();
@ -440,7 +440,7 @@ protected:
return !mTimeout.IsNull() || mRunAgain;
}
// Returns PR_TRUE if we're not playing and the decode thread has filled its
// Returns true if we're not playing and the decode thread has filled its
// decode buffers and is waiting. We can shut the decode thread down in this
// case as it may not be needed again.
bool IsPausedAndDecoderWaiting();
@ -560,71 +560,71 @@ protected:
// Time at which we started decoding. Synchronised via decoder monitor.
TimeStamp mDecodeStartTime;
// PR_TRUE if the media resource can be seeked. Accessed from the state
// True if the media resource can be seeked. Accessed from the state
// machine and main threads. Synchronised via decoder monitor.
bool mSeekable;
// PR_TRUE if an event to notify about a change in the playback
// position has been queued, but not yet run. It is set to PR_FALSE when
// True if an event to notify about a change in the playback
// position has been queued, but not yet run. It is set to false when
// the event is run. This allows coalescing of these events as they can be
// produced many times per second. Synchronised via decoder monitor.
// Accessed on main and state machine threads.
bool mPositionChangeQueued;
// PR_TRUE if the audio playback thread has finished. It is finished
// True if the audio playback thread has finished. It is finished
// when either all the audio frames in the Vorbis bitstream have completed
// playing, or we've moved into shutdown state, and the threads are to be
// destroyed. Written by the audio playback thread and read and written by
// the state machine thread. Synchronised via decoder monitor.
bool mAudioCompleted;
// PR_TRUE if mDuration has a value obtained from an HTTP header, or from
// True if mDuration has a value obtained from an HTTP header, or from
// the media index/metadata. Accessed on the state machine thread.
bool mGotDurationFromMetaData;
// PR_FALSE while decode thread should be running. Accessed state machine
// False while decode thread should be running. Accessed state machine
// and decode threads. Syncrhonised by decoder monitor.
bool mStopDecodeThread;
// PR_TRUE when the decode thread run function has finished, but the thread
// True when the decode thread run function has finished, but the thread
// has not necessarily been shut down yet. This can happen if we switch
// from COMPLETED state to SEEKING before the state machine has a chance
// to run in the COMPLETED state and shutdown the decode thread.
// Synchronised by the decoder monitor.
bool mDecodeThreadIdle;
// PR_FALSE while audio thread should be running. Accessed state machine
// False while audio thread should be running. Accessed state machine
// and audio threads. Syncrhonised by decoder monitor.
bool mStopAudioThread;
// If this is PR_TRUE while we're in buffering mode, we can exit early,
// If this is true while we're in buffering mode, we can exit early,
// as it's likely we may be able to playback. This happens when we enter
// buffering mode soon after the decode starts, because the decode-ahead
// ran fast enough to exhaust all data while the download is starting up.
// Synchronised via decoder monitor.
bool mQuickBuffering;
// PR_TRUE if the shared state machine thread is currently running this
// True if the shared state machine thread is currently running this
// state machine.
bool mIsRunning;
// PR_TRUE if we should run the state machine again once the current
// True if we should run the state machine again once the current
// state machine run has finished.
bool mRunAgain;
// PR_TRUE if we've dispatched an event to run the state machine. It's
// True if we've dispatched an event to run the state machine. It's
// imperative that we don't dispatch multiple events to run the state
// machine at the same time, as our code assume all events are synchronous.
// If we dispatch multiple events, the second event can run while the
// first is shutting down a thread, causing inconsistent state.
bool mDispatchedRunEvent;
// PR_TRUE if the decode thread has gone filled its buffers and is now
// True if the decode thread has gone filled its buffers and is now
// waiting to be awakened before it continues decoding. Synchronized
// by the decoder monitor.
bool mDecodeThreadWaiting;
// true is we are decoding a realtime stream, like a camera stream
// True is we are decoding a realtime stream, like a camera stream
bool mRealTime;
PRUint32 mBufferingWait;

View File

@ -121,7 +121,7 @@ void nsMediaCacheFlusher::Init()
nsCOMPtr<nsIObserverService> observerService =
mozilla::services::GetObserverService();
if (observerService) {
observerService->AddObserver(gMediaCacheFlusher, NS_PRIVATE_BROWSING_SWITCH_TOPIC, PR_TRUE);
observerService->AddObserver(gMediaCacheFlusher, NS_PRIVATE_BROWSING_SWITCH_TOPIC, true);
}
}
@ -135,9 +135,9 @@ public:
nsMediaCache() : mNextResourceID(1),
mReentrantMonitor("nsMediaCache.mReentrantMonitor"),
mFD(nsnull), mFDCurrentPos(0), mUpdateQueued(PR_FALSE)
mFD(nsnull), mFDCurrentPos(0), mUpdateQueued(false)
#ifdef DEBUG
, mInUpdate(PR_FALSE)
, mInUpdate(false)
#endif
{
MOZ_COUNT_CTOR(nsMediaCache);
@ -781,10 +781,10 @@ nsMediaCache::BlockIsReusable(PRInt32 aBlockIndex)
nsMediaCacheStream* stream = block->mOwners[i].mStream;
if (stream->mPinCount > 0 ||
stream->mStreamOffset/BLOCK_SIZE == block->mOwners[i].mStreamBlock) {
return PR_FALSE;
return false;
}
}
return PR_TRUE;
return true;
}
void
@ -1092,9 +1092,9 @@ nsMediaCache::Update()
{
ReentrantMonitorAutoEnter mon(mReentrantMonitor);
mUpdateQueued = PR_FALSE;
mUpdateQueued = false;
#ifdef DEBUG
mInUpdate = PR_TRUE;
mInUpdate = true;
#endif
PRInt32 maxBlocks = GetMaxBlocks();
@ -1264,31 +1264,31 @@ nsMediaCache::Update()
// We're reading to try to catch up to where the current stream
// reader wants to be. Better not stop.
LOG(PR_LOG_DEBUG, ("Stream %p catching up", stream));
enableReading = PR_TRUE;
enableReading = true;
} else if (desiredOffset < stream->mStreamOffset + BLOCK_SIZE) {
// The stream reader is waiting for us, or nearly so. Better feed it.
LOG(PR_LOG_DEBUG, ("Stream %p feeding reader", stream));
enableReading = PR_TRUE;
enableReading = true;
} else if (!stream->mIsSeekable &&
nonSeekableReadaheadBlockCount >= maxBlocks*NONSEEKABLE_READAHEAD_MAX) {
// This stream is not seekable and there are already too many blocks
// being cached for readahead for nonseekable streams (which we can't
// free). So stop reading ahead now.
LOG(PR_LOG_DEBUG, ("Stream %p throttling non-seekable readahead", stream));
enableReading = PR_FALSE;
enableReading = false;
} else if (mIndex.Length() > PRUint32(maxBlocks)) {
// We're in the process of bringing the cache size back to the
// desired limit, so don't bring in more data yet
LOG(PR_LOG_DEBUG, ("Stream %p throttling to reduce cache size", stream));
enableReading = PR_FALSE;
enableReading = false;
} else if (freeBlockCount > 0 || mIndex.Length() < PRUint32(maxBlocks)) {
// Free blocks in the cache, so keep reading
LOG(PR_LOG_DEBUG, ("Stream %p reading since there are free blocks", stream));
enableReading = PR_TRUE;
enableReading = true;
} else if (latestNextUse <= TimeDuration(0)) {
// No reusable blocks, so can't read anything
LOG(PR_LOG_DEBUG, ("Stream %p throttling due to no reusable blocks", stream));
enableReading = PR_FALSE;
enableReading = false;
} else {
// Read ahead if the data we expect to read is more valuable than
// the least valuable block in the main part of the cache
@ -1306,7 +1306,7 @@ nsMediaCache::Update()
other->mChannelOffset/BLOCK_SIZE == desiredOffset/BLOCK_SIZE) {
// This block is already going to be read by the other stream.
// So don't try to read it from this stream as well.
enableReading = PR_FALSE;
enableReading = false;
LOG(PR_LOG_DEBUG, ("Stream %p waiting on same block (%lld) from stream %p",
stream, desiredOffset/BLOCK_SIZE, other));
break;
@ -1330,7 +1330,7 @@ nsMediaCache::Update()
}
}
#ifdef DEBUG
mInUpdate = PR_FALSE;
mInUpdate = false;
#endif
}
@ -1350,19 +1350,19 @@ nsMediaCache::Update()
(long long)stream->mChannelOffset, stream->mCacheSuspended));
rv = stream->mClient->CacheClientSeek(stream->mChannelOffset,
stream->mCacheSuspended);
stream->mCacheSuspended = PR_FALSE;
stream->mCacheSuspended = false;
break;
case RESUME:
LOG(PR_LOG_DEBUG, ("Stream %p Resumed", stream));
rv = stream->mClient->CacheClientResume();
stream->mCacheSuspended = PR_FALSE;
stream->mCacheSuspended = false;
break;
case SUSPEND:
LOG(PR_LOG_DEBUG, ("Stream %p Suspended", stream));
rv = stream->mClient->CacheClientSuspend();
stream->mCacheSuspended = PR_TRUE;
stream->mCacheSuspended = true;
break;
default:
@ -1402,7 +1402,7 @@ nsMediaCache::QueueUpdate()
"Queuing an update while we're in an update");
if (mUpdateQueued)
return;
mUpdateQueued = PR_TRUE;
mUpdateQueued = true;
nsCOMPtr<nsIRunnable> event = new UpdateEvent();
NS_DispatchToMainThread(event);
}
@ -1748,7 +1748,7 @@ nsMediaCacheStream::UpdatePrincipal(nsIPrincipal* aPrincipal)
// Principals are not equal, so set mPrincipal to a null principal.
mPrincipal = do_CreateInstance("@mozilla.org/nullprincipal;1");
mUsingNullPrincipal = PR_TRUE;
mUsingNullPrincipal = true;
}
void
@ -1782,7 +1782,7 @@ nsMediaCacheStream::NotifyDataReceived(PRInt64 aSize, const char* aData,
if (blockOffset == 0) {
// We've just started filling this buffer so now is a good time
// to clear this flag.
mMetadataInPartialBlockBuffer = PR_FALSE;
mMetadataInPartialBlockBuffer = false;
}
memcpy(reinterpret_cast<char*>(mPartialBlockBuffer) + blockOffset,
data, chunkSize);
@ -1900,7 +1900,7 @@ nsMediaCacheStream::CloseInternal(ReentrantMonitorAutoEnter& aReentrantMonitor)
if (mClosed)
return;
mClosed = PR_TRUE;
mClosed = true;
gMediaCache->ReleaseStreamBlocks(this);
// Wake up any blocked readers
aReentrantMonitor.NotifyAll();
@ -1953,7 +1953,7 @@ nsMediaCacheStream::IsDataCachedToEndOfStream(PRInt64 aOffset)
{
ReentrantMonitorAutoEnter mon(gMediaCache->GetReentrantMonitor());
if (mStreamLength < 0)
return PR_FALSE;
return false;
return GetCachedDataEndInternal(aOffset) >= mStreamLength;
}
@ -2008,7 +2008,7 @@ nsMediaCacheStream::GetNextCachedDataInternal(PRInt64 aOffset)
// Count the number of uncached blocks
bool hasPartialBlock = (mChannelOffset % BLOCK_SIZE) != 0;
PRUint32 blockIndex = startBlockIndex + 1;
while (PR_TRUE) {
while (true) {
if ((hasPartialBlock && blockIndex == channelBlockIndex) ||
(blockIndex < mBlocks.Length() && mBlocks[blockIndex] != -1)) {
// We at the incoming channel block, which has has data in it,
@ -2129,7 +2129,7 @@ nsMediaCacheStream::Read(char* aBuffer, PRUint32 aCount, PRUint32* aBytes)
memcpy(aBuffer + count,
reinterpret_cast<char*>(mPartialBlockBuffer) + offsetInStreamBlock, bytes);
if (mCurrentMode == MODE_METADATA) {
mMetadataInPartialBlockBuffer = PR_TRUE;
mMetadataInPartialBlockBuffer = true;
}
gMediaCache->NoteBlockUsage(this, cacheBlock, mCurrentMode, TimeStamp::Now());
} else {
@ -2243,7 +2243,7 @@ nsMediaCacheStream::Init()
if (!gMediaCache)
return NS_ERROR_FAILURE;
gMediaCache->OpenStream(this);
mInitialized = PR_TRUE;
mInitialized = true;
return NS_OK;
}
@ -2267,7 +2267,7 @@ nsMediaCacheStream::InitAsClone(nsMediaCacheStream* aOriginal)
// Cloned streams are initially suspended, since there is no channel open
// initially for a clone.
mCacheSuspended = PR_TRUE;
mCacheSuspended = true;
for (PRUint32 i = 0; i < aOriginal->mBlocks.Length(); ++i) {
PRInt32 cacheBlockIndex = aOriginal->mBlocks[i];

View File

@ -226,14 +226,14 @@ public:
// aClient provides the underlying transport that cache will use to read
// data for this stream.
nsMediaCacheStream(nsMediaChannelStream* aClient)
: mClient(aClient), mResourceID(0), mInitialized(PR_FALSE),
mIsSeekable(PR_FALSE), mCacheSuspended(PR_FALSE),
mUsingNullPrincipal(PR_FALSE),
: mClient(aClient), mResourceID(0), mInitialized(false),
mIsSeekable(false), mCacheSuspended(false),
mUsingNullPrincipal(false),
mChannelOffset(0), mStreamLength(-1),
mStreamOffset(0), mPlaybackBytesPerSecond(10000),
mPinCount(0), mCurrentMode(MODE_PLAYBACK),
mMetadataInPartialBlockBuffer(PR_FALSE),
mClosed(PR_FALSE) {}
mMetadataInPartialBlockBuffer(false),
mClosed(false) {}
~nsMediaCacheStream();
// Set up this stream with the cache. Can fail on OOM. One
@ -452,11 +452,11 @@ private:
// The last reported seekability state for the underlying channel
bool mIsSeekable;
// true if the cache has suspended our channel because the cache is
// True if the cache has suspended our channel because the cache is
// full and the priority of the data that would be received is lower
// than the priority of the data already in the cache
bool mCacheSuspended;
// true if mPrincipal is a null principal because we saw data from
// True if mPrincipal is a null principal because we saw data from
// multiple origins
bool mUsingNullPrincipal;
// The offset where the next data from the channel will arrive
@ -488,7 +488,7 @@ private:
PRUint32 mPinCount;
// The last reported read mode
ReadMode mCurrentMode;
// true if some data in mPartialBlockBuffer has been read as metadata
// True if some data in mPartialBlockBuffer has been read as metadata
bool mMetadataInPartialBlockBuffer;
// Set to true when the stream has been closed either explicitly or
// due to an internal cache error

View File

@ -76,10 +76,10 @@ nsMediaDecoder::nsMediaDecoder() :
mRGBHeight(-1),
mVideoUpdateLock("nsMediaDecoder.mVideoUpdateLock"),
mFrameBufferLength(0),
mPinnedForSeek(PR_FALSE),
mSizeChanged(PR_FALSE),
mImageContainerSizeChanged(PR_FALSE),
mShuttingDown(PR_FALSE)
mPinnedForSeek(false),
mSizeChanged(false),
mImageContainerSizeChanged(false),
mShuttingDown(false)
{
MOZ_COUNT_CTOR(nsMediaDecoder);
MediaMemoryReporter::AddMediaDecoder(this);
@ -94,7 +94,7 @@ nsMediaDecoder::~nsMediaDecoder()
bool nsMediaDecoder::Init(nsHTMLMediaElement* aElement)
{
mElement = aElement;
return PR_TRUE;
return true;
}
void nsMediaDecoder::Shutdown()
@ -131,11 +131,11 @@ void nsMediaDecoder::Invalidate()
// Get mImageContainerSizeChanged while holding the lock.
invalidateFrame = mImageContainerSizeChanged;
mImageContainerSizeChanged = PR_FALSE;
mImageContainerSizeChanged = false;
if (mSizeChanged) {
mElement->UpdateMediaSize(nsIntSize(mRGBWidth, mRGBHeight));
mSizeChanged = PR_FALSE;
mSizeChanged = false;
if (frame) {
nsPresContext* presContext = frame->PresContext();
@ -162,7 +162,7 @@ void nsMediaDecoder::Invalidate()
static void ProgressCallback(nsITimer* aTimer, void* aClosure)
{
nsMediaDecoder* decoder = static_cast<nsMediaDecoder*>(aClosure);
decoder->Progress(PR_TRUE);
decoder->Progress(true);
}
void nsMediaDecoder::Progress(bool aTimer)
@ -221,7 +221,7 @@ void nsMediaDecoder::FireTimeUpdate()
{
if (!mElement)
return;
mElement->FireTimeUpdate(PR_TRUE);
mElement->FireTimeUpdate(true);
}
void nsMediaDecoder::SetVideoData(const gfxIntSize& aSize,
@ -233,7 +233,7 @@ void nsMediaDecoder::SetVideoData(const gfxIntSize& aSize,
if (mRGBWidth != aSize.width || mRGBHeight != aSize.height) {
mRGBWidth = aSize.width;
mRGBHeight = aSize.height;
mSizeChanged = PR_TRUE;
mSizeChanged = true;
}
if (mImageContainer && aImage) {
gfxIntSize oldFrameSize = mImageContainer->GetCurrentSize();
@ -246,7 +246,7 @@ void nsMediaDecoder::SetVideoData(const gfxIntSize& aSize,
mImageContainer->SetCurrentImage(aImage);
gfxIntSize newFrameSize = mImageContainer->GetCurrentSize();
if (oldFrameSize != newFrameSize) {
mImageContainerSizeChanged = PR_TRUE;
mImageContainerSizeChanged = true;
}
}
@ -265,7 +265,7 @@ void nsMediaDecoder::PinForSeek()
if (!stream || mPinnedForSeek) {
return;
}
mPinnedForSeek = PR_TRUE;
mPinnedForSeek = true;
stream->Pin();
}
@ -275,7 +275,7 @@ void nsMediaDecoder::UnpinForSeek()
if (!stream || !mPinnedForSeek) {
return;
}
mPinnedForSeek = PR_FALSE;
mPinnedForSeek = false;
stream->Unpin();
}
@ -283,7 +283,7 @@ bool nsMediaDecoder::CanPlayThrough()
{
Statistics stats = GetStatistics();
if (!stats.mDownloadRateReliable || !stats.mPlaybackRateReliable) {
return PR_FALSE;
return false;
}
PRInt64 bytesToDownload = stats.mTotalBytes - stats.mDownloadPosition;
PRInt64 bytesToPlayback = stats.mTotalBytes - stats.mPlaybackPosition;
@ -293,7 +293,7 @@ bool nsMediaDecoder::CanPlayThrough()
if (timeToDownload > timeToPlay) {
// Estimated time to download is greater than the estimated time to play.
// We probably can't play through without having to stop to buffer.
return PR_FALSE;
return false;
}
// Estimated time to download is less than the estimated time to play.

View File

@ -86,7 +86,7 @@ public:
virtual nsMediaDecoder* Clone() = 0;
// Perform any initialization required for the decoder.
// Return PR_TRUE on successful initialisation, PR_FALSE
// Return true on successful initialisation, false
// on failure.
virtual bool Init(nsHTMLMediaElement* aElement);
@ -150,11 +150,11 @@ public:
// Called if the media file encounters a network error.
virtual void NetworkError() = 0;
// Call from any thread safely. Return PR_TRUE if we are currently
// Call from any thread safely. Return true if we are currently
// seeking in the media resource.
virtual bool IsSeeking() const = 0;
// Return PR_TRUE if the decoder has reached the end of playback.
// Return true if the decoder has reached the end of playback.
// Call in the main thread only.
virtual bool IsEnded() const = 0;
@ -290,7 +290,7 @@ public:
// Set a flag indicating whether seeking is supported
virtual void SetSeekable(bool aSeekable) = 0;
// Return PR_TRUE if seeking is supported.
// Return true if seeking is supported.
virtual bool IsSeekable() = 0;
// Return the time ranges that can be seeked into.
@ -304,7 +304,7 @@ public:
virtual void Invalidate();
// Fire progress events if needed according to the time and byte
// constraints outlined in the specification. aTimer is PR_TRUE
// constraints outlined in the specification. aTimer is true
// if the method is called as a result of the progress timer rather
// than the result of downloaded data.
virtual void Progress(bool aTimer);
@ -346,7 +346,7 @@ public:
// media element when it is restored from the bfcache, or when we need
// to stop throttling the download. Call on the main thread only.
// The download will only actually resume once as many Resume calls
// have been made as Suspend calls. When aForceBuffering is PR_TRUE,
// have been made as Suspend calls. When aForceBuffering is true,
// we force the decoder to go into buffering state before resuming
// playback.
virtual void Resume(bool aForceBuffering) = 0;
@ -386,7 +386,7 @@ public:
// are buffered and playable.
virtual nsresult GetBuffered(nsTimeRanges* aBuffered) = 0;
// Returns PR_TRUE if we can play the entire media through without stopping
// Returns true if we can play the entire media through without stopping
// to buffer, given the current download and playback rates.
bool CanPlayThrough();
@ -459,17 +459,17 @@ protected:
// The framebuffer size to use for audioavailable events.
PRUint32 mFrameBufferLength;
// PR_TRUE when our media stream has been pinned. We pin the stream
// True when our media stream has been pinned. We pin the stream
// while seeking.
bool mPinnedForSeek;
// Set to PR_TRUE when the video width, height or pixel aspect ratio is
// Set to true when the video width, height or pixel aspect ratio is
// changed by SetVideoData(). The next call to Invalidate() will recalculate
// and update the intrinsic size on the element, request a frame reflow and
// then reset this flag.
bool mSizeChanged;
// Set to PR_TRUE in SetVideoData() if the new image has a different size
// Set to true in SetVideoData() if the new image has a different size
// than the current image. The image size is also affected by transforms
// so this can be true even if mSizeChanged is false, for example when
// zooming. The next call to Invalidate() will call nsIFrame::Invalidate

View File

@ -71,11 +71,11 @@ nsMediaChannelStream::nsMediaChannelStream(nsMediaDecoder* aDecoder,
nsIChannel* aChannel, nsIURI* aURI)
: nsMediaStream(aDecoder, aChannel, aURI),
mOffset(0), mSuspendCount(0),
mReopenOnError(PR_FALSE), mIgnoreClose(PR_FALSE),
mReopenOnError(false), mIgnoreClose(false),
mCacheStream(this),
mLock("nsMediaChannelStream.mLock"),
mCacheSuspendCount(0),
mIgnoreResume(PR_FALSE)
mIgnoreResume(false)
{
}
@ -229,7 +229,7 @@ nsMediaChannelStream::OnStartRequest(nsIRequest* aRequest)
mDecoder->SetDuration(duration);
}
} else {
mDecoder->SetInfinite(PR_TRUE);
mDecoder->SetInfinite(true);
}
}
@ -241,7 +241,7 @@ nsMediaChannelStream::OnStartRequest(nsIRequest* aRequest)
mOffset = 0;
// The server claimed it supported range requests. It lied.
acceptsRanges = PR_FALSE;
acceptsRanges = false;
} else if (mOffset == 0 &&
(responseStatus == HTTP_OK_CODE ||
responseStatus == HTTP_PARTIAL_RESPONSE_CODE)) {
@ -263,7 +263,7 @@ nsMediaChannelStream::OnStartRequest(nsIRequest* aRequest)
responseStatus == HTTP_PARTIAL_RESPONSE_CODE || acceptsRanges;
if (seekable) {
mDecoder->SetInfinite(PR_FALSE);
mDecoder->SetInfinite(false);
}
}
mDecoder->SetSeekable(seekable);
@ -274,7 +274,7 @@ nsMediaChannelStream::OnStartRequest(nsIRequest* aRequest)
bool fromCache = false;
rv = cc->IsFromCache(&fromCache);
if (NS_SUCCEEDED(rv) && !fromCache) {
cc->SetCacheAsFile(PR_TRUE);
cc->SetCacheAsFile(true);
}
}
@ -283,19 +283,19 @@ nsMediaChannelStream::OnStartRequest(nsIRequest* aRequest)
mChannelStatistics.Start(TimeStamp::Now());
}
mReopenOnError = PR_FALSE;
mIgnoreClose = PR_FALSE;
mReopenOnError = false;
mIgnoreClose = false;
if (mSuspendCount > 0) {
// Re-suspend the channel if it needs to be suspended
// No need to call PossiblySuspend here since the channel is
// definitely in the right state for us in OneStartRequest.
mChannel->Suspend();
mIgnoreResume = PR_FALSE;
mIgnoreResume = false;
}
// Fires an initial progress event and sets up the stall counter so stall events
// fire if no download occurs within the required time frame.
mDecoder->Progress(PR_FALSE);
mDecoder->Progress(false);
return NS_OK;
}
@ -324,7 +324,7 @@ nsMediaChannelStream::OnStopRequest(nsIRequest* aRequest, nsresult aStatus)
// If the stream did close normally, then if the server is seekable we'll
// just seek to the end of the resource and get an HTTP 416 error because
// there's nothing there, so this isn't bad.
nsresult rv = CacheClientSeek(mOffset, PR_FALSE);
nsresult rv = CacheClientSeek(mOffset, false);
if (NS_SUCCEEDED(rv))
return rv;
// If the reopen/reseek fails, just fall through and treat this
@ -338,7 +338,7 @@ nsMediaChannelStream::OnStopRequest(nsIRequest* aRequest, nsresult aStatus)
// requests owned by video documents to ensure the load group fires
// OnStopRequest when restoring from session history.
if (mLoadInBackground) {
mLoadInBackground = PR_FALSE;
mLoadInBackground = false;
nsLoadFlags loadFlags;
DebugOnly<nsresult> rv = mChannel->GetLoadFlags(&loadFlags);
@ -470,7 +470,7 @@ nsresult nsMediaChannelStream::OpenChannel(nsIStreamListener** aStreamListener)
new nsCORSListenerProxy(mListener,
element->NodePrincipal(),
mChannel,
PR_FALSE,
false,
&rv);
listener = crossSiteListener;
NS_ENSURE_TRUE(crossSiteListener, NS_ERROR_OUT_OF_MEMORY);
@ -503,7 +503,7 @@ void nsMediaChannelStream::SetupChannelHeaders()
nsCAutoString rangeString("bytes=");
rangeString.AppendInt(mOffset);
rangeString.Append("-");
hc->SetRequestHeader(NS_LITERAL_CSTRING("Range"), rangeString, PR_FALSE);
hc->SetRequestHeader(NS_LITERAL_CSTRING("Range"), rangeString, false);
// Send Accept header for video and audio types only (Bug 489071)
NS_ASSERTION(NS_IsMainThread(), "Don't call on non-main thread");
@ -632,7 +632,7 @@ void nsMediaChannelStream::Suspend(bool aCloseImmediately)
if (mChannel) {
if (aCloseImmediately && mCacheStream.IsSeekable()) {
// Kill off our channel right now, but don't tell anyone about it.
mIgnoreClose = PR_TRUE;
mIgnoreClose = true;
CloseChannel();
element->DownloadSuspended();
} else if (mSuspendCount == 0) {
@ -670,7 +670,7 @@ void nsMediaChannelStream::Resume()
}
// if an error occurs after Resume, assume it's because the server
// timed out the connection and we should reopen it.
mReopenOnError = PR_TRUE;
mReopenOnError = true;
PossiblyResume();
element->DownloadResumed();
} else {
@ -683,7 +683,7 @@ void nsMediaChannelStream::Resume()
if (totalLength < 0 || mOffset < totalLength) {
// There is (or may be) data to read at mOffset, so start reading it.
// Need to recreate the channel.
CacheClientSeek(mOffset, PR_FALSE);
CacheClientSeek(mOffset, false);
}
element->DownloadResumed();
}
@ -792,7 +792,7 @@ nsMediaChannelStream::CacheClientSuspend()
MutexAutoLock lock(mLock);
++mCacheSuspendCount;
}
Suspend(PR_FALSE);
Suspend(false);
mDecoder->NotifySuspendedStatusChanged();
return NS_OK;
@ -888,9 +888,9 @@ nsMediaChannelStream::PossiblySuspend()
nsresult rv = mChannel->IsPending(&isPending);
if (NS_SUCCEEDED(rv) && isPending) {
mChannel->Suspend();
mIgnoreResume = PR_FALSE;
mIgnoreResume = false;
} else {
mIgnoreResume = PR_TRUE;
mIgnoreResume = true;
}
}
@ -900,7 +900,7 @@ nsMediaChannelStream::PossiblyResume()
if (!mIgnoreResume) {
mChannel->Resume();
} else {
mIgnoreResume = PR_FALSE;
mIgnoreResume = false;
}
}
@ -940,7 +940,7 @@ public:
virtual double GetDownloadRate(bool* aIsReliable)
{
// The data's all already here
*aIsReliable = PR_TRUE;
*aIsReliable = true;
return 100*1024*1024; // arbitray, use 100MB/s
}
virtual PRInt64 GetLength() { return mSize; }
@ -1196,7 +1196,7 @@ nsMediaStream::Create(nsMediaDecoder* aDecoder, nsIChannel* aChannel)
void nsMediaStream::MoveLoadsToBackground() {
NS_ASSERTION(!mLoadInBackground, "Why are you calling this more than once?");
mLoadInBackground = PR_TRUE;
mLoadInBackground = true;
if (!mChannel) {
// No channel, resource is probably already loaded.
return;

View File

@ -80,19 +80,19 @@ public:
mLastStartTime = TimeStamp();
mAccumulatedTime = TimeDuration(0);
mAccumulatedBytes = 0;
mIsStarted = PR_FALSE;
mIsStarted = false;
}
void Start(TimeStamp aNow) {
if (mIsStarted)
return;
mLastStartTime = aNow;
mIsStarted = PR_TRUE;
mIsStarted = true;
}
void Stop(TimeStamp aNow) {
if (!mIsStarted)
return;
mAccumulatedTime += aNow - mLastStartTime;
mIsStarted = PR_FALSE;
mIsStarted = false;
}
void AddBytes(PRInt64 aBytes) {
if (!mIsStarted) {
@ -304,7 +304,7 @@ protected:
mDecoder(aDecoder),
mChannel(aChannel),
mURI(aURI),
mLoadInBackground(PR_FALSE)
mLoadInBackground(false)
{
MOZ_COUNT_CTOR(nsMediaStream);
}
@ -327,7 +327,7 @@ protected:
// main thread only.
nsCOMPtr<nsIURI> mURI;
// PR_TRUE if MoveLoadsToBackground() has been called, i.e. the load event
// True if MoveLoadsToBackground() has been called, i.e. the load event
// has been fired, and all channel loads will be in the background.
bool mLoadInBackground;
};
@ -378,7 +378,7 @@ public:
virtual void Suspend(bool aCloseImmediately);
virtual void Resume();
virtual already_AddRefed<nsIPrincipal> GetCurrentPrincipal();
// Return PR_TRUE if the stream has been closed.
// Return true if the stream has been closed.
bool IsClosed() const { return mCacheStream.IsClosed(); }
virtual nsMediaStream* CloneData(nsMediaDecoder* aDecoder);
virtual nsresult ReadFromCache(char* aBuffer, PRInt64 aOffset, PRUint32 aCount);
@ -480,7 +480,7 @@ protected:
nsChannelStatistics mChannelStatistics;
PRUint32 mCacheSuspendCount;
// PR_TRUE if we couldn't suspend the stream and we therefore don't want
// True if we couldn't suspend the stream and we therefore don't want
// to resume later. This is usually due to the channel not being in the
// isPending state at the time of the suspend request.
bool mIgnoreResume;

View File

@ -63,7 +63,7 @@ nsOggCodecState::Create(ogg_page* aPage)
} else if (aPage->body_len > 8 && memcmp(aPage->body, "fishead\0", 8) == 0) {
codecState = new nsSkeletonState(aPage);
} else {
codecState = new nsOggCodecState(aPage, PR_FALSE);
codecState = new nsOggCodecState(aPage, false);
}
return codecState->nsOggCodecState::Init() ? codecState.forget() : nsnull;
}
@ -164,7 +164,8 @@ ogg_packet* nsOggCodecState::PacketOut() {
nsresult nsOggCodecState::PageIn(ogg_page* aPage) {
if (!mActive)
return NS_OK;
NS_ASSERTION(ogg_page_serialno(aPage) == mSerial, "Page must be for this stream!");
NS_ASSERTION(static_cast<PRUint32>(ogg_page_serialno(aPage)) == mSerial,
"Page must be for this stream!");
if (ogg_stream_pagein(&mState, aPage) == -1)
return NS_ERROR_FAILURE;
int r;
@ -184,7 +185,7 @@ nsresult nsOggCodecState::PageIn(ogg_page* aPage) {
nsresult nsOggCodecState::PacketOutUntilGranulepos(bool& aFoundGranulepos) {
int r;
aFoundGranulepos = PR_FALSE;
aFoundGranulepos = false;
// Extract packets from the sync state until either no more packets
// come out, or we get a data packet with non -1 granulepos.
do {
@ -212,7 +213,7 @@ nsresult nsOggCodecState::PacketOutUntilGranulepos(bool& aFoundGranulepos) {
}
nsTheoraState::nsTheoraState(ogg_page* aBosPage) :
nsOggCodecState(aBosPage, PR_TRUE),
nsOggCodecState(aBosPage, true),
mSetup(0),
mCtx(0),
mPixelAspectRatio(0)
@ -232,7 +233,7 @@ nsTheoraState::~nsTheoraState() {
bool nsTheoraState::Init() {
if (!mActive)
return PR_FALSE;
return false;
PRInt64 n = mInfo.aspect_numerator;
PRInt64 d = mInfo.aspect_denominator;
@ -245,15 +246,15 @@ bool nsTheoraState::Init() {
nsIntSize frame(mInfo.frame_width, mInfo.frame_height);
nsIntRect picture(mInfo.pic_x, mInfo.pic_y, mInfo.pic_width, mInfo.pic_height);
if (!nsVideoInfo::ValidateVideoRegion(frame, picture, frame)) {
return mActive = PR_FALSE;
return mActive = false;
}
mCtx = th_decode_alloc(&mInfo, mSetup);
if (mCtx == NULL) {
return mActive = PR_FALSE;
return mActive = false;
}
return PR_TRUE;
return true;
}
bool
@ -283,11 +284,11 @@ nsTheoraState::DecodeHeader(ogg_packet* aPacket)
if (ret < 0 || mPacketCount > 3) {
// We've received an error, or the first three packets weren't valid
// header packets, assume bad input, and don't activate the bitstream.
mDoneReadingHeaders = PR_TRUE;
mDoneReadingHeaders = true;
} else if (ret > 0 && isSetupHeader && mPacketCount == 3) {
// Successfully read the three header packets.
mDoneReadingHeaders = PR_TRUE;
mActive = PR_TRUE;
mDoneReadingHeaders = true;
mActive = true;
}
return mDoneReadingHeaders;
}
@ -306,8 +307,8 @@ nsTheoraState::IsHeader(ogg_packet* aPacket) {
}
# define TH_VERSION_CHECK(_info,_maj,_min,_sub) \
((_info)->version_major>(_maj)||(_info)->version_major==(_maj)&& \
((_info)->version_minor>(_min)||(_info)->version_minor==(_min)&& \
(((_info)->version_major>(_maj)||(_info)->version_major==(_maj))&& \
(((_info)->version_minor>(_min)||(_info)->version_minor==(_min))&& \
(_info)->version_subminor>=(_sub)))
PRInt64 nsTheoraState::Time(th_info* aInfo, PRInt64 aGranulepos)
@ -507,7 +508,7 @@ nsresult nsVorbisState::Reset()
}
nsVorbisState::nsVorbisState(ogg_page* aBosPage) :
nsOggCodecState(aBosPage, PR_TRUE),
nsOggCodecState(aBosPage, true),
mPrevVorbisBlockSize(0),
mGranulepos(0)
{
@ -553,12 +554,12 @@ bool nsVorbisState::DecodeHeader(ogg_packet* aPacket) {
if (ret < 0 || mPacketCount > 3) {
// We've received an error, or the first three packets weren't valid
// header packets, assume bad input, and deactivate the bitstream.
mDoneReadingHeaders = PR_TRUE;
mActive = PR_FALSE;
mDoneReadingHeaders = true;
mActive = false;
} else if (ret == 0 && isSetupHeader && mPacketCount == 3) {
// Successfully read the three header packets.
// The bitstream remains active.
mDoneReadingHeaders = PR_TRUE;
mDoneReadingHeaders = true;
}
return mDoneReadingHeaders;
}
@ -566,12 +567,12 @@ bool nsVorbisState::DecodeHeader(ogg_packet* aPacket) {
bool nsVorbisState::Init()
{
if (!mActive)
return PR_FALSE;
return false;
int ret = vorbis_synthesis_init(&mDsp, &mInfo);
if (ret != 0) {
NS_WARNING("vorbis_synthesis_init() failed initializing vorbis bitstream");
return mActive = PR_FALSE;
return mActive = false;
}
ret = vorbis_block_init(&mDsp, &mBlock);
if (ret != 0) {
@ -579,9 +580,9 @@ bool nsVorbisState::Init()
if (mActive) {
vorbis_dsp_clear(&mDsp);
}
return mActive = PR_FALSE;
return mActive = false;
}
return PR_TRUE;
return true;
}
PRInt64 nsVorbisState::Time(PRInt64 granulepos)
@ -611,7 +612,7 @@ nsVorbisState::IsHeader(ogg_packet* aPacket)
// Any packet with its first bit set cannot be a data packet, it's a
// (possibly invalid) header packet.
// See: http://xiph.org/vorbis/doc/Vorbis_I_spec.html#x1-610004.2.1
return aPacket->bytes > 0 ? (aPacket->packet[0] & 0x1) : PR_FALSE;
return aPacket->bytes > 0 ? (aPacket->packet[0] & 0x1) : false;
}
nsresult
@ -756,7 +757,7 @@ nsresult nsVorbisState::ReconstructVorbisGranulepos()
nsSkeletonState::nsSkeletonState(ogg_page* aBosPage)
: nsOggCodecState(aBosPage, PR_TRUE),
: nsOggCodecState(aBosPage, true),
mVersion(0),
mPresentationTime(0),
mLength(0)
@ -863,7 +864,7 @@ bool nsSkeletonState::DecodeIndex(ogg_packet* aPacket)
NS_ASSERTION(aPacket->bytes >= SKELETON_4_0_MIN_INDEX_LEN,
"Index must be at least minimum size");
if (!mActive) {
return PR_FALSE;
return false;
}
PRUint32 serialno = LEUint32(aPacket->packet + INDEX_SERIALNO_OFFSET);
@ -877,14 +878,14 @@ bool nsSkeletonState::DecodeIndex(ogg_packet* aPacket)
if (timeDenom == 0) {
LOG(PR_LOG_DEBUG, ("Ogg Skeleton Index packet for stream %u has 0 "
"timestamp denominator.", serialno));
return (mActive = PR_FALSE);
return (mActive = false);
}
// Extract the start time.
n = LEInt64(p + INDEX_FIRST_NUMER_OFFSET);
PRInt64 t;
if (!MulOverflow(n, USECS_PER_S, t)) {
return (mActive = PR_FALSE);
return (mActive = false);
} else {
startTime = t / timeDenom;
}
@ -892,7 +893,7 @@ bool nsSkeletonState::DecodeIndex(ogg_packet* aPacket)
// Extract the end time.
n = LEInt64(p + INDEX_LAST_NUMER_OFFSET);
if (!MulOverflow(n, USECS_PER_S, t)) {
return (mActive = PR_FALSE);
return (mActive = false);
} else {
endTime = t / timeDenom;
}
@ -903,7 +904,7 @@ bool nsSkeletonState::DecodeIndex(ogg_packet* aPacket)
if (!MulOverflow(numKeyPoints, MIN_KEY_POINT_SIZE, minPacketSize) ||
!AddOverflow(INDEX_KEYPOINT_OFFSET, minPacketSize, minPacketSize))
{
return (mActive = PR_FALSE);
return (mActive = false);
}
PRInt64 sizeofIndex = aPacket->bytes - INDEX_KEYPOINT_OFFSET;
@ -922,7 +923,7 @@ bool nsSkeletonState::DecodeIndex(ogg_packet* aPacket)
"(%lld) in index packet for stream %u.",
numKeyPoints,
serialno));
return (mActive = PR_FALSE);
return (mActive = false);
}
nsAutoPtr<nsKeyFrameIndex> keyPoints(new nsKeyFrameIndex(startTime, endTime));
@ -942,18 +943,18 @@ bool nsSkeletonState::DecodeIndex(ogg_packet* aPacket)
offset > mLength ||
offset < 0)
{
return (mActive = PR_FALSE);
return (mActive = false);
}
p = ReadVariableLengthInt(p, limit, delta);
if (!AddOverflow(time, delta, time) ||
time > endTime ||
time < startTime)
{
return (mActive = PR_FALSE);
return (mActive = false);
}
PRInt64 timeUsecs = 0;
if (!MulOverflow(time, USECS_PER_S, timeUsecs))
return mActive = PR_FALSE;
return mActive = false;
timeUsecs /= timeDenom;
keyPoints->Add(offset, timeUsecs);
numKeyPointsRead++;
@ -966,7 +967,7 @@ bool nsSkeletonState::DecodeIndex(ogg_packet* aPacket)
LOG(PR_LOG_DEBUG, ("Loaded %d keypoints for Skeleton on stream %u",
keyPointsRead, serialno));
return PR_TRUE;
return true;
}
nsresult nsSkeletonState::IndexedSeekTargetForTrack(PRUint32 aSerialno,
@ -1082,8 +1083,8 @@ bool nsSkeletonState::DecodeHeader(ogg_packet* aPacket)
aPacket->bytes < SKELETON_4_0_MIN_HEADER_LEN)
{
// We can only care to parse Skeleton version 4.0+.
mActive = PR_FALSE;
return mDoneReadingHeaders = PR_TRUE;
mActive = false;
return mDoneReadingHeaders = true;
}
// Extract the segment length.
@ -1095,19 +1096,19 @@ bool nsSkeletonState::DecodeHeader(ogg_packet* aPacket)
bool init = mIndex.Init();
if (!init) {
NS_WARNING("Failed to initialize Ogg skeleton serialno-to-index map");
mActive = PR_FALSE;
return mDoneReadingHeaders = PR_TRUE;
mActive = false;
return mDoneReadingHeaders = true;
}
mActive = PR_TRUE;
mActive = true;
} else if (IsSkeletonIndex(aPacket) && mVersion >= SKELETON_VERSION(4,0)) {
if (!DecodeIndex(aPacket)) {
// Failed to parse index, or invalid/hostile index. DecodeIndex() will
// have deactivated the track.
return mDoneReadingHeaders = PR_TRUE;
return mDoneReadingHeaders = true;
}
} else if (aPacket->e_o_s) {
mDoneReadingHeaders = PR_TRUE;
mDoneReadingHeaders = true;
}
return mDoneReadingHeaders;
}

View File

@ -111,9 +111,9 @@ public:
virtual CodecType GetType() { return TYPE_UNKNOWN; }
// Reads a header packet. Returns PR_TRUE when last header has been read.
// Reads a header packet. Returns true when last header has been read.
virtual bool DecodeHeader(ogg_packet* aPacket) {
return (mDoneReadingHeaders = PR_TRUE);
return (mDoneReadingHeaders = true);
}
// Returns the end time that a granulepos represents.
@ -125,22 +125,22 @@ public:
// Initializes the codec state.
virtual bool Init();
// Returns PR_TRUE when this bitstream has finished reading all its
// Returns true when this bitstream has finished reading all its
// header packets.
bool DoneReadingHeaders() { return mDoneReadingHeaders; }
// Deactivates the bitstream. Only the primary video and audio bitstreams
// should be active.
void Deactivate() {
mActive = PR_FALSE;
mDoneReadingHeaders = PR_TRUE;
mActive = false;
mDoneReadingHeaders = true;
Reset();
}
// Resets decoding state.
virtual nsresult Reset();
// Returns PR_TRUE if the nsOggCodecState thinks this packet is a header
// Returns true if the nsOggCodecState thinks this packet is a header
// packet. Note this does not verify the validity of the header packet,
// it just guarantees that the packet is marked as a header packet (i.e.
// it is definintely not a data packet). Do not use this to identify
@ -183,13 +183,13 @@ public:
// Is the bitstream active; whether we're decoding and playing this bitstream.
bool mActive;
// PR_TRUE when all headers packets have been read.
// True when all headers packets have been read.
bool mDoneReadingHeaders;
protected:
// Constructs a new nsOggCodecState. aActive denotes whether the stream is
// active. For streams of unsupported or unknown types, aActive should be
// PR_FALSE.
// false.
nsOggCodecState(ogg_page* aBosPage, bool aActive);
// Deallocates all packets stored in mUnstamped, and clears the array.
@ -331,7 +331,7 @@ public:
bool Init() { return true; }
bool IsHeader(ogg_packet* aPacket) { return true; }
// Return PR_TRUE if the given time (in milliseconds) is within
// Return true if the given time (in milliseconds) is within
// the presentation time defined in the skeleton track.
bool IsPresentable(PRInt64 aTime) { return aTime >= mPresentationTime; }
@ -391,7 +391,7 @@ public:
private:
// Decodes an index packet. Returns PR_FALSE on failure.
// Decodes an index packet. Returns false on failure.
bool DecodeIndex(ogg_packet* aPacket);
// Gets the keypoint you must seek to in order to get the keyframe required

View File

@ -191,7 +191,7 @@ nsresult nsOggReader::ReadMetadata(nsVideoInfo* aInfo)
// We've encountered a non Beginning Of Stream page. No more BOS pages
// can follow in this Ogg segment, so there will be no other bitstreams
// in the Ogg (unless it's invalid).
readAllBOS = PR_TRUE;
readAllBOS = true;
} else if (!mCodecStates.Get(serial, nsnull)) {
// We've not encountered a stream with this serial number before. Create
// an nsOggCodecState to demux it, and map that to the nsOggCodecState
@ -262,7 +262,7 @@ nsresult nsOggReader::ReadMetadata(nsVideoInfo* aInfo)
mTheoraState->mInfo.frame_height);
if (nsVideoInfo::ValidateVideoRegion(frameSize, picture, displaySize)) {
// Video track's frame sizes will not overflow. Activate the video track.
mInfo.mHasVideo = PR_TRUE;
mInfo.mHasVideo = true;
mInfo.mDisplay = displaySize;
mPicture = picture;
@ -277,7 +277,7 @@ nsresult nsOggReader::ReadMetadata(nsVideoInfo* aInfo)
}
if (mVorbisState && ReadHeaders(mVorbisState)) {
mInfo.mHasAudio = PR_TRUE;
mInfo.mHasAudio = true;
mInfo.mAudioRate = mVorbisState->mInfo.rate;
mInfo.mAudioChannels = mVorbisState->mInfo.channels;
// Copy Vorbis info data for time computations on other threads.
@ -399,7 +399,7 @@ bool nsOggReader::DecodeAudioData()
} while (packet && mVorbisState->IsHeader(packet));
if (!packet) {
mAudioQueue.Finish();
return PR_FALSE;
return false;
}
NS_ASSERTION(packet && packet->granulepos != -1,
@ -411,10 +411,10 @@ bool nsOggReader::DecodeAudioData()
// file while trying to decode, so inform the audio queue that there'll
// be no more samples.
mAudioQueue.Finish();
return PR_FALSE;
return false;
}
return PR_TRUE;
return true;
}
nsresult nsOggReader::DecodeTheora(ogg_packet* aPacket, PRInt64 aTimeThreshold)
@ -502,7 +502,7 @@ bool nsOggReader::DecodeVideoFrame(bool &aKeyframeSkip,
} while (packet && mTheoraState->IsHeader(packet));
if (!packet) {
mVideoQueue.Finish();
return PR_FALSE;
return false;
}
nsAutoReleasePacket autoRelease(packet);
@ -514,11 +514,11 @@ bool nsOggReader::DecodeVideoFrame(bool &aKeyframeSkip,
if (!aKeyframeSkip ||
(th_packet_iskeyframe(packet) && frameEndTime >= aTimeThreshold))
{
aKeyframeSkip = PR_FALSE;
aKeyframeSkip = false;
nsresult res = DecodeTheora(packet, aTimeThreshold);
decoded++;
if (NS_FAILED(res)) {
return PR_FALSE;
return false;
}
}
@ -526,10 +526,10 @@ bool nsOggReader::DecodeVideoFrame(bool &aKeyframeSkip,
// We've encountered an end of bitstream packet. Inform the queue that
// there will be no more frames.
mVideoQueue.Finish();
return PR_FALSE;
return false;
}
return PR_TRUE;
return true;
}
PRInt64 nsOggReader::ReadOggPage(ogg_page* aPage)
@ -643,7 +643,7 @@ PRInt64 nsOggReader::RangeEndTime(PRInt64 aEndOffset)
nsMediaStream* stream = mDecoder->GetCurrentStream();
NS_ENSURE_TRUE(stream != nsnull, -1);
PRInt64 position = stream->Tell();
PRInt64 endTime = RangeEndTime(0, aEndOffset, PR_FALSE);
PRInt64 endTime = RangeEndTime(0, aEndOffset, false);
nsresult res = stream->Seek(nsISeekableStream::NS_SEEK_SET, position);
NS_ENSURE_SUCCESS(res, -1);
return endTime;
@ -669,7 +669,7 @@ PRInt64 nsOggReader::RangeEndTime(PRInt64 aStartOffset,
PRUint32 checksumAfterSeek = 0;
PRUint32 prevChecksumAfterSeek = 0;
bool mustBackOff = false;
while (PR_TRUE) {
while (true) {
ogg_page page;
int ret = ogg_sync_pageseek(&sync.mState, &page);
if (ret == 0) {
@ -680,7 +680,7 @@ PRInt64 nsOggReader::RangeEndTime(PRInt64 aStartOffset,
// We have encountered a page before, or we're at the end of file.
break;
}
mustBackOff = PR_FALSE;
mustBackOff = false;
prevChecksumAfterSeek = checksumAfterSeek;
checksumAfterSeek = 0;
ogg_sync_reset(&sync.mState);
@ -739,7 +739,7 @@ PRInt64 nsOggReader::RangeEndTime(PRInt64 aStartOffset,
// after the last backoff/seek. Since we've already scanned after this
// page and failed to find an end time, we may as well backoff again and
// try to find an end time from an earlier page.
mustBackOff = PR_TRUE;
mustBackOff = true;
continue;
}
@ -895,7 +895,7 @@ nsOggReader::IndexedSeekResult nsOggReader::SeekToKeyframeUsingIndex(PRInt64 aTa
int skippedBytes = 0;
PageSyncResult syncres = PageSync(stream,
&mOggState,
PR_FALSE,
false,
mPageOffset,
stream->GetLength(),
&page,
@ -970,7 +970,7 @@ nsresult nsOggReader::SeekInBufferedRange(PRInt64 aTarget,
keyframeTime,
aStartTime,
aEndTime,
PR_FALSE);
false);
res = SeekBisection(keyframeTime, k, SEEK_FUZZ_USECS);
}
return res;
@ -1002,7 +1002,7 @@ nsresult nsOggReader::SeekInUnbuffered(PRInt64 aTarget,
PRInt64 seekTarget = NS_MAX(aStartTime, aTarget - keyframeOffsetMs);
// Minimize the bisection search space using the known timestamps from the
// buffered ranges.
SeekRange k = SelectSeekRange(aRanges, seekTarget, aStartTime, aEndTime, PR_FALSE);
SeekRange k = SelectSeekRange(aRanges, seekTarget, aStartTime, aEndTime, false);
return SeekBisection(seekTarget, k, SEEK_FUZZ_USECS);
}
@ -1044,7 +1044,7 @@ nsresult nsOggReader::Seek(PRInt64 aTarget,
NS_ENSURE_SUCCESS(res,res);
// Figure out if the seek target lies in a buffered range.
SeekRange r = SelectSeekRange(ranges, aTarget, aStartTime, aEndTime, PR_TRUE);
SeekRange r = SelectSeekRange(ranges, aTarget, aStartTime, aEndTime, true);
if (!r.IsNull()) {
// We know the buffered range in which the seek target lies, do a
@ -1171,7 +1171,7 @@ nsresult nsOggReader::SeekBisection(PRInt64 aTarget,
// Seek via bisection search. Loop until we find the offset where the page
// before the offset is before the seek target, and the page after the offset
// is after the seek target.
while (PR_TRUE) {
while (true) {
ogg_int64_t duration = 0;
double target = 0;
ogg_int64_t interval = 0;
@ -1186,7 +1186,7 @@ nsresult nsOggReader::SeekBisection(PRInt64 aTarget,
// Guess where we should bisect to, based on the bit rate and the time
// remaining in the interval. Loop until we can determine the time at
// the guess offset.
while (PR_TRUE) {
while (true) {
// Discard any previously buffered packets/pages.
if (NS_FAILED(ResetDecode())) {
@ -1229,8 +1229,8 @@ nsresult nsOggReader::SeekBisection(PRInt64 aTarget,
backsteps = NS_MIN(backsteps + 1, maxBackStep);
// We reset mustBackoff. If we still need to backoff further, it will
// be set to PR_TRUE again.
mustBackoff = PR_FALSE;
// be set to true again.
mustBackoff = false;
} else {
backsteps = 0;
}
@ -1254,7 +1254,7 @@ nsresult nsOggReader::SeekBisection(PRInt64 aTarget,
// make a bisection decision based on our location in the media.
PageSyncResult res = PageSync(stream,
&mOggState,
PR_FALSE,
false,
guess,
endOffset,
&page,
@ -1271,7 +1271,7 @@ nsresult nsOggReader::SeekBisection(PRInt64 aTarget,
// Our guess was too close to the end, we've ended up reading the end
// page. Backoff exponentially from the end point, in case the last
// page/frame/sample is huge.
mustBackoff = PR_TRUE;
mustBackoff = true;
SEEK_LOG(PR_LOG_DEBUG, ("Hit the end of range, backing off"));
continue;
}
@ -1336,7 +1336,7 @@ nsresult nsOggReader::SeekBisection(PRInt64 aTarget,
// We should backoff; cause the guess to back off from the end, so
// that we've got more room to capture.
mustBackoff = PR_TRUE;
mustBackoff = true;
continue;
}
@ -1438,7 +1438,7 @@ nsresult nsOggReader::GetBuffered(nsTimeRanges* aBuffered, PRInt64 aStartTime)
PRInt32 discard;
PageSyncResult res = PageSync(stream,
&sync.mState,
PR_TRUE,
true,
startOffset,
endOffset,
&page,
@ -1484,7 +1484,7 @@ nsresult nsOggReader::GetBuffered(nsTimeRanges* aBuffered, PRInt64 aStartTime)
if (startTime != -1) {
// We were able to find a start time for that range, see if we can
// find an end time.
PRInt64 endTime = RangeEndTime(startOffset, endOffset, PR_TRUE);
PRInt64 endTime = RangeEndTime(startOffset, endOffset, true);
if (endTime != -1) {
aBuffered->Add((startTime - aStartTime) / static_cast<double>(USECS_PER_S),
(endTime - aStartTime) / static_cast<double>(USECS_PER_S));
@ -1500,9 +1500,9 @@ bool nsOggReader::IsKnownStream(PRUint32 aSerial)
for (PRUint32 i = 0; i < mKnownStreams.Length(); i++) {
PRUint32 serial = mKnownStreams[i];
if (serial == aSerial) {
return PR_TRUE;
return true;
}
}
return PR_FALSE;
return false;
}

View File

@ -166,7 +166,7 @@ private:
// aEndOffset. If bool aCachedDataOnly is true, then we'll only read
// from data which is cached in the media cached, otherwise we'll do
// regular blocking reads from the media stream. If bool aCachedDataOnly
// is PR_TRUE, this can safely be called on the main thread, otherwise it
// is true, this can safely be called on the main thread, otherwise it
// must be called on the state machine thread.
PRInt64 RangeEndTime(PRInt64 aStartOffset,
PRInt64 aEndOffset,
@ -199,9 +199,9 @@ private:
// Returns the range in which you should perform a seek bisection if
// you wish to seek to aTarget usecs, given the known (buffered) byte ranges
// in aRanges. If aExact is PR_TRUE, we only return an exact copy of a
// in aRanges. If aExact is true, we only return an exact copy of a
// range in which aTarget lies, or a null range if aTarget isn't contained
// in any of the (buffered) ranges. Otherwise, when aExact is PR_FALSE,
// in any of the (buffered) ranges. Otherwise, when aExact is false,
// we'll construct the smallest possible range we can, based on the times
// and byte offsets known in aRanges. We can then use this to minimize our
// bisection's search space when the target isn't in a known buffered range.
@ -229,7 +229,7 @@ private:
// Reads and decodes header packets for aState, until either header decode
// fails, or is complete. Initializes the codec state before returning.
// Returns PR_TRUE if reading headers and initializtion of the stream
// Returns true if reading headers and initializtion of the stream
// succeeds.
bool ReadHeaders(nsOggCodecState* aState);

View File

@ -40,5 +40,5 @@
nsDecoderStateMachine* nsRawDecoder::CreateStateMachine()
{
return new nsBuiltinDecoderStateMachine(this, new nsRawReader(this), PR_TRUE);
return new nsBuiltinDecoderStateMachine(this, new nsRawReader(this), true);
}

View File

@ -106,8 +106,8 @@ nsresult nsRawReader::ReadMetadata(nsVideoInfo* aInfo)
return NS_ERROR_FAILURE;
}
mInfo.mHasVideo = PR_TRUE;
mInfo.mHasAudio = PR_FALSE;
mInfo.mHasVideo = true;
mInfo.mHasAudio = false;
mInfo.mDisplay = display;
mFrameRate = static_cast<float>(mMetadata.framerateNumerator) /
@ -145,11 +145,11 @@ nsresult nsRawReader::ReadMetadata(nsVideoInfo* aInfo)
{
NS_ASSERTION(mDecoder->OnStateMachineThread() || mDecoder->OnDecodeThread(),
"Should be on state machine thread or decode thread.");
return PR_FALSE;
return false;
}
// Helper method that either reads until it gets aLength bytes
// or returns PR_FALSE
// or returns false
bool nsRawReader::ReadFromStream(nsMediaStream *aStream, PRUint8* aBuf,
PRUint32 aLength)
{
@ -158,17 +158,17 @@ bool nsRawReader::ReadFromStream(nsMediaStream *aStream, PRUint8* aBuf,
nsresult rv;
rv = aStream->Read(reinterpret_cast<char*>(aBuf), aLength, &bytesRead);
NS_ENSURE_SUCCESS(rv, PR_FALSE);
NS_ENSURE_SUCCESS(rv, false);
if (bytesRead == 0) {
return PR_FALSE;
return false;
}
aLength -= bytesRead;
aBuf += bytesRead;
}
return PR_TRUE;
return true;
}
bool nsRawReader::DecodeVideoFrame(bool &aKeyframeSkip,
@ -183,7 +183,7 @@ bool nsRawReader::DecodeVideoFrame(bool &aKeyframeSkip,
nsMediaDecoder::AutoNotifyDecoded autoNotify(mDecoder, parsed, decoded);
if (!mFrameSize)
return PR_FALSE; // Metadata read failed. We should refuse to play.
return false; // Metadata read failed. We should refuse to play.
PRInt64 currentFrameTime = USECS_PER_S * mCurrentFrame / mFrameRate;
PRUint32 length = mFrameSize - sizeof(nsRawPacketHeader);
@ -200,11 +200,11 @@ bool nsRawReader::DecodeVideoFrame(bool &aKeyframeSkip,
if (!(ReadFromStream(stream, reinterpret_cast<PRUint8*>(&header),
sizeof(header))) ||
!(header.packetID == 0xFF && header.codecID == RAW_ID /* "YUV" */)) {
return PR_FALSE;
return false;
}
if (!ReadFromStream(stream, buffer, length)) {
return PR_FALSE;
return false;
}
parsed++;
@ -244,14 +244,14 @@ bool nsRawReader::DecodeVideoFrame(bool &aKeyframeSkip,
-1,
mPicture);
if (!v)
return PR_FALSE;
return false;
mVideoQueue.Push(v);
mCurrentFrame++;
decoded++;
currentFrameTime += USECS_PER_S / mFrameRate;
return PR_TRUE;
return true;
}
nsresult nsRawReader::Seek(PRInt64 aTime, PRInt64 aStartTime, PRInt64 aEndTime, PRInt64 aCurrentTime)

View File

@ -58,12 +58,12 @@ public:
virtual bool HasAudio()
{
return PR_FALSE;
return false;
}
virtual bool HasVideo()
{
return PR_TRUE;
return true;
}
virtual nsresult ReadMetadata(nsVideoInfo* aInfo);

View File

@ -159,8 +159,8 @@ nsresult nsWaveReader::ReadMetadata(nsVideoInfo* aInfo)
return NS_ERROR_FAILURE;
}
mInfo.mHasAudio = PR_TRUE;
mInfo.mHasVideo = PR_FALSE;
mInfo.mHasAudio = true;
mInfo.mHasVideo = false;
mInfo.mAudioRate = mSampleRate;
mInfo.mAudioChannels = mChannels;
@ -196,7 +196,7 @@ bool nsWaveReader::DecodeAudioData()
if (!ReadAll(dataBuffer, readSize)) {
mAudioQueue.Finish();
return PR_FALSE;
return false;
}
// convert data to samples
@ -236,7 +236,7 @@ bool nsWaveReader::DecodeAudioData()
sampleBuffer.forget(),
mChannels));
return PR_TRUE;
return true;
}
bool nsWaveReader::DecodeVideoFrame(bool &aKeyframeSkip,
@ -244,7 +244,7 @@ bool nsWaveReader::DecodeVideoFrame(bool &aKeyframeSkip,
{
NS_ASSERTION(mDecoder->OnDecodeThread(), "Should be on decode thread.");
return PR_FALSE;
return false;
}
nsresult nsWaveReader::Seek(PRInt64 aTarget, PRInt64 aStartTime, PRInt64 aEndTime, PRInt64 aCurrentTime)
@ -298,10 +298,10 @@ nsWaveReader::ReadAll(char* aBuf, PRInt64 aSize, PRInt64* aBytesRead)
PRUint32 read = 0;
if (NS_FAILED(mDecoder->GetCurrentStream()->Read(aBuf + got, PRUint32(aSize - got), &read))) {
NS_WARNING("Stream read failed");
return PR_FALSE;
return false;
}
if (read == 0) {
return PR_FALSE;
return false;
}
mDecoder->NotifyBytesConsumed(read);
got += read;
@ -309,7 +309,7 @@ nsWaveReader::ReadAll(char* aBuf, PRInt64 aSize, PRInt64* aBytesRead)
*aBytesRead = got;
}
} while (got != aSize);
return PR_TRUE;
return true;
}
bool
@ -322,13 +322,13 @@ nsWaveReader::LoadRIFFChunk()
"LoadRIFFChunk called when stream in invalid state");
if (!ReadAll(riffHeader, sizeof(riffHeader))) {
return PR_FALSE;
return false;
}
PR_STATIC_ASSERT(sizeof(PRUint32) * 2 <= RIFF_INITIAL_SIZE);
if (ReadUint32BE(&p) != RIFF_CHUNK_MAGIC) {
NS_WARNING("Stream data not in RIFF format");
return PR_FALSE;
return false;
}
// Skip over RIFF size field.
@ -336,10 +336,10 @@ nsWaveReader::LoadRIFFChunk()
if (ReadUint32BE(&p) != WAVE_CHUNK_MAGIC) {
NS_WARNING("Expected WAVE chunk");
return PR_FALSE;
return false;
}
return PR_TRUE;
return true;
}
bool
@ -354,7 +354,7 @@ nsWaveReader::ScanForwardUntil(PRUint32 aWantedChunk, PRUint32* aChunkSize)
const char* p = chunkHeader;
if (!ReadAll(chunkHeader, sizeof(chunkHeader))) {
return PR_FALSE;
return false;
}
PR_STATIC_ASSERT(sizeof(PRUint32) * 2 <= CHUNK_HEADER_SIZE);
@ -363,7 +363,7 @@ nsWaveReader::ScanForwardUntil(PRUint32 aWantedChunk, PRUint32* aChunkSize)
if (magic == aWantedChunk) {
*aChunkSize = chunkSize;
return PR_TRUE;
return true;
}
// RIFF chunks are two-byte aligned, so round up if necessary.
@ -375,7 +375,7 @@ nsWaveReader::ScanForwardUntil(PRUint32 aWantedChunk, PRUint32* aChunkSize)
while (chunkSize > 0) {
PRUint32 size = NS_MIN(chunkSize, MAX_CHUNK_SIZE);
if (!ReadAll(chunk.get(), size)) {
return PR_FALSE;
return false;
}
chunkSize -= size;
}
@ -396,11 +396,11 @@ nsWaveReader::LoadFormatChunk()
// The "format" chunk may not directly follow the "riff" chunk, so skip
// over any intermediate chunks.
if (!ScanForwardUntil(FRMT_CHUNK_MAGIC, &fmtSize)) {
return PR_FALSE;
return false;
}
if (!ReadAll(waveFormat, sizeof(waveFormat))) {
return PR_FALSE;
return false;
}
PR_STATIC_ASSERT(sizeof(PRUint16) +
@ -411,7 +411,7 @@ nsWaveReader::LoadFormatChunk()
sizeof(PRUint16) <= sizeof(waveFormat));
if (ReadUint16LE(&p) != WAVE_FORMAT_ENCODING_PCM) {
NS_WARNING("WAVE is not uncompressed PCM, compressed encodings are not supported");
return PR_FALSE;
return false;
}
channels = ReadUint16LE(&p);
@ -434,14 +434,14 @@ nsWaveReader::LoadFormatChunk()
const char* p = extLength;
if (!ReadAll(extLength, sizeof(extLength))) {
return PR_FALSE;
return false;
}
PR_STATIC_ASSERT(sizeof(PRUint16) <= sizeof(extLength));
PRUint16 extra = ReadUint16LE(&p);
if (fmtSize - (WAVE_FORMAT_CHUNK_SIZE + 2) != extra) {
NS_WARNING("Invalid extended format chunk size");
return PR_FALSE;
return false;
}
extra += extra % 2;
@ -449,7 +449,7 @@ nsWaveReader::LoadFormatChunk()
PR_STATIC_ASSERT(PR_UINT16_MAX + (PR_UINT16_MAX % 2) < UINT_MAX / sizeof(char));
nsAutoArrayPtr<char> chunkExtension(new char[extra]);
if (!ReadAll(chunkExtension.get(), extra)) {
return PR_FALSE;
return false;
}
}
}
@ -466,7 +466,7 @@ nsWaveReader::LoadFormatChunk()
(frameSize != 1 && frameSize != 2 && frameSize != 4) ||
(sampleFormat != 8 && sampleFormat != 16)) {
NS_WARNING("Invalid WAVE metadata");
return PR_FALSE;
return false;
}
ReentrantMonitorAutoEnter monitor(mDecoder->GetReentrantMonitor());
@ -478,7 +478,7 @@ nsWaveReader::LoadFormatChunk()
} else {
mSampleFormat = nsAudioStream::FORMAT_S16_LE;
}
return PR_TRUE;
return true;
}
bool
@ -492,19 +492,19 @@ nsWaveReader::FindDataOffset()
// over any intermediate chunks.
PRUint32 length;
if (!ScanForwardUntil(DATA_CHUNK_MAGIC, &length)) {
return PR_FALSE;
return false;
}
PRInt64 offset = mDecoder->GetCurrentStream()->Tell();
if (offset <= 0 || offset > PR_UINT32_MAX) {
NS_WARNING("PCM data offset out of range");
return PR_FALSE;
return false;
}
ReentrantMonitorAutoEnter monitor(mDecoder->GetReentrantMonitor());
mWaveLength = length;
mWavePCMOffset = PRUint32(offset);
return PR_TRUE;
return true;
}
double

View File

@ -55,12 +55,12 @@ public:
virtual bool HasAudio()
{
return PR_TRUE;
return true;
}
virtual bool HasVideo()
{
return PR_FALSE;
return false;
}
virtual nsresult ReadMetadata(nsVideoInfo* aInfo);

View File

@ -97,7 +97,7 @@ static int webm_read(void *aBuffer, size_t aLength, void *aUserData)
PRUint32 bytes = 0;
rv = stream->Read(p, aLength, &bytes);
if (bytes == 0) {
eof = PR_TRUE;
eof = true;
break;
}
decoder->NotifyBytesConsumed(bytes);
@ -136,8 +136,8 @@ nsWebMReader::nsWebMReader(nsBuiltinDecoder* aDecoder)
mAudioTrack(0),
mAudioStartUsec(-1),
mAudioFrames(0),
mHasVideo(PR_FALSE),
mHasAudio(PR_FALSE)
mHasVideo(false),
mHasAudio(false)
{
MOZ_COUNT_CTOR(nsWebMReader);
}
@ -235,8 +235,8 @@ nsresult nsWebMReader::ReadMetadata(nsVideoInfo* aInfo)
return NS_ERROR_FAILURE;
}
mInfo.mHasAudio = PR_FALSE;
mInfo.mHasVideo = PR_FALSE;
mInfo.mHasAudio = false;
mInfo.mHasVideo = false;
for (PRUint32 track = 0; track < ntracks; ++track) {
int id = nestegg_track_codec_id(mContext, track);
if (id == -1) {
@ -281,8 +281,8 @@ nsresult nsWebMReader::ReadMetadata(nsVideoInfo* aInfo)
}
mVideoTrack = track;
mHasVideo = PR_TRUE;
mInfo.mHasVideo = PR_TRUE;
mHasVideo = true;
mInfo.mHasVideo = true;
mInfo.mDisplay = displaySize;
mPicture = pictureRect;
@ -336,8 +336,8 @@ nsresult nsWebMReader::ReadMetadata(nsVideoInfo* aInfo)
}
mAudioTrack = track;
mHasAudio = PR_TRUE;
mInfo.mHasAudio = PR_TRUE;
mHasAudio = true;
mInfo.mHasAudio = true;
// Get the Vorbis header data
unsigned int nheaders = 0;
@ -357,7 +357,7 @@ nsresult nsWebMReader::ReadMetadata(nsVideoInfo* aInfo)
return NS_ERROR_FAILURE;
}
ogg_packet opacket = InitOggPacket(data, length, header == 0, PR_FALSE, 0);
ogg_packet opacket = InitOggPacket(data, length, header == 0, false, 0);
r = vorbis_synthesis_headerin(&mVorbisInfo,
&mVorbisComment,
@ -415,13 +415,13 @@ bool nsWebMReader::DecodeAudioPacket(nestegg_packet* aPacket, PRInt64 aOffset)
unsigned int count = 0;
r = nestegg_packet_count(aPacket, &count);
if (r == -1) {
return PR_FALSE;
return false;
}
uint64_t tstamp = 0;
r = nestegg_packet_tstamp(aPacket, &tstamp);
if (r == -1) {
return PR_FALSE;
return false;
}
const PRUint32 rate = mVorbisDsp.vi->rate;
@ -438,16 +438,16 @@ bool nsWebMReader::DecodeAudioPacket(nestegg_packet* aPacket, PRInt64 aOffset)
PRInt64 tstamp_frames = 0;
if (!UsecsToFrames(tstamp_usecs, rate, tstamp_frames)) {
NS_WARNING("Int overflow converting WebM timestamp to frames");
return PR_FALSE;
return false;
}
PRInt64 decoded_frames = 0;
if (!UsecsToFrames(mAudioStartUsec, rate, decoded_frames)) {
NS_WARNING("Int overflow converting WebM start time to frames");
return PR_FALSE;
return false;
}
if (!AddOverflow(decoded_frames, mAudioFrames, decoded_frames)) {
NS_WARNING("Int overflow adding decoded_frames");
return PR_FALSE;
return false;
}
if (tstamp_frames > decoded_frames) {
#ifdef DEBUG
@ -467,18 +467,18 @@ bool nsWebMReader::DecodeAudioPacket(nestegg_packet* aPacket, PRInt64 aOffset)
size_t length;
r = nestegg_packet_data(aPacket, i, &data, &length);
if (r == -1) {
return PR_FALSE;
return false;
}
ogg_packet opacket = InitOggPacket(data, length, PR_FALSE, PR_FALSE, -1);
ogg_packet opacket = InitOggPacket(data, length, false, false, -1);
if (vorbis_synthesis(&mVorbisBlock, &opacket) != 0) {
return PR_FALSE;
return false;
}
if (vorbis_synthesis_blockin(&mVorbisDsp,
&mVorbisBlock) != 0) {
return PR_FALSE;
return false;
}
VorbisPCMValue** pcm = 0;
@ -495,12 +495,12 @@ bool nsWebMReader::DecodeAudioPacket(nestegg_packet* aPacket, PRInt64 aOffset)
PRInt64 duration = 0;
if (!FramesToUsecs(frames, rate, duration)) {
NS_WARNING("Int overflow converting WebM audio duration");
return PR_FALSE;
return false;
}
PRInt64 total_duration = 0;
if (!FramesToUsecs(total_frames, rate, total_duration)) {
NS_WARNING("Int overflow converting WebM audio total_duration");
return PR_FALSE;
return false;
}
PRInt64 time = tstamp_usecs + total_duration;
@ -513,12 +513,12 @@ bool nsWebMReader::DecodeAudioPacket(nestegg_packet* aPacket, PRInt64 aOffset)
mChannels));
mAudioFrames += frames;
if (vorbis_synthesis_read(&mVorbisDsp, frames) != 0) {
return PR_FALSE;
return false;
}
}
}
return PR_TRUE;
return true;
}
nsReturnRef<NesteggPacketHolder> nsWebMReader::NextPacket(TrackType aTrackType)
@ -578,7 +578,7 @@ nsReturnRef<NesteggPacketHolder> nsWebMReader::NextPacket(TrackType aTrackType)
if (hasType && ourTrack == track) {
break;
}
} while (PR_TRUE);
} while (true);
}
return holder.out();
@ -591,7 +591,7 @@ bool nsWebMReader::DecodeAudioData()
nsAutoRef<NesteggPacketHolder> holder(NextPacket(AUDIO));
if (!holder) {
mAudioQueue.Finish();
return PR_FALSE;
return false;
}
return DecodeAudioPacket(holder->mPacket, holder->mOffset);
@ -610,26 +610,26 @@ bool nsWebMReader::DecodeVideoFrame(bool &aKeyframeSkip,
nsAutoRef<NesteggPacketHolder> holder(NextPacket(VIDEO));
if (!holder) {
mVideoQueue.Finish();
return PR_FALSE;
return false;
}
nestegg_packet* packet = holder->mPacket;
unsigned int track = 0;
int r = nestegg_packet_track(packet, &track);
if (r == -1) {
return PR_FALSE;
return false;
}
unsigned int count = 0;
r = nestegg_packet_count(packet, &count);
if (r == -1) {
return PR_FALSE;
return false;
}
uint64_t tstamp = 0;
r = nestegg_packet_tstamp(packet, &tstamp);
if (r == -1) {
return PR_FALSE;
return false;
}
// The end time of this frame is the start time of the next frame. Fetch
@ -642,7 +642,7 @@ bool nsWebMReader::DecodeVideoFrame(bool &aKeyframeSkip,
if (next_holder) {
r = nestegg_packet_tstamp(next_holder->mPacket, &next_tstamp);
if (r == -1) {
return PR_FALSE;
return false;
}
mVideoPackets.PushFront(next_holder.disown());
} else {
@ -651,7 +651,7 @@ bool nsWebMReader::DecodeVideoFrame(bool &aKeyframeSkip,
static_cast<nsBuiltinDecoderStateMachine*>(mDecoder->GetStateMachine());
PRInt64 endTime = s->GetEndMediaTime();
if (endTime == -1) {
return PR_FALSE;
return false;
}
next_tstamp = endTime * NS_PER_USEC;
}
@ -663,7 +663,7 @@ bool nsWebMReader::DecodeVideoFrame(bool &aKeyframeSkip,
size_t length;
r = nestegg_packet_data(packet, i, &data, &length);
if (r == -1) {
return PR_FALSE;
return false;
}
vpx_codec_stream_info_t si;
@ -677,11 +677,11 @@ bool nsWebMReader::DecodeVideoFrame(bool &aKeyframeSkip,
}
if (aKeyframeSkip && si.is_kf) {
aKeyframeSkip = PR_FALSE;
aKeyframeSkip = false;
}
if (vpx_codec_decode(&mVP8, data, length, NULL, 0)) {
return PR_FALSE;
return false;
}
// If the timestamp of the video frame is less than
@ -716,7 +716,8 @@ bool nsWebMReader::DecodeVideoFrame(bool &aKeyframeSkip,
b.mPlanes[2].mWidth = img->d_w >> img->x_chroma_shift;
nsIntRect picture = mPicture;
if (img->d_w != mInitialFrame.width || img->d_h != mInitialFrame.height) {
if (img->d_w != static_cast<PRUint32>(mInitialFrame.width) ||
img->d_h != static_cast<PRUint32>(mInitialFrame.height)) {
// Frame size is different from what the container reports. This is legal
// in WebM, and we will preserve the ratio of the crop rectangle as it
// was reported relative to the picture size reported by the container.
@ -736,7 +737,7 @@ bool nsWebMReader::DecodeVideoFrame(bool &aKeyframeSkip,
-1,
picture);
if (!v) {
return PR_FALSE;
return false;
}
parsed++;
decoded++;
@ -746,7 +747,7 @@ bool nsWebMReader::DecodeVideoFrame(bool &aKeyframeSkip,
}
}
return PR_TRUE;
return true;
}
nsresult nsWebMReader::Seek(PRInt64 aTarget, PRInt64 aStartTime, PRInt64 aEndTime,

View File

@ -179,8 +179,8 @@ private:
PRInt64 aGranulepos);
// Decode a nestegg packet of audio data. Push the audio data on the
// audio queue. Returns PR_TRUE when there's more audio to decode,
// PR_FALSE if the audio is finished, end of file has been reached,
// audio queue. Returns true when there's more audio to decode,
// false if the audio is finished, end of file has been reached,
// or an un-recoverable read error has occured. The reader's monitor
// must be held during this call. This function will free the packet
// so the caller must not use the packet after calling.

View File

@ -51,7 +51,7 @@
* http://www.w3.org/TR/DOM-Level-2-Style
*/
[builtinclass, scriptable, uuid(79b66107-f9d2-42ac-bc68-b558d79037ec)]
[builtinclass, scriptable, uuid(519ae4fa-0fee-4aaa-bcb9-34b503236801)]
interface nsIDOMCSS2Properties : nsISupports
{
attribute DOMString background;
@ -684,6 +684,18 @@ interface nsIDOMCSS2Properties : nsISupports
attribute DOMString MozTransformOrigin;
// raises(DOMException) on setting
attribute DOMString MozPerspective;
// raises(DOMException) on setting
attribute DOMString MozPerspectiveOrigin;
// raises(DOMException) on setting
attribute DOMString MozBackfaceVisibility;
// raises(DOMException) on setting
attribute DOMString MozTransformStyle;
// raises(DOMException) on setting
attribute DOMString MozWindowShadow;
// raises(DOMException) on setting

View File

@ -1366,18 +1366,6 @@ BasicLayerManager::PopGroupToSourceWithCachedSurface(gfxContext *aTarget, gfxCon
}
}
already_AddRefed<gfxASurface>
BasicLayerManager::PopGroupToSurface(gfxContext *aTarget, gfxContext *aPushed)
{
if (!aTarget)
return nsnull;
nsRefPtr<gfxASurface> current = aPushed->CurrentSurface();
NS_ASSERTION(!mCachedSurface.IsSurface(current), "Should never be popping cached surface here!");
nsRefPtr<gfxPattern> pat = aTarget->PopGroup();
current = pat->GetSurface();
return current.forget();
}
void
BasicLayerManager::BeginTransactionWithTarget(gfxContext* aTarget)
{
@ -1845,8 +1833,6 @@ BasicLayerManager::PaintLayer(gfxContext* aTarget,
aTarget->SetMatrix(transform);
} else {
aTarget->SetMatrix(gfxMatrix());
// Save so we can restore clipping after PushGroupForLayer changes it.
aTarget->Save();
}
const nsIntRegion& visibleRegion = aLayer->GetEffectiveVisibleRegion();
@ -1863,17 +1849,24 @@ BasicLayerManager::PaintLayer(gfxContext* aTarget,
// Try to annotate currentSurface with a region of pixels that have been
// (or will be) painted opaque, if no such region is currently set.
const nsIntRect& bounds = visibleRegion.GetBounds();
if (targetOpaqueRect.IsEmpty() && visibleRegion.GetNumRects() == 1 &&
(aLayer->GetContentFlags() & Layer::CONTENT_OPAQUE) &&
!transform.HasNonAxisAlignedTransform()) {
const nsIntRect& bounds = visibleRegion.GetBounds();
currentSurface->SetOpaqueRect(
aTarget->UserToDevice(gfxRect(bounds.x, bounds.y, bounds.width, bounds.height)));
pushedTargetOpaqueRect = PR_TRUE;
}
nsRefPtr<gfxContext> groupTarget;
if (needsGroup) {
nsRefPtr<gfxASurface> untransformedSurface;
if (!is2D) {
untransformedSurface =
gfxPlatform::GetPlatform()->CreateOffscreenSurface(gfxIntSize(bounds.width, bounds.height),
gfxASurface::CONTENT_COLOR_ALPHA);
untransformedSurface->SetDeviceOffset(gfxPoint(-bounds.x, -bounds.y));
groupTarget = new gfxContext(untransformedSurface);
} else if (needsGroup) {
groupTarget = PushGroupForLayer(aTarget, aLayer, aLayer->GetEffectiveVisibleRegion(),
&needsClipToVisibleRegion);
} else {
@ -1911,16 +1904,14 @@ BasicLayerManager::PaintLayer(gfxContext* aTarget,
if (is2D) {
PopGroupToSourceWithCachedSurface(aTarget, groupTarget);
} else {
nsRefPtr<gfxASurface> sourceSurface = PopGroupToSurface(aTarget, groupTarget);
aTarget->Restore();
NS_ABORT_IF_FALSE(sourceSurface, "PopGroup should always return a surface pattern");
gfxRect bounds = visibleRegion.GetBounds();
NS_ABORT_IF_FALSE(untransformedSurface,
"We should always allocate an untransformed surface with 3d transforms!");
gfxPoint offset;
bool dontBlit = needsClipToVisibleRegion || mTransactionIncomplete ||
aLayer->GetEffectiveOpacity() != 1.0f;
nsRefPtr<gfxASurface> result =
Transform3D(sourceSurface, aTarget, bounds,
Transform3D(untransformedSurface, aTarget, bounds,
effectiveTransform, offset, dontBlit);
blitComplete = !result;

View File

@ -172,7 +172,6 @@ public:
already_AddRefed<gfxContext> PushGroupWithCachedSurface(gfxContext *aTarget,
gfxASurface::gfxContentType aContent);
void PopGroupToSourceWithCachedSurface(gfxContext *aTarget, gfxContext *aPushed);
already_AddRefed<gfxASurface> PopGroupToSurface(gfxContext *aTarget, gfxContext *aPushed);
virtual bool IsCompositingCheap() { return false; }
virtual bool HasShadowManagerInternal() const { return false; }

View File

@ -1528,9 +1528,6 @@ WrapPreserve3DList(nsIFrame *aFrame, nsDisplayListBuilder *aBuilder, nsDisplayLi
if (childFrame->GetParent()->Preserves3DChildren()) {
switch (item->GetType()) {
case nsDisplayItem::TYPE_TRANSFORM: {
// The child transform frame should always preserve 3d. In the cases where preserve-3d is disabled
// such as clipping, this would be wrapped in a clip display object, and we wouldn't reach this point.
NS_ASSERTION(childFrame->Preserves3D(), "Child transform frame must preserve 3d!");
break;
}
case nsDisplayItem::TYPE_WRAP_LIST: {

View File

@ -273,8 +273,8 @@ include text-transform/reftest.list
# -moz-transform/
include transform/reftest.list
# 3d transforms - disabled currently
#include transform-3d/reftest.list
# 3d transforms
include transform-3d/reftest.list
# unicode/ (verify that we don't do expend effort doing unicode-aware case checks)
include unicode/reftest.list

View File

@ -352,12 +352,6 @@ nsCSSProps::LookupProperty(const nsACString& aProperty)
}
}
}
if (res == eCSSProperty_perspective || res == eCSSProperty_perspective_origin ||
res == eCSSProperty_backface_visibility || res == eCSSProperty_transform_style) {
return eCSSProperty_UNKNOWN;
}
return res;
}
@ -379,12 +373,6 @@ nsCSSProps::LookupProperty(const nsAString& aProperty)
}
}
}
if (res == eCSSProperty_perspective || res == eCSSProperty_perspective_origin ||
res == eCSSProperty_backface_visibility || res == eCSSProperty_transform_style) {
return eCSSProperty_UNKNOWN;
}
return res;
}

View File

@ -67,15 +67,6 @@ public:
NS_DECL_NSICSSDECLARATION
NS_IMETHOD GetMozPerspective(nsAString_internal&);
NS_IMETHOD SetMozPerspective(const nsAString_internal&);
NS_IMETHOD GetMozPerspectiveOrigin(nsAString_internal&);
NS_IMETHOD SetMozPerspectiveOrigin(const nsAString_internal&);
NS_IMETHOD GetMozBackfaceVisibility(nsAString_internal&);
NS_IMETHOD SetMozBackfaceVisibility(const nsAString_internal&);
NS_IMETHOD GetMozTransformStyle(nsAString_internal&);
NS_IMETHOD SetMozTransformStyle(const nsAString_internal&);
// Require subclasses to implement |GetParentRule|.
//NS_DECL_NSIDOMCSSSTYLEDECLARATION
NS_IMETHOD GetCssText(nsAString & aCssText);

View File

@ -193,14 +193,6 @@ print_array(const char *aName,
// catch if they do.
continue;
if (strcmp(p->propName, "-moz-perspective") == 0 ||
strcmp(p->propName, "-moz-perspective-origin") == 0 ||
strcmp(p->propName, "-moz-backface-visibility") == 0 ||
strcmp(p->propName, "-moz-transform-style") == 0) {
++j;
continue;
}
if (first)
first = 0;
else

View File

@ -981,6 +981,57 @@ var gCSSProperties = {
"border", "center red", "right diagonal",
"#00ffff bottom"]
},
"-moz-perspective-origin": {
domProp: "MozPerspectiveOrigin",
inherited: false,
type: CSS_TYPE_LONGHAND,
/* no subproperties */
prerequisites: { "width": "10px", "height": "10px", "display": "block"},
initial_values: [ "50% 50%", "center", "center center" ],
other_values: [ "25% 25%", "5px 5px", "20% 3em", "0 0", "0in 1in",
"top", "bottom","top left", "top right",
"top center", "center left", "center right",
"bottom left", "bottom right", "bottom center",
"20% center", "5px center", "13in bottom",
"left 50px", "right 13%", "center 40px",
"-moz-calc(20px)",
"-moz-calc(20px) 10px",
"10px -moz-calc(20px)",
"-moz-calc(20px) 25%",
"25% -moz-calc(20px)",
"-moz-calc(20px) -moz-calc(20px)",
"-moz-calc(20px + 1em) -moz-calc(20px / 2)",
"-moz-calc(20px + 50%) -moz-calc(50% - 10px)",
"-moz-calc(-20px) -moz-calc(-50%)",
"-moz-calc(-20%) -moz-calc(-50%)" ],
invalid_values: [ "red", "auto", "none", "0.5 0.5", "40px #0000ff",
"border", "center red", "right diagonal",
"#00ffff bottom"]
},
"-moz-perspective": {
domProp: "MozPerspective",
inherited: false,
type: CSS_TYPE_LONGHAND,
initial_values: [ "none", "0" ],
other_values: [ "1000px", "500.2px", "-100px", "-27.2em" ],
invalid_values: [ "pants", "200" ]
},
"-moz-backface-visibility": {
domProp: "MozBackfaceVisibility",
inherited: false,
type: CSS_TYPE_LONGHAND,
initial_values: [ "visible" ],
other_values: [ "hidden" ],
invalid_values: [ "collapse" ]
},
"-moz-transform-style": {
domProp: "MozTransformStyle",
inherited: false,
type: CSS_TYPE_LONGHAND,
initial_values: [ "flat" ],
other_values: [ "preserve-3d" ],
invalid_values: []
},
"-moz-user-focus": {
domProp: "MozUserFocus",
inherited: true,

View File

@ -80,6 +80,9 @@ var supported_properties = {
"-moz-transform-origin": [ test_length_pair_transition,
test_length_percent_pair_transition,
test_length_percent_pair_unclamped ],
"-moz-perspective-origin": [ test_length_pair_transition,
test_length_percent_pair_transition,
test_length_percent_pair_unclamped ],
"background-color": [ test_color_transition ],
"background-position": [ test_background_position_transition,
// FIXME: We don't currently test clamping,
@ -190,6 +193,7 @@ var supported_properties = {
"padding-top": [ test_length_transition, test_percent_transition,
test_length_percent_calc_transition,
test_length_clamped, test_percent_clamped ],
"-moz-perspective": [ test_length_transition ],
"right": [ test_length_transition, test_percent_transition,
test_length_percent_calc_transition,
test_length_unclamped, test_percent_unclamped ],
@ -1323,11 +1327,11 @@ function test_transform_transition(prop) {
expected: 'matrix(1, 0, 0, 1, 0px, -30px)' },
{ start: 'translateZ(40px)', end: 'none',
expected_uncomputed: 'translateZ(30px)',
expected: 'matrix3d(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 30, 1)',
expected: 'matrix3d(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0px, 0px, 30px, 1)',
requires_3d: true },
{ start: 'none', end: 'translate3D(40px, 60px, -40px)',
expected_uncomputed: 'translate3D(10px, 15px, -10px)',
expected: 'matrix3d(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 10, 15, -10, 1)',
expected: 'matrix3d(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 10px, 15px, -10px, 1)',
requires_3d: true },
// percentages are relative to 300px (width) and 50px (height)
// per the prerequisites in property_database.js
@ -1400,11 +1404,11 @@ function test_transform_transition(prop) {
expected: 'matrix(1, 0, 0, 4, 0px, 0px)' },
{ start: 'scaleZ(5)', end: 'none',
expected_uncomputed: 'scaleZ(4)',
expected: 'matrix3d(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 4, 0, 0, 0, 0, 1)',
expected: 'matrix3d(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 4, 0, 0px, 0px, 0px, 1)',
requires_3d: true },
{ start: 'none', end: 'scale3D(5, 5, 5)',
expected_uncomputed: 'scale3D(2, 2, 2)',
expected: 'matrix3d(2, 0, 0, 0, 0, 2, 0, 0, 0, 0, 2, 0, 0, 0, 0, 1)',
expected: 'matrix3d(2, 0, 0, 0, 0, 2, 0, 0, 0, 0, 2, 0, 0px, 0px, 0px, 1)',
requires_3d: true },
// skew

View File

@ -3362,4 +3362,4 @@ pref("full-screen-api.key-input-restricted", true);
pref("dom.event.handling-user-input-time-limit", 1000);
//3D Transforms
pref("layout.3d-transforms.enabled", false);
pref("layout.3d-transforms.enabled", true);

View File

@ -53,6 +53,8 @@
* a11y telemetry
*/
HISTOGRAM(A11Y_INSTANTIATED, 0, 1, 2, BOOLEAN, "has accessibility support been instantiated")
HISTOGRAM(ISIMPLE_DOM_USAGE, 0, 1, 2, BOOLEAN, "have the ISimpleDOM* accessibility interfaces been used")
HISTOGRAM(IACCESSIBLE_TABLE_USAGE, 0, 1, 2, BOOLEAN, "has the IAccessibleTable accessibility interface been used")
HISTOGRAM(CYCLE_COLLECTOR, 1, 10000, 50, EXPONENTIAL, "Time spent on one cycle collection (ms)")
HISTOGRAM(CYCLE_COLLECTOR_VISITED_REF_COUNTED, 1, 300000, 50, EXPONENTIAL, "Number of ref counted objects visited by the cycle collector")