Merge mozilla-central to b2g-inbound

This commit is contained in:
Carsten "Tomcat" Book 2015-01-20 13:23:50 +01:00
commit 31479ad480
142 changed files with 1439 additions and 716 deletions

View File

@ -52,11 +52,11 @@ public:
virtual ~AccessibleWrap();
void ShutdownAtkObject();
virtual void Shutdown();
virtual void Shutdown() MOZ_OVERRIDE;
// return the atk object for this AccessibleWrap
virtual void GetNativeInterface(void** aOutAccessible) MOZ_OVERRIDE;
virtual nsresult HandleAccEvent(AccEvent* aEvent);
virtual nsresult HandleAccEvent(AccEvent* aEvent) MOZ_OVERRIDE;
AtkObject * GetAtkObject(void);
static AtkObject* GetAtkObject(Accessible* aAccessible);

View File

@ -19,9 +19,9 @@ public:
virtual ~ApplicationAccessibleWrap();
// Accessible
virtual mozilla::a11y::ENameValueFlag Name(nsString& aName);
virtual mozilla::a11y::ENameValueFlag Name(nsString& aName) MOZ_OVERRIDE;
virtual bool InsertChildAt(uint32_t aIdx, Accessible* aChild) MOZ_OVERRIDE;
virtual bool RemoveChild(Accessible* aChild);
virtual bool RemoveChild(Accessible* aChild) MOZ_OVERRIDE;
/**
* Return the atk object for app root accessible.

View File

@ -45,7 +45,7 @@ public:
AtkSocketAccessible(nsIContent* aContent, DocAccessible* aDoc,
const nsCString& aPlugId);
virtual void Shutdown();
virtual void Shutdown() MOZ_OVERRIDE;
virtual void GetNativeInterface(void** aOutAccessible) MOZ_OVERRIDE;
};

View File

@ -77,14 +77,14 @@ public:
virtual ~EmbeddedObjCollector() { }
public:
virtual int32_t GetIndexAt(Accessible* aAccessible);
virtual int32_t GetIndexAt(Accessible* aAccessible) MOZ_OVERRIDE;
protected:
// Make sure it's used by Accessible class only.
explicit EmbeddedObjCollector(Accessible* aRoot) :
AccCollector(aRoot, filters::GetEmbeddedObject) { }
virtual void AppendObject(Accessible* aAccessible);
virtual void AppendObject(Accessible* aAccessible) MOZ_OVERRIDE;
friend class Accessible;
};

View File

@ -154,7 +154,7 @@ public:
// AccEvent
static const EventGroup kEventGroup = eStateChangeEvent;
virtual unsigned int GetEventGroups() const
virtual unsigned int GetEventGroups() const MOZ_OVERRIDE
{
return AccEvent::GetEventGroups() | (1U << eStateChangeEvent);
}
@ -183,7 +183,7 @@ public:
// AccEvent
static const EventGroup kEventGroup = eTextChangeEvent;
virtual unsigned int GetEventGroups() const
virtual unsigned int GetEventGroups() const MOZ_OVERRIDE
{
return AccEvent::GetEventGroups() | (1U << eTextChangeEvent);
}
@ -223,7 +223,7 @@ public:
// Event
static const EventGroup kEventGroup = eMutationEvent;
virtual unsigned int GetEventGroups() const
virtual unsigned int GetEventGroups() const MOZ_OVERRIDE
{
return AccEvent::GetEventGroups() | (1U << eMutationEvent);
}
@ -253,7 +253,7 @@ public:
// Event
static const EventGroup kEventGroup = eHideEvent;
virtual unsigned int GetEventGroups() const
virtual unsigned int GetEventGroups() const MOZ_OVERRIDE
{
return AccMutationEvent::GetEventGroups() | (1U << eHideEvent);
}
@ -281,7 +281,7 @@ public:
// Event
static const EventGroup kEventGroup = eShowEvent;
virtual unsigned int GetEventGroups() const
virtual unsigned int GetEventGroups() const MOZ_OVERRIDE
{
return AccMutationEvent::GetEventGroups() | (1U << eShowEvent);
}
@ -301,7 +301,7 @@ public:
// Event
static const EventGroup kEventGroup = eReorderEvent;
virtual unsigned int GetEventGroups() const
virtual unsigned int GetEventGroups() const MOZ_OVERRIDE
{
return AccEvent::GetEventGroups() | (1U << eReorderEvent);
}
@ -354,7 +354,7 @@ public:
// AccEvent
static const EventGroup kEventGroup = eCaretMoveEvent;
virtual unsigned int GetEventGroups() const
virtual unsigned int GetEventGroups() const MOZ_OVERRIDE
{
return AccEvent::GetEventGroups() | (1U << eCaretMoveEvent);
}
@ -380,7 +380,7 @@ public:
// AccEvent
static const EventGroup kEventGroup = eTextSelChangeEvent;
virtual unsigned int GetEventGroups() const
virtual unsigned int GetEventGroups() const MOZ_OVERRIDE
{
return AccEvent::GetEventGroups() | (1U << eTextSelChangeEvent);
}
@ -419,7 +419,7 @@ public:
// AccEvent
static const EventGroup kEventGroup = eSelectionChangeEvent;
virtual unsigned int GetEventGroups() const
virtual unsigned int GetEventGroups() const MOZ_OVERRIDE
{
return AccEvent::GetEventGroups() | (1U << eSelectionChangeEvent);
}
@ -449,7 +449,7 @@ public:
// AccEvent
static const EventGroup kEventGroup = eTableChangeEvent;
virtual unsigned int GetEventGroups() const
virtual unsigned int GetEventGroups() const MOZ_OVERRIDE
{
return AccEvent::GetEventGroups() | (1U << eTableChangeEvent);
}
@ -479,7 +479,7 @@ public:
// AccEvent
static const EventGroup kEventGroup = eVirtualCursorChangeEvent;
virtual unsigned int GetEventGroups() const
virtual unsigned int GetEventGroups() const MOZ_OVERRIDE
{
return AccEvent::GetEventGroups() | (1U << eVirtualCursorChangeEvent);
}
@ -509,7 +509,7 @@ public:
// AccEvent
static const EventGroup kEventGroup = eObjectAttrChangedEvent;
virtual unsigned int GetEventGroups() const
virtual unsigned int GetEventGroups() const MOZ_OVERRIDE
{
return AccEvent::GetEventGroups() | (1U << eObjectAttrChangedEvent);
}

View File

@ -43,7 +43,7 @@ public:
* Return next accessible complying with filter function. Return the first
* accessible for the first time.
*/
virtual Accessible* Next();
virtual Accessible* Next() MOZ_OVERRIDE;
private:
AccIterator();
@ -89,7 +89,7 @@ public:
/**
* Return next related accessible for the given dependent accessible.
*/
virtual Accessible* Next();
virtual Accessible* Next() MOZ_OVERRIDE;
private:
RelatedAccIterator();
@ -123,7 +123,7 @@ public:
/**
* Return next label accessible associated with the given element.
*/
virtual Accessible* Next();
virtual Accessible* Next() MOZ_OVERRIDE;
private:
HTMLLabelIterator();
@ -150,7 +150,7 @@ public:
/**
* Return next output accessible associated with the given element.
*/
virtual Accessible* Next();
virtual Accessible* Next() MOZ_OVERRIDE;
private:
HTMLOutputIterator();
@ -173,7 +173,7 @@ public:
/**
* Return next label accessible associated with the given element.
*/
virtual Accessible* Next();
virtual Accessible* Next() MOZ_OVERRIDE;
private:
XULLabelIterator();
@ -196,7 +196,7 @@ public:
/**
* Return next description accessible associated with the given element.
*/
virtual Accessible* Next();
virtual Accessible* Next() MOZ_OVERRIDE;
private:
XULDescriptionIterator();
@ -234,7 +234,7 @@ public:
nsIContent* GetElem(const nsDependentSubstring& aID);
// AccIterable
virtual Accessible* Next();
virtual Accessible* Next() MOZ_OVERRIDE;
private:
IDRefsIterator();
@ -257,7 +257,7 @@ public:
explicit SingleAccIterator(Accessible* aTarget): mAcc(aTarget) { }
virtual ~SingleAccIterator() { }
virtual Accessible* Next();
virtual Accessible* Next() MOZ_OVERRIDE;
private:
SingleAccIterator();
@ -278,7 +278,7 @@ public:
mContainer(aItemContainer), mAnchor(nullptr) { }
virtual ~ItemIterator() { }
virtual Accessible* Next();
virtual Accessible* Next() MOZ_OVERRIDE;
private:
ItemIterator() = delete;
@ -300,7 +300,7 @@ public:
int32_t aRowIdx);
virtual ~XULTreeItemIterator() { }
virtual Accessible* Next();
virtual Accessible* Next() MOZ_OVERRIDE;
private:
XULTreeItemIterator() = delete;

View File

@ -64,7 +64,7 @@ public:
mInstance(aInstance), mCallback(aCallback), mArg(aArg) { }
virtual ~TNotification() { mInstance = nullptr; }
virtual void Process()
virtual void Process() MOZ_OVERRIDE
{
(mInstance->*mCallback)(mArg);
@ -91,8 +91,8 @@ class NotificationController MOZ_FINAL : public EventQueue,
public:
NotificationController(DocAccessible* aDocument, nsIPresShell* aPresShell);
NS_IMETHOD_(MozExternalRefCountType) AddRef(void);
NS_IMETHOD_(MozExternalRefCountType) Release(void);
NS_IMETHOD_(MozExternalRefCountType) AddRef(void) MOZ_OVERRIDE;
NS_IMETHOD_(MozExternalRefCountType) Release(void) MOZ_OVERRIDE;
NS_DECL_CYCLE_COLLECTION_NATIVE_CLASS(NotificationController)
@ -203,7 +203,7 @@ private:
NotificationController& operator = (const NotificationController&);
// nsARefreshObserver
virtual void WillRefresh(mozilla::TimeStamp aTime);
virtual void WillRefresh(mozilla::TimeStamp aTime) MOZ_OVERRIDE;
private:
/**

View File

@ -130,7 +130,7 @@ protected:
// TextAttr
virtual void Expose(nsIPersistentProperties* aAttributes,
bool aIncludeDefAttrValue)
bool aIncludeDefAttrValue) MOZ_OVERRIDE
{
if (mGetRootValue) {
if (mIsRootDefined)
@ -148,7 +148,7 @@ protected:
ExposeValue(aAttributes, mRootNativeValue);
}
virtual bool Equal(Accessible* aAccessible)
virtual bool Equal(Accessible* aAccessible) MOZ_OVERRIDE
{
T nativeValue;
bool isDefined = GetValueFor(aAccessible, &nativeValue);
@ -203,9 +203,9 @@ protected:
protected:
// TextAttr
virtual bool GetValueFor(Accessible* aAccessible, nsString* aValue);
virtual bool GetValueFor(Accessible* aAccessible, nsString* aValue) MOZ_OVERRIDE;
virtual void ExposeValue(nsIPersistentProperties* aAttributes,
const nsString& aValue);
const nsString& aValue) MOZ_OVERRIDE;
private:
nsCOMPtr<nsIContent> mRootContent;
@ -234,9 +234,9 @@ protected:
};
// TextAttr
virtual bool GetValueFor(Accessible* aAccessible, uint32_t* aValue);
virtual bool GetValueFor(Accessible* aAccessible, uint32_t* aValue) MOZ_OVERRIDE;
virtual void ExposeValue(nsIPersistentProperties* aAttributes,
const uint32_t& aValue);
const uint32_t& aValue) MOZ_OVERRIDE;
private:
bool GetValue(nsIContent* aElm, uint32_t* aValue);
@ -256,9 +256,10 @@ protected:
protected:
// TextAttr
virtual bool GetValueFor(Accessible* aAccessible, nscolor* aValue);
virtual bool GetValueFor(Accessible* aAccessible, nscolor* aValue)
MOZ_OVERRIDE;
virtual void ExposeValue(nsIPersistentProperties* aAttributes,
const nscolor& aValue);
const nscolor& aValue) MOZ_OVERRIDE;
private:
bool GetColor(nsIFrame* aFrame, nscolor* aColor);
@ -278,9 +279,10 @@ protected:
protected:
// TTextAttr
virtual bool GetValueFor(Accessible* aAccessible, nscolor* aValue);
virtual bool GetValueFor(Accessible* aAccessible, nscolor* aValue)
MOZ_OVERRIDE;
virtual void ExposeValue(nsIPersistentProperties* aAttributes,
const nscolor& aValue);
const nscolor& aValue) MOZ_OVERRIDE;
};
@ -296,9 +298,10 @@ protected:
protected:
// TTextAttr
virtual bool GetValueFor(Accessible* aAccessible, nsString* aValue);
virtual bool GetValueFor(Accessible* aAccessible, nsString* aValue)
MOZ_OVERRIDE;
virtual void ExposeValue(nsIPersistentProperties* aAttributes,
const nsString& aValue);
const nsString& aValue) MOZ_OVERRIDE;
private:
@ -318,9 +321,10 @@ protected:
protected:
// TTextAttr
virtual bool GetValueFor(Accessible* aAccessible, nscoord* aValue);
virtual bool GetValueFor(Accessible* aAccessible, nscoord* aValue)
MOZ_OVERRIDE;
virtual void ExposeValue(nsIPersistentProperties* aAttributes,
const nscoord& aValue);
const nscoord& aValue) MOZ_OVERRIDE;
private:
nsDeviceContext* mDC;
@ -339,9 +343,10 @@ protected:
protected:
// TTextAttr
virtual bool GetValueFor(Accessible* aContent, nscoord* aValue);
virtual bool GetValueFor(Accessible* aContent, nscoord* aValue)
MOZ_OVERRIDE;
virtual void ExposeValue(nsIPersistentProperties* aAttributes,
const nscoord& aValue);
const nscoord& aValue) MOZ_OVERRIDE;
};
@ -357,9 +362,10 @@ protected:
protected:
// TTextAttr
virtual bool GetValueFor(Accessible* aAccessible, int32_t* aValue);
virtual bool GetValueFor(Accessible* aAccessible, int32_t* aValue)
MOZ_OVERRIDE;
virtual void ExposeValue(nsIPersistentProperties* aAttributes,
const int32_t& aValue);
const int32_t& aValue) MOZ_OVERRIDE;
private:
int32_t GetFontWeight(nsIFrame* aFrame);
@ -377,9 +383,10 @@ protected:
protected:
// TextAttr
virtual bool GetValueFor(Accessible* aAccessible, bool* aValue);
virtual bool GetValueFor(Accessible* aAccessible, bool* aValue)
MOZ_OVERRIDE;
virtual void ExposeValue(nsIPersistentProperties* aAttributes,
const bool& aValue);
const bool& aValue) MOZ_OVERRIDE;
};
@ -428,9 +435,10 @@ protected:
protected:
// TextAttr
virtual bool GetValueFor(Accessible* aAccessible, TextDecorValue* aValue);
virtual bool GetValueFor(Accessible* aAccessible, TextDecorValue* aValue)
MOZ_OVERRIDE;
virtual void ExposeValue(nsIPersistentProperties* aAttributes,
const TextDecorValue& aValue);
const TextDecorValue& aValue) MOZ_OVERRIDE;
};
/**
@ -453,9 +461,10 @@ protected:
protected:
// TextAttr
virtual bool GetValueFor(Accessible* aAccessible, TextPosValue* aValue);
virtual bool GetValueFor(Accessible* aAccessible, TextPosValue* aValue)
MOZ_OVERRIDE;
virtual void ExposeValue(nsIPersistentProperties* aAttributes,
const TextPosValue& aValue);
const TextPosValue& aValue) MOZ_OVERRIDE;
private:
TextPosValue GetTextPosValue(nsIFrame* aFrame) const;

View File

@ -1729,7 +1729,7 @@ Accessible::DoCommand(nsIContent *aContent, uint32_t aActionIndex)
Runnable(Accessible* aAcc, nsIContent* aContent, uint32_t aIdx) :
mAcc(aAcc), mContent(aContent), mIdx(aIdx) { }
NS_IMETHOD Run()
NS_IMETHOD Run() MOZ_OVERRIDE
{
if (mAcc)
mAcc->DispatchClickEvent(mContent, mIdx);

View File

@ -24,60 +24,68 @@ class xpcAccessible : public nsIAccessible
{
public:
// nsIAccessible
NS_IMETHOD GetParent(nsIAccessible** aParent) MOZ_FINAL;
NS_IMETHOD GetNextSibling(nsIAccessible** aNextSibling) MOZ_FINAL;
NS_IMETHOD GetPreviousSibling(nsIAccessible** aPreviousSibling) MOZ_FINAL;
NS_IMETHOD GetFirstChild(nsIAccessible** aFirstChild) MOZ_FINAL;
NS_IMETHOD GetLastChild(nsIAccessible** aLastChild) MOZ_FINAL;
NS_IMETHOD GetChildCount(int32_t* aChildCount) MOZ_FINAL;
NS_IMETHOD GetChildAt(int32_t aChildIndex, nsIAccessible** aChild) MOZ_FINAL;
NS_IMETHOD GetChildren(nsIArray** aChildren) MOZ_FINAL;
NS_IMETHOD GetIndexInParent(int32_t* aIndexInParent) MOZ_FINAL;
NS_IMETHOD GetParent(nsIAccessible** aParent) MOZ_FINAL MOZ_OVERRIDE;
NS_IMETHOD GetNextSibling(nsIAccessible** aNextSibling) MOZ_FINAL MOZ_OVERRIDE;
NS_IMETHOD GetPreviousSibling(nsIAccessible** aPreviousSibling)
MOZ_FINAL MOZ_OVERRIDE;
NS_IMETHOD GetFirstChild(nsIAccessible** aFirstChild) MOZ_FINAL MOZ_OVERRIDE;
NS_IMETHOD GetLastChild(nsIAccessible** aLastChild) MOZ_FINAL MOZ_OVERRIDE;
NS_IMETHOD GetChildCount(int32_t* aChildCount) MOZ_FINAL MOZ_OVERRIDE;
NS_IMETHOD GetChildAt(int32_t aChildIndex, nsIAccessible** aChild)
MOZ_FINAL MOZ_OVERRIDE;
NS_IMETHOD GetChildren(nsIArray** aChildren) MOZ_FINAL MOZ_OVERRIDE;
NS_IMETHOD GetIndexInParent(int32_t* aIndexInParent) MOZ_FINAL MOZ_OVERRIDE;
NS_IMETHOD GetDOMNode(nsIDOMNode** aDOMNode) MOZ_FINAL;
NS_IMETHOD GetDocument(nsIAccessibleDocument** aDocument) MOZ_FINAL;
NS_IMETHOD GetRootDocument(nsIAccessibleDocument** aRootDocument) MOZ_FINAL;
NS_IMETHOD GetDOMNode(nsIDOMNode** aDOMNode) MOZ_FINAL MOZ_OVERRIDE;
NS_IMETHOD GetDocument(nsIAccessibleDocument** aDocument) MOZ_FINAL MOZ_OVERRIDE;
NS_IMETHOD GetRootDocument(nsIAccessibleDocument** aRootDocument)
MOZ_FINAL MOZ_OVERRIDE;
NS_IMETHOD GetRole(uint32_t* aRole) MOZ_FINAL;
NS_IMETHOD GetState(uint32_t* aState, uint32_t* aExtraState) MOZ_FINAL;
NS_IMETHOD GetRole(uint32_t* aRole) MOZ_FINAL MOZ_OVERRIDE;
NS_IMETHOD GetState(uint32_t* aState, uint32_t* aExtraState)
MOZ_FINAL MOZ_OVERRIDE;
NS_IMETHOD GetDescription(nsAString& aDescription) MOZ_FINAL;
NS_IMETHOD GetName(nsAString& aName) MOZ_FINAL;
NS_IMETHOD GetLanguage(nsAString& aLanguage) MOZ_FINAL;
NS_IMETHOD GetValue(nsAString& aValue) MOZ_FINAL;
NS_IMETHOD GetHelp(nsAString& aHelp) MOZ_FINAL;
NS_IMETHOD GetDescription(nsAString& aDescription) MOZ_FINAL MOZ_OVERRIDE;
NS_IMETHOD GetName(nsAString& aName) MOZ_FINAL MOZ_OVERRIDE;
NS_IMETHOD GetLanguage(nsAString& aLanguage) MOZ_FINAL MOZ_OVERRIDE;
NS_IMETHOD GetValue(nsAString& aValue) MOZ_FINAL MOZ_OVERRIDE;
NS_IMETHOD GetHelp(nsAString& aHelp) MOZ_FINAL MOZ_OVERRIDE;
NS_IMETHOD GetAccessKey(nsAString& aAccessKey) MOZ_FINAL;
NS_IMETHOD GetKeyboardShortcut(nsAString& aKeyBinding) MOZ_FINAL;
NS_IMETHOD GetAccessKey(nsAString& aAccessKey) MOZ_FINAL MOZ_OVERRIDE;
NS_IMETHOD GetKeyboardShortcut(nsAString& aKeyBinding) MOZ_FINAL MOZ_OVERRIDE;
NS_IMETHOD GetAttributes(nsIPersistentProperties** aAttributes) MOZ_FINAL;
NS_IMETHOD GetAttributes(nsIPersistentProperties** aAttributes)
MOZ_FINAL MOZ_OVERRIDE;
NS_IMETHOD GetBounds(int32_t* aX, int32_t* aY,
int32_t* aWidth, int32_t* aHeight) MOZ_FINAL;
int32_t* aWidth, int32_t* aHeight) MOZ_FINAL MOZ_OVERRIDE;
NS_IMETHOD GroupPosition(int32_t* aGroupLevel, int32_t* aSimilarItemsInGroup,
int32_t* aPositionInGroup) MOZ_FINAL;
int32_t* aPositionInGroup) MOZ_FINAL MOZ_OVERRIDE;
NS_IMETHOD GetRelationByType(uint32_t aType,
nsIAccessibleRelation** aRelation) MOZ_FINAL;
NS_IMETHOD GetRelations(nsIArray** aRelations) MOZ_FINAL;
nsIAccessibleRelation** aRelation)
MOZ_FINAL MOZ_OVERRIDE;
NS_IMETHOD GetRelations(nsIArray** aRelations) MOZ_FINAL MOZ_OVERRIDE;
NS_IMETHOD GetFocusedChild(nsIAccessible** aChild) MOZ_FINAL;
NS_IMETHOD GetFocusedChild(nsIAccessible** aChild) MOZ_FINAL MOZ_OVERRIDE;
NS_IMETHOD GetChildAtPoint(int32_t aX, int32_t aY,
nsIAccessible** aAccessible) MOZ_FINAL;
nsIAccessible** aAccessible) MOZ_FINAL MOZ_OVERRIDE;
NS_IMETHOD GetDeepestChildAtPoint(int32_t aX, int32_t aY,
nsIAccessible** aAccessible) MOZ_FINAL;
nsIAccessible** aAccessible)
MOZ_FINAL MOZ_OVERRIDE;
NS_IMETHOD SetSelected(bool aSelect) MOZ_FINAL;
NS_IMETHOD ExtendSelection() MOZ_FINAL;
NS_IMETHOD TakeSelection() MOZ_FINAL;
NS_IMETHOD TakeFocus() MOZ_FINAL;
NS_IMETHOD SetSelected(bool aSelect) MOZ_FINAL MOZ_OVERRIDE;
NS_IMETHOD ExtendSelection() MOZ_FINAL MOZ_OVERRIDE;
NS_IMETHOD TakeSelection() MOZ_FINAL MOZ_OVERRIDE;
NS_IMETHOD TakeFocus() MOZ_FINAL MOZ_OVERRIDE;
NS_IMETHOD GetActionCount(uint8_t* aActionCount) MOZ_FINAL;
NS_IMETHOD GetActionName(uint8_t aIndex, nsAString& aName) MOZ_FINAL;
NS_IMETHOD GetActionDescription(uint8_t aIndex, nsAString& aDescription) MOZ_FINAL;
NS_IMETHOD DoAction(uint8_t aIndex) MOZ_FINAL;
NS_IMETHOD GetActionCount(uint8_t* aActionCount) MOZ_FINAL MOZ_OVERRIDE;
NS_IMETHOD GetActionName(uint8_t aIndex, nsAString& aName) MOZ_FINAL MOZ_OVERRIDE;
NS_IMETHOD GetActionDescription(uint8_t aIndex, nsAString& aDescription)
MOZ_FINAL MOZ_OVERRIDE;
NS_IMETHOD DoAction(uint8_t aIndex) MOZ_FINAL MOZ_OVERRIDE;
NS_IMETHOD ScrollTo(uint32_t aHow) MOZ_FINAL;
NS_IMETHOD ScrollTo(uint32_t aHow) MOZ_FINAL MOZ_OVERRIDE;
NS_IMETHOD ScrollToPoint(uint32_t aCoordinateType,
int32_t aX, int32_t aY) MOZ_FINAL;
int32_t aX, int32_t aY) MOZ_FINAL MOZ_OVERRIDE;
protected:
xpcAccessible() { }

View File

@ -27,10 +27,10 @@ public:
NS_DECL_ISUPPORTS_INHERITED
// nsIAccessibleApplication
NS_IMETHOD GetAppName(nsAString& aName) MOZ_FINAL;
NS_IMETHOD GetAppVersion(nsAString& aVersion) MOZ_FINAL;
NS_IMETHOD GetPlatformName(nsAString& aName) MOZ_FINAL;
NS_IMETHOD GetPlatformVersion(nsAString& aVersion) MOZ_FINAL;
NS_IMETHOD GetAppName(nsAString& aName) MOZ_FINAL MOZ_OVERRIDE;
NS_IMETHOD GetAppVersion(nsAString& aVersion) MOZ_FINAL MOZ_OVERRIDE;
NS_IMETHOD GetPlatformName(nsAString& aName) MOZ_FINAL MOZ_OVERRIDE;
NS_IMETHOD GetPlatformVersion(nsAString& aVersion) MOZ_FINAL MOZ_OVERRIDE;
protected:
virtual ~xpcAccessibleApplication() {}

View File

@ -32,17 +32,20 @@ public:
xpcAccessibleGeneric)
// nsIAccessibleDocument
NS_IMETHOD GetURL(nsAString& aURL) MOZ_FINAL;
NS_IMETHOD GetTitle(nsAString& aTitle) MOZ_FINAL;
NS_IMETHOD GetMimeType(nsAString& aType) MOZ_FINAL;
NS_IMETHOD GetDocType(nsAString& aType) MOZ_FINAL;
NS_IMETHOD GetDOMDocument(nsIDOMDocument** aDOMDocument) MOZ_FINAL;
NS_IMETHOD GetWindow(nsIDOMWindow** aDOMWindow) MOZ_FINAL;
NS_IMETHOD GetParentDocument(nsIAccessibleDocument** aDocument) MOZ_FINAL;
NS_IMETHOD GetChildDocumentCount(uint32_t* aCount) MOZ_FINAL;
NS_IMETHOD GetURL(nsAString& aURL) MOZ_FINAL MOZ_OVERRIDE;
NS_IMETHOD GetTitle(nsAString& aTitle) MOZ_FINAL MOZ_OVERRIDE;
NS_IMETHOD GetMimeType(nsAString& aType) MOZ_FINAL MOZ_OVERRIDE;
NS_IMETHOD GetDocType(nsAString& aType) MOZ_FINAL MOZ_OVERRIDE;
NS_IMETHOD GetDOMDocument(nsIDOMDocument** aDOMDocument) MOZ_FINAL MOZ_OVERRIDE;
NS_IMETHOD GetWindow(nsIDOMWindow** aDOMWindow) MOZ_FINAL MOZ_OVERRIDE;
NS_IMETHOD GetParentDocument(nsIAccessibleDocument** aDocument)
MOZ_FINAL MOZ_OVERRIDE;
NS_IMETHOD GetChildDocumentCount(uint32_t* aCount) MOZ_FINAL MOZ_OVERRIDE;
NS_IMETHOD GetChildDocumentAt(uint32_t aIndex,
nsIAccessibleDocument** aDocument) MOZ_FINAL;
NS_IMETHOD GetVirtualCursor(nsIAccessiblePivot** aVirtualCursor) MOZ_FINAL;
nsIAccessibleDocument** aDocument)
MOZ_FINAL MOZ_OVERRIDE;
NS_IMETHOD GetVirtualCursor(nsIAccessiblePivot** aVirtualCursor)
MOZ_FINAL MOZ_OVERRIDE;
/**
* Return XPCOM wrapper for the internal accessible.

View File

@ -41,7 +41,7 @@ public:
NS_DECL_CYCLE_COLLECTION_CLASS_AMBIGUOUS(xpcAccessibleGeneric, nsIAccessible)
// nsIAccessible
virtual Accessible* ToInternalAccessible() const MOZ_FINAL;
virtual Accessible* ToInternalAccessible() const MOZ_FINAL MOZ_OVERRIDE;
// xpcAccessibleGeneric
virtual void Shutdown();

View File

@ -23,12 +23,13 @@ class Accessible;
class xpcAccessibleHyperLink : public nsIAccessibleHyperLink
{
public:
NS_IMETHOD GetAnchorCount(int32_t* aAnchorCount) MOZ_FINAL;
NS_IMETHOD GetStartIndex(int32_t* aStartIndex) MOZ_FINAL;
NS_IMETHOD GetEndIndex(int32_t* aEndIndex) MOZ_FINAL;
NS_IMETHOD GetURI(int32_t aIndex, nsIURI** aURI) MOZ_FINAL;
NS_IMETHOD GetAnchor(int32_t aIndex, nsIAccessible** aAccessible) MOZ_FINAL;
NS_IMETHOD GetValid(bool* aValid) MOZ_FINAL;
NS_IMETHOD GetAnchorCount(int32_t* aAnchorCount) MOZ_FINAL MOZ_OVERRIDE;
NS_IMETHOD GetStartIndex(int32_t* aStartIndex) MOZ_FINAL MOZ_OVERRIDE;
NS_IMETHOD GetEndIndex(int32_t* aEndIndex) MOZ_FINAL MOZ_OVERRIDE;
NS_IMETHOD GetURI(int32_t aIndex, nsIURI** aURI) MOZ_FINAL MOZ_OVERRIDE;
NS_IMETHOD GetAnchor(int32_t aIndex, nsIAccessible** aAccessible)
MOZ_FINAL MOZ_OVERRIDE;
NS_IMETHOD GetValid(bool* aValid) MOZ_FINAL MOZ_OVERRIDE;
protected:
xpcAccessibleHyperLink() { }

View File

@ -24,8 +24,8 @@ public:
NS_DECL_ISUPPORTS_INHERITED
NS_IMETHOD GetImagePosition(uint32_t aCoordType,
int32_t* aX, int32_t* aY) MOZ_FINAL;
NS_IMETHOD GetImageSize(int32_t* aWidth, int32_t* aHeight) MOZ_FINAL;
int32_t* aX, int32_t* aY) MOZ_FINAL MOZ_OVERRIDE;
NS_IMETHOD GetImageSize(int32_t* aWidth, int32_t* aHeight) MOZ_FINAL MOZ_OVERRIDE;
protected:
virtual ~xpcAccessibleImage() {}

View File

@ -25,14 +25,17 @@ class xpcAccessibleSelectable : public nsIAccessibleSelectable
{
public:
// nsIAccessibleSelectable
NS_IMETHOD GetSelectedItems(nsIArray** aSelectedItems) MOZ_FINAL;
NS_IMETHOD GetSelectedItemCount(uint32_t* aSelectedItemCount) MOZ_FINAL;
NS_IMETHOD GetSelectedItemAt(uint32_t aIndex, nsIAccessible** aItem) MOZ_FINAL;
NS_IMETHOD IsItemSelected(uint32_t aIndex, bool* aIsSelected) MOZ_FINAL;
NS_IMETHOD AddItemToSelection(uint32_t aIndex) MOZ_FINAL;
NS_IMETHOD RemoveItemFromSelection(uint32_t aIndex) MOZ_FINAL;
NS_IMETHOD SelectAll(bool* aIsMultiSelect) MOZ_FINAL;
NS_IMETHOD UnselectAll() MOZ_FINAL;
NS_IMETHOD GetSelectedItems(nsIArray** aSelectedItems) MOZ_FINAL MOZ_OVERRIDE;
NS_IMETHOD GetSelectedItemCount(uint32_t* aSelectedItemCount)
MOZ_FINAL MOZ_OVERRIDE;
NS_IMETHOD GetSelectedItemAt(uint32_t aIndex, nsIAccessible** aItem)
MOZ_FINAL MOZ_OVERRIDE;
NS_IMETHOD IsItemSelected(uint32_t aIndex, bool* aIsSelected)
MOZ_FINAL MOZ_OVERRIDE;
NS_IMETHOD AddItemToSelection(uint32_t aIndex) MOZ_FINAL MOZ_OVERRIDE;
NS_IMETHOD RemoveItemFromSelection(uint32_t aIndex) MOZ_FINAL MOZ_OVERRIDE;
NS_IMETHOD SelectAll(bool* aIsMultiSelect) MOZ_FINAL MOZ_OVERRIDE;
NS_IMETHOD UnselectAll() MOZ_FINAL MOZ_OVERRIDE;
protected:
xpcAccessibleSelectable() { }

View File

@ -26,42 +26,55 @@ public:
NS_DECL_ISUPPORTS_INHERITED
// nsIAccessibleTable
NS_IMETHOD GetCaption(nsIAccessible** aCaption) MOZ_FINAL;
NS_IMETHOD GetSummary(nsAString& aSummary) MOZ_FINAL;
NS_IMETHOD GetColumnCount(int32_t* aColumnCount) MOZ_FINAL;
NS_IMETHOD GetRowCount(int32_t* aRowCount) MOZ_FINAL;
NS_IMETHOD GetCaption(nsIAccessible** aCaption) MOZ_FINAL MOZ_OVERRIDE;
NS_IMETHOD GetSummary(nsAString& aSummary) MOZ_FINAL MOZ_OVERRIDE;
NS_IMETHOD GetColumnCount(int32_t* aColumnCount) MOZ_FINAL MOZ_OVERRIDE;
NS_IMETHOD GetRowCount(int32_t* aRowCount) MOZ_FINAL MOZ_OVERRIDE;
NS_IMETHOD GetCellAt(int32_t aRowIndex, int32_t aColumnIndex,
nsIAccessible** aCell) MOZ_FINAL;
nsIAccessible** aCell) MOZ_FINAL MOZ_OVERRIDE;
NS_IMETHOD GetCellIndexAt(int32_t aRowIndex, int32_t aColumnIndex,
int32_t* aCellIndex) MOZ_FINAL;
NS_IMETHOD GetColumnIndexAt(int32_t aCellIndex, int32_t* aColumnIndex) MOZ_FINAL;
NS_IMETHOD GetRowIndexAt(int32_t aCellIndex, int32_t* aRowIndex) MOZ_FINAL;
int32_t* aCellIndex) MOZ_FINAL MOZ_OVERRIDE;
NS_IMETHOD GetColumnIndexAt(int32_t aCellIndex, int32_t* aColumnIndex)
MOZ_FINAL MOZ_OVERRIDE;
NS_IMETHOD GetRowIndexAt(int32_t aCellIndex, int32_t* aRowIndex)
MOZ_FINAL MOZ_OVERRIDE;
NS_IMETHOD GetRowAndColumnIndicesAt(int32_t aCellIndex, int32_t* aRowIndex,
int32_t* aColumnIndex) MOZ_FINAL;
int32_t* aColumnIndex)
MOZ_FINAL MOZ_OVERRIDE;
NS_IMETHOD GetColumnExtentAt(int32_t row, int32_t column,
int32_t* aColumnExtent) MOZ_FINAL;
int32_t* aColumnExtent) MOZ_FINAL MOZ_OVERRIDE;
NS_IMETHOD GetRowExtentAt(int32_t row, int32_t column,
int32_t* aRowExtent) MOZ_FINAL;
NS_IMETHOD GetColumnDescription(int32_t aColIdx, nsAString& aDescription) MOZ_FINAL;
NS_IMETHOD GetRowDescription(int32_t aRowIdx, nsAString& aDescription) MOZ_FINAL;
NS_IMETHOD IsColumnSelected(int32_t aColIdx, bool* _retval) MOZ_FINAL;
NS_IMETHOD IsRowSelected(int32_t aRowIdx, bool* _retval) MOZ_FINAL;
NS_IMETHOD IsCellSelected(int32_t aRowIdx, int32_t aColIdx, bool* _retval) MOZ_FINAL;
NS_IMETHOD GetSelectedCellCount(uint32_t* aSelectedCellCount) MOZ_FINAL;
NS_IMETHOD GetSelectedColumnCount(uint32_t* aSelectedColumnCount) MOZ_FINAL;
NS_IMETHOD GetSelectedRowCount(uint32_t* aSelectedRowCount) MOZ_FINAL;
NS_IMETHOD GetSelectedCells(nsIArray** aSelectedCell) MOZ_FINAL;
int32_t* aRowExtent) MOZ_FINAL MOZ_OVERRIDE;
NS_IMETHOD GetColumnDescription(int32_t aColIdx, nsAString& aDescription)
MOZ_FINAL MOZ_OVERRIDE;
NS_IMETHOD GetRowDescription(int32_t aRowIdx, nsAString& aDescription)
MOZ_FINAL MOZ_OVERRIDE;
NS_IMETHOD IsColumnSelected(int32_t aColIdx, bool* _retval)
MOZ_FINAL MOZ_OVERRIDE;
NS_IMETHOD IsRowSelected(int32_t aRowIdx, bool* _retval)
MOZ_FINAL MOZ_OVERRIDE;
NS_IMETHOD IsCellSelected(int32_t aRowIdx, int32_t aColIdx, bool* _retval)
MOZ_FINAL MOZ_OVERRIDE;
NS_IMETHOD GetSelectedCellCount(uint32_t* aSelectedCellCount)
MOZ_FINAL MOZ_OVERRIDE;
NS_IMETHOD GetSelectedColumnCount(uint32_t* aSelectedColumnCount)
MOZ_FINAL MOZ_OVERRIDE;
NS_IMETHOD GetSelectedRowCount(uint32_t* aSelectedRowCount)
MOZ_FINAL MOZ_OVERRIDE;
NS_IMETHOD GetSelectedCells(nsIArray** aSelectedCell) MOZ_FINAL MOZ_OVERRIDE;
NS_IMETHOD GetSelectedCellIndices(uint32_t* aCellsArraySize,
int32_t** aCellsArray) MOZ_FINAL;
int32_t** aCellsArray)
MOZ_FINAL MOZ_OVERRIDE;
NS_IMETHOD GetSelectedColumnIndices(uint32_t* aColsArraySize,
int32_t** aColsArray) MOZ_FINAL;
int32_t** aColsArray)
MOZ_FINAL MOZ_OVERRIDE;
NS_IMETHOD GetSelectedRowIndices(uint32_t* aRowsArraySize,
int32_t** aRowsArray) MOZ_FINAL;
NS_IMETHOD SelectColumn(int32_t aColIdx) MOZ_FINAL;
NS_IMETHOD SelectRow(int32_t aRowIdx) MOZ_FINAL;
NS_IMETHOD UnselectColumn(int32_t aColIdx) MOZ_FINAL;
NS_IMETHOD UnselectRow(int32_t aRowIdx) MOZ_FINAL;
NS_IMETHOD IsProbablyForLayout(bool* aIsForLayout) MOZ_FINAL;
int32_t** aRowsArray) MOZ_FINAL MOZ_OVERRIDE;
NS_IMETHOD SelectColumn(int32_t aColIdx) MOZ_FINAL MOZ_OVERRIDE;
NS_IMETHOD SelectRow(int32_t aRowIdx) MOZ_FINAL MOZ_OVERRIDE;
NS_IMETHOD UnselectColumn(int32_t aColIdx) MOZ_FINAL MOZ_OVERRIDE;
NS_IMETHOD UnselectRow(int32_t aRowIdx) MOZ_FINAL MOZ_OVERRIDE;
NS_IMETHOD IsProbablyForLayout(bool* aIsForLayout) MOZ_FINAL MOZ_OVERRIDE;
protected:
virtual ~xpcAccessibleTable() {}

View File

@ -27,14 +27,14 @@ public:
NS_DECL_ISUPPORTS_INHERITED
// nsIAccessibleTableCell
NS_IMETHOD GetTable(nsIAccessibleTable** aTable) MOZ_FINAL;
NS_IMETHOD GetColumnIndex(int32_t* aColIdx) MOZ_FINAL;
NS_IMETHOD GetRowIndex(int32_t* aRowIdx) MOZ_FINAL;
NS_IMETHOD GetColumnExtent(int32_t* aExtent) MOZ_FINAL;
NS_IMETHOD GetRowExtent(int32_t* aExtent) MOZ_FINAL;
NS_IMETHOD GetColumnHeaderCells(nsIArray** aHeaderCells) MOZ_FINAL;
NS_IMETHOD GetRowHeaderCells(nsIArray** aHeaderCells) MOZ_FINAL;
NS_IMETHOD IsSelected(bool* aSelected) MOZ_FINAL;
NS_IMETHOD GetTable(nsIAccessibleTable** aTable) MOZ_FINAL MOZ_OVERRIDE;
NS_IMETHOD GetColumnIndex(int32_t* aColIdx) MOZ_FINAL MOZ_OVERRIDE;
NS_IMETHOD GetRowIndex(int32_t* aRowIdx) MOZ_FINAL MOZ_OVERRIDE;
NS_IMETHOD GetColumnExtent(int32_t* aExtent) MOZ_FINAL MOZ_OVERRIDE;
NS_IMETHOD GetRowExtent(int32_t* aExtent) MOZ_FINAL MOZ_OVERRIDE;
NS_IMETHOD GetColumnHeaderCells(nsIArray** aHeaderCells) MOZ_FINAL MOZ_OVERRIDE;
NS_IMETHOD GetRowHeaderCells(nsIArray** aHeaderCells) MOZ_FINAL MOZ_OVERRIDE;
NS_IMETHOD IsSelected(bool* aSelected) MOZ_FINAL MOZ_OVERRIDE;
protected:
virtual ~xpcAccessibleTableCell() {}

View File

@ -174,8 +174,8 @@ public:
XULToolbarButtonAccessible(nsIContent* aContent, DocAccessible* aDoc);
// Accessible
virtual void GetPositionAndSizeInternal(int32_t *aPosInSet,
int32_t *aSetSize);
virtual void GetPositionAndSizeInternal(int32_t* aPosInSet,
int32_t* aSetSize) MOZ_OVERRIDE;
// nsXULToolbarButtonAccessible
static bool IsSeparator(Accessible* aAccessible);

View File

@ -262,7 +262,8 @@ protected:
// Accessible
virtual Accessible* GetSiblingAtOffset(int32_t aOffset,
nsresult *aError = nullptr) const;
nsresult* aError = nullptr) const
MOZ_OVERRIDE;
};

View File

@ -322,7 +322,7 @@ pref("media.fragmented-mp4.gonk.enabled", true);
pref("media.video-queue.default-size", 3);
// optimize images' memory usage
pref("image.mem.decodeondraw", true);
pref("image.mem.decodeondraw", false);
pref("image.mem.allow_locking_in_content_processes", false); /* don't allow image locking */
// Limit the surface cache to 1/8 of main memory or 128MB, whichever is smaller.
// Almost everything that was factored into 'max_decoded_image_kb' is now stored

View File

@ -223,6 +223,8 @@ int main(int argc, _CONST char* argv[])
#elif defined(XP_WIN)
IO_COUNTERS ioCounters;
gotCounters = GetProcessIoCounters(GetCurrentProcess(), &ioCounters);
#else
#error "Unknown platform" // having this here keeps cppcheck happy
#endif
#ifdef HAS_DLL_BLOCKLIST
@ -271,6 +273,8 @@ int main(int argc, _CONST char* argv[])
XRE_TelemetryAccumulate(mozilla::Telemetry::GLUESTARTUP_HARD_FAULTS,
int(newRUsage.ru_majflt - initialRUsage.ru_majflt));
}
#else
#error "Unknown platform" // having this here keeps cppcheck happy
#endif
}

View File

@ -613,6 +613,8 @@ int main(int argc, char* argv[])
#elif defined(XP_WIN)
IO_COUNTERS ioCounters;
gotCounters = GetProcessIoCounters(GetCurrentProcess(), &ioCounters);
#else
#error "Unknown platform" // having this here keeps cppcheck happy
#endif
nsIFile *xreDirectory;
@ -657,6 +659,8 @@ int main(int argc, char* argv[])
XRE_TelemetryAccumulate(mozilla::Telemetry::GLUESTARTUP_HARD_FAULTS,
int(newRUsage.ru_majflt - initialRUsage.ru_majflt));
}
#else
#error "Unknown platform" // having this here keeps cppcheck happy
#endif
}

View File

@ -1812,3 +1812,6 @@ pref("dom.ipc.cpow.timeout", 500);
// detection).
pref("dom.ipc.processHangMonitor", true);
pref("dom.ipc.reportProcessHangs", true);
// Disable reader mode by default.
pref("reader.parse-on-load.enabled", false);

View File

@ -198,6 +198,9 @@ XPCOMUtils.defineLazyModuleGetter(this, "CastingApps",
XPCOMUtils.defineLazyModuleGetter(this, "SimpleServiceDiscovery",
"resource://gre/modules/SimpleServiceDiscovery.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "ReaderParent",
"resource:///modules/ReaderParent.jsm");
let gInitialPages = [
"about:blank",
"about:newtab",
@ -4334,6 +4337,7 @@ var XULBrowserWindow = {
}
}
UpdateBackForwardCommands(gBrowser.webNavigation);
ReaderParent.updateReaderButton(gBrowser.selectedBrowser);
gGestureSupport.restoreRotationState();

View File

@ -845,6 +845,10 @@
hidden="true"
tooltiptext="&pageReportIcon.tooltip;"
onclick="gPopupBlockerObserver.onReportButtonClick(event);"/>
<image id="reader-mode-button"
class="urlbar-icon"
hidden="true"
onclick="ReaderParent.toggleReaderMode(event);"/>
</hbox>
<toolbarbutton id="urlbar-go-button"
class="chromeclass-toolbar-additional"

View File

@ -27,6 +27,10 @@ XPCOMUtils.defineLazyModuleGetter(this, "PrivateBrowsingUtils",
"resource://gre/modules/PrivateBrowsingUtils.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "FormSubmitObserver",
"resource:///modules/FormSubmitObserver.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "AboutReader",
"resource://gre/modules/AboutReader.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "ReaderMode",
"resource://gre/modules/ReaderMode.jsm");
XPCOMUtils.defineLazyGetter(this, "SimpleServiceDiscovery", function() {
let ssdp = Cu.import("resource://gre/modules/SimpleServiceDiscovery.jsm", {}).SimpleServiceDiscovery;
// Register targets
@ -452,6 +456,76 @@ let AboutHomeListener = {
};
AboutHomeListener.init(this);
let AboutReaderListener = {
_savedArticle: null,
init: function() {
addEventListener("AboutReaderContentLoaded", this, false, true);
addEventListener("pageshow", this, false);
addEventListener("pagehide", this, false);
addMessageListener("Reader:SavedArticleGet", this);
},
receiveMessage: function(message) {
switch (message.name) {
case "Reader:SavedArticleGet":
sendAsyncMessage("Reader:SavedArticleData", { article: this._savedArticle });
break;
}
},
get isAboutReader() {
return content.document.documentURI.startsWith("about:reader");
},
handleEvent: function(aEvent) {
if (aEvent.originalTarget.defaultView != content) {
return;
}
switch (aEvent.type) {
case "AboutReaderContentLoaded":
if (!this.isAboutReader) {
return;
}
if (content.document.body) {
// Update the toolbar icon to show the "reader active" icon.
sendAsyncMessage("Reader:UpdateReaderButton");
new AboutReader(global, content);
}
break;
case "pagehide":
// Reader mode is disabled until proven enabled.
this._savedArticle = null;
sendAsyncMessage("Reader:UpdateReaderButton", { isArticle: false });
break;
case "pageshow":
if (!ReaderMode.isEnabledForParseOnLoad || this.isAboutReader) {
return;
}
ReaderMode.parseDocument(content.document).then(article => {
// The loaded page may have changed while we were parsing the document.
// Make sure we've got the current one.
let currentURL = Services.io.newURI(content.document.documentURI, null, null).specIgnoringRef;
// Do nothing if there's no article or the page in this tab has changed.
if (article == null || (article.url != currentURL)) {
return;
}
this._savedArticle = article;
sendAsyncMessage("Reader:UpdateReaderButton", { isArticle: true });
}).catch(e => Cu.reportError("Error parsing document: " + e));
break;
}
}
};
AboutReaderListener.init();
// An event listener for custom "WebChannelMessageToChrome" events on pages
addEventListener("WebChannelMessageToChrome", function (e) {

View File

@ -135,6 +135,9 @@ XPCOMUtils.defineLazyModuleGetter(this, "FormValidationHandler",
XPCOMUtils.defineLazyModuleGetter(this, "WebChannel",
"resource://gre/modules/WebChannel.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "ReaderParent",
"resource:///modules/ReaderParent.jsm");
const PREF_PLUGINS_NOTIFYUSER = "plugins.update.notifyUser";
const PREF_PLUGINS_UPDATEURL = "plugins.update.url";
@ -593,6 +596,7 @@ BrowserGlue.prototype = {
ContentPrefServiceParent.init();
LoginManagerParent.init();
ReaderParent.init();
#ifdef NIGHTLY_BUILD
Services.prefs.addObserver(POLARIS_ENABLED, this, false);

View File

@ -0,0 +1,170 @@
// -*- indent-tabs-mode: nil; js-indent-level: 2 -*-
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict";
const { classes: Cc, interfaces: Ci, utils: Cu } = Components;
this.EXPORTED_SYMBOLS = [ "ReaderParent" ];
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
Cu.import("resource://gre/modules/Services.jsm");
Cu.import("resource://gre/modules/Task.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "ReaderMode", "resource://gre/modules/ReaderMode.jsm");
let ReaderParent = {
MESSAGES: [
"Reader:AddToList",
"Reader:ArticleGet",
"Reader:FaviconRequest",
"Reader:ListStatusRequest",
"Reader:RemoveFromList",
"Reader:Share",
"Reader:ShowToast",
"Reader:ToolbarVisibility",
"Reader:SystemUIVisibility",
"Reader:UpdateReaderButton",
],
init: function() {
let mm = Cc["@mozilla.org/globalmessagemanager;1"].getService(Ci.nsIMessageListenerManager);
for (let msg of this.MESSAGES) {
mm.addMessageListener(msg, this);
}
},
receiveMessage: function(message) {
switch (message.name) {
case "Reader:AddToList":
// XXX: To implement.
break;
case "Reader:ArticleGet":
this._getArticle(message.data.url, message.target).then((article) => {
message.target.messageManager.sendAsyncMessage("Reader:ArticleData", { article: article });
});
break;
case "Reader:FaviconRequest": {
// XXX: To implement.
break;
}
case "Reader:ListStatusRequest":
// XXX: To implement.
break;
case "Reader:RemoveFromList":
// XXX: To implement.
break;
case "Reader:Share":
// XXX: To implement.
break;
case "Reader:ShowToast":
// XXX: To implement.
break;
case "Reader:SystemUIVisibility":
// XXX: To implement.
break;
case "Reader:ToolbarVisibility":
// XXX: To implement.
break;
case "Reader:UpdateReaderButton": {
let browser = message.target;
if (message.data && message.data.isArticle !== undefined) {
browser.isArticle = message.data.isArticle;
}
this.updateReaderButton(browser);
break;
}
}
},
updateReaderButton: function(browser) {
let win = browser.ownerDocument.defaultView;
if (browser != win.gBrowser.selectedBrowser) {
return;
}
let button = win.document.getElementById("reader-mode-button");
if (browser.currentURI.spec.startsWith("about:reader")) {
button.setAttribute("readeractive", true);
button.hidden = false;
} else {
button.removeAttribute("readeractive");
button.hidden = !browser.isArticle;
}
},
toggleReaderMode: function(event) {
let win = event.target.ownerDocument.defaultView;
let url = win.gBrowser.selectedBrowser.currentURI.spec;
if (url.startsWith("about:reader")) {
win.openUILinkIn(this._getOriginalUrl(url), "current");
} else {
win.openUILinkIn("about:reader?url=" + encodeURIComponent(url), "current");
}
},
/**
* Returns original URL from an about:reader URL.
*
* @param url An about:reader URL.
*/
_getOriginalUrl: function(url) {
let searchParams = new URLSearchParams(url.split("?")[1]);
if (!searchParams.has("url")) {
Cu.reportError("Error finding original URL for about:reader URL: " + url);
return url;
}
return decodeURIComponent(searchParams.get("url"));
},
/**
* Gets an article for a given URL. This method will download and parse a document
* if it does not find the article in the tab data or the cache.
*
* @param url The article URL.
* @param browser The browser where the article is currently loaded.
* @return {Promise}
* @resolves JS object representing the article, or null if no article is found.
*/
_getArticle: Task.async(function* (url, browser) {
// First, look for a saved article.
let article = yield this._getSavedArticle(browser);
if (article && article.url == url) {
return article;
}
// Next, try to find a parsed article in the cache.
let uri = Services.io.newURI(url, null, null);
article = yield ReaderMode.getArticleFromCache(uri);
if (article) {
return article;
}
// Article hasn't been found in the cache, we need to
// download the page and parse the article out of it.
return yield ReaderMode.downloadAndParseDocument(url);
}),
_getSavedArticle: function(browser) {
return new Promise((resolve, reject) => {
let mm = browser.messageManager;
let listener = (message) => {
mm.removeMessageListener("Reader:SavedArticleData", listener);
resolve(message.data.article);
};
mm.addMessageListener("Reader:SavedArticleData", listener);
mm.sendAsyncMessage("Reader:SavedArticleGet");
});
}
};

View File

@ -50,6 +50,7 @@ if CONFIG['NIGHTLY_BUILD']:
EXTRA_PP_JS_MODULES += [
'AboutHome.jsm',
'PluginContent.jsm',
'ReaderParent.jsm',
'RecentWindow.jsm',
'webrtcUI.jsm',
]

View File

@ -1615,6 +1615,18 @@ richlistitem[type~="action"][actiontype="switchtab"] > .ac-url-box > .ac-action-
list-style-image: url("chrome://browser/skin/Info.png");
}
/* Reader mode button */
#reader-mode-button {
list-style-image: url("chrome://browser/skin/reader-mode-16.png");
-moz-image-region: rect(0, 16px, 16px, 0);
}
#reader-mode-button:hover:active,
#reader-mode-button[readeractive] {
-moz-image-region: rect(0, 32px, 16px, 16px);
}
/* social share panel */
.social-share-frame {

View File

@ -85,6 +85,7 @@ browser.jar:
skin/classic/browser/Toolbar-small.png
skin/classic/browser/undoCloseTab.png (../shared/undoCloseTab.png)
skin/classic/browser/urlbar-arrow.png
skin/classic/browser/reader-mode-16.png (../shared/reader/reader-mode-16.png)
skin/classic/browser/webRTC-shareDevice-16.png
skin/classic/browser/webRTC-shareDevice-64.png
skin/classic/browser/webRTC-sharingDevice-16.png (../shared/webrtc/webRTC-sharingDevice-16.png)

View File

@ -2522,6 +2522,32 @@ richlistitem[type~="action"][actiontype="switchtab"][selected="true"] > .ac-url-
}
}
/* Reader mode button */
#reader-mode-button {
list-style-image: url("chrome://browser/skin/reader-mode-16.png");
-moz-image-region: rect(0, 16px, 16px, 0);
}
#reader-mode-button:hover:active,
#reader-mode-button[readeractive] {
-moz-image-region: rect(0, 32px, 16px, 16px);
}
@media (min-resolution: 2dppx) {
#reader-mode-button{
list-style-image: url("chrome://browser/skin/reader-mode-16@2x.png");
-moz-image-region: rect(0, 32px, 32px, 0);
width: 22px;
}
#reader-mode-button:hover:active,
#reader-mode-button[readeractive] {
-moz-image-region: rect(0, 64px, 32px, 32px);
}
}
/* social share panel */
.social-share-frame {
border-top: 1px solid #f8f8f8;

View File

@ -135,6 +135,8 @@ browser.jar:
skin/classic/browser/urlbar-arrow@2x.png
skin/classic/browser/urlbar-popup-blocked.png
skin/classic/browser/urlbar-popup-blocked@2x.png
skin/classic/browser/reader-mode-16.png (../shared/reader/reader-mode-16.png)
skin/classic/browser/reader-mode-16@2x.png (../shared/reader/reader-mode-16@2x.png)
skin/classic/browser/webRTC-shareDevice-16.png
skin/classic/browser/webRTC-shareDevice-16@2x.png
skin/classic/browser/webRTC-shareDevice-64.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 502 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

View File

@ -1576,6 +1576,18 @@ richlistitem[type~="action"][actiontype="switchtab"] > .ac-url-box > .ac-action-
-moz-image-region: rect(0, 48px, 16px, 32px);
}
/* Reader mode button */
#reader-mode-button {
list-style-image: url("chrome://browser/skin/reader-mode-16.png");
-moz-image-region: rect(0, 16px, 16px, 0);
}
#reader-mode-button:hover:active,
#reader-mode-button[readeractive] {
-moz-image-region: rect(0, 32px, 16px, 16px);
}
/* social share panel */
.social-share-frame {

View File

@ -104,6 +104,7 @@ browser.jar:
skin/classic/browser/urlbar-arrow.png
skin/classic/browser/urlbar-popup-blocked.png
skin/classic/browser/urlbar-history-dropmarker.png
skin/classic/browser/reader-mode-16.png (../shared/reader/reader-mode-16.png)
skin/classic/browser/notification-pluginNormal.png (../shared/plugins/notification-pluginNormal.png)
skin/classic/browser/notification-pluginAlert.png (../shared/plugins/notification-pluginAlert.png)
skin/classic/browser/notification-pluginBlocked.png (../shared/plugins/notification-pluginBlocked.png)
@ -562,6 +563,7 @@ browser.jar:
skin/classic/aero/browser/urlbar-arrow.png
skin/classic/aero/browser/urlbar-popup-blocked.png
skin/classic/aero/browser/urlbar-history-dropmarker.png
skin/classic/aero/browser/reader-mode-16.png (../shared/reader/reader-mode-16.png)
skin/classic/aero/browser/notification-pluginNormal.png (../shared/plugins/notification-pluginNormal.png)
skin/classic/aero/browser/notification-pluginAlert.png (../shared/plugins/notification-pluginAlert.png)
skin/classic/aero/browser/notification-pluginBlocked.png (../shared/plugins/notification-pluginBlocked.png)

View File

@ -220,7 +220,7 @@ public:
}
}
if (isInterestingDecl(d)) {
if (!d->isAbstract() && isInterestingDecl(d)) {
for (CXXRecordDecl::ctor_iterator ctor = d->ctor_begin(),
e = d->ctor_end(); ctor != e; ++ctor) {
// Ignore non-converting ctors
@ -241,7 +241,10 @@ public:
}
unsigned ctorID = Diag.getDiagnosticIDs()->getCustomDiagID(
DiagnosticIDs::Error, "bad implicit conversion constructor for %0");
unsigned noteID = Diag.getDiagnosticIDs()->getCustomDiagID(
DiagnosticIDs::Note, "consider adding the explicit keyword to the constructor");
Diag.Report(ctor->getLocation(), ctorID) << d->getDeclName();
Diag.Report(ctor->getLocation(), noteID);
}
}

View File

@ -1,9 +1,9 @@
#define MOZ_IMPLICIT __attribute__((annotate("moz_implicit")))
struct Foo {
Foo(int); // expected-error {{bad implicit conversion constructor for 'Foo'}}
Foo(int, char=0); // expected-error {{bad implicit conversion constructor for 'Foo'}}
Foo(...); // expected-error {{bad implicit conversion constructor for 'Foo'}}
Foo(int); // expected-error {{bad implicit conversion constructor for 'Foo'}} expected-note {{consider adding the explicit keyword to the constructor}}
Foo(int, char=0); // expected-error {{bad implicit conversion constructor for 'Foo'}} expected-note {{consider adding the explicit keyword to the constructor}}
Foo(...); // expected-error {{bad implicit conversion constructor for 'Foo'}} expected-note {{consider adding the explicit keyword to the constructor}}
Foo(int, unsigned);
Foo(Foo&);
Foo(const Foo&);
@ -32,3 +32,10 @@ struct Barn {
Barn(int, char=0) = delete;
Barn(...) = delete;
};
struct Abstract {
Abstract(int);
Abstract(int, char=0);
Abstract(...);
virtual void f() = 0;
};

View File

@ -1296,7 +1296,7 @@ public:
nsIContent* aContent,
nsIDocument* aDoc);
NS_IMETHOD Run();
NS_IMETHOD Run() MOZ_OVERRIDE;
private:
virtual ~RemoveFromBindingManagerRunnable();
nsRefPtr<nsBindingManager> mManager;

View File

@ -215,14 +215,14 @@ NS_GetContentList(nsINode* aRootNode,
};
// Initialize the hashtable if needed.
if (!gContentListHashTable.ops) {
if (!gContentListHashTable.IsInitialized()) {
PL_DHashTableInit(&gContentListHashTable, &hash_table_ops,
sizeof(ContentListHashEntry));
}
ContentListHashEntry *entry = nullptr;
// First we look in our hashtable. Then we create a content list if needed
if (gContentListHashTable.ops) {
if (gContentListHashTable.IsInitialized()) {
// A PL_DHASH_ADD is equivalent to a PL_DHASH_LOOKUP for cases
// when the entry is already in the hashtable.
@ -325,14 +325,14 @@ GetFuncStringContentList(nsINode* aRootNode,
};
// Initialize the hashtable if needed.
if (!gFuncStringContentListHashTable.ops) {
if (!gFuncStringContentListHashTable.IsInitialized()) {
PL_DHashTableInit(&gFuncStringContentListHashTable, &hash_table_ops,
sizeof(FuncStringContentListHashEntry));
}
FuncStringContentListHashEntry *entry = nullptr;
// First we look in our hashtable. Then we create a content list if needed
if (gFuncStringContentListHashTable.ops) {
if (gFuncStringContentListHashTable.IsInitialized()) {
nsFuncStringCacheKey hashKey(aRootNode, aFunc, aString);
// A PL_DHASH_ADD is equivalent to a PL_DHASH_LOOKUP for cases
@ -977,14 +977,13 @@ nsContentList::RemoveFromHashtable()
sRecentlyUsedContentLists[recentlyUsedCacheIndex] = nullptr;
}
if (!gContentListHashTable.ops)
if (!gContentListHashTable.IsInitialized())
return;
PL_DHashTableRemove(&gContentListHashTable, &key);
if (gContentListHashTable.EntryCount() == 0) {
PL_DHashTableFinish(&gContentListHashTable);
gContentListHashTable.ops = nullptr;
}
}
@ -1016,7 +1015,7 @@ nsCacheableFuncStringContentList::~nsCacheableFuncStringContentList()
void
nsCacheableFuncStringContentList::RemoveFromFuncStringHashtable()
{
if (!gFuncStringContentListHashTable.ops) {
if (!gFuncStringContentListHashTable.IsInitialized()) {
return;
}
@ -1025,7 +1024,6 @@ nsCacheableFuncStringContentList::RemoveFromFuncStringHashtable()
if (gFuncStringContentListHashTable.EntryCount() == 0) {
PL_DHashTableFinish(&gFuncStringContentListHashTable);
gFuncStringContentListHashTable.ops = nullptr;
}
}

View File

@ -344,7 +344,7 @@ public:
{
// We don't measure the |EventListenerManager| objects pointed to by the
// entries because those references are non-owning.
int64_t amount = sEventListenerManagersHash.ops
int64_t amount = sEventListenerManagersHash.IsInitialized()
? PL_DHashTableSizeOfExcludingThis(
&sEventListenerManagersHash, nullptr, MallocSizeOf)
: 0;
@ -476,7 +476,7 @@ nsContentUtils::Init()
if (!InitializeEventTable())
return NS_ERROR_FAILURE;
if (!sEventListenerManagersHash.ops) {
if (!sEventListenerManagersHash.IsInitialized()) {
static const PLDHashTableOps hash_table_ops =
{
PL_DHashVoidPtrKeyStub,
@ -1761,7 +1761,7 @@ nsContentUtils::Shutdown()
delete sUserDefinedEvents;
sUserDefinedEvents = nullptr;
if (sEventListenerManagersHash.ops) {
if (sEventListenerManagersHash.IsInitialized()) {
NS_ASSERTION(sEventListenerManagersHash.EntryCount() == 0,
"Event listener manager hash not empty at shutdown!");
@ -1776,7 +1776,6 @@ nsContentUtils::Shutdown()
if (sEventListenerManagersHash.EntryCount() == 0) {
PL_DHashTableFinish(&sEventListenerManagersHash);
sEventListenerManagersHash.ops = nullptr;
}
}
@ -3911,7 +3910,7 @@ ListenerEnumerator(PLDHashTable* aTable, PLDHashEntryHdr* aEntry,
void
nsContentUtils::UnmarkGrayJSListenersInCCGenerationDocuments(uint32_t aGeneration)
{
if (sEventListenerManagersHash.ops) {
if (sEventListenerManagersHash.IsInitialized()) {
PL_DHashTableEnumerate(&sEventListenerManagersHash, ListenerEnumerator,
&aGeneration);
}
@ -3922,7 +3921,7 @@ void
nsContentUtils::TraverseListenerManager(nsINode *aNode,
nsCycleCollectionTraversalCallback &cb)
{
if (!sEventListenerManagersHash.ops) {
if (!sEventListenerManagersHash.IsInitialized()) {
// We're already shut down, just return.
return;
}
@ -3939,7 +3938,7 @@ nsContentUtils::TraverseListenerManager(nsINode *aNode,
EventListenerManager*
nsContentUtils::GetListenerManagerForNode(nsINode *aNode)
{
if (!sEventListenerManagersHash.ops) {
if (!sEventListenerManagersHash.IsInitialized()) {
// We're already shut down, don't bother creating an event listener
// manager.
@ -3970,7 +3969,7 @@ nsContentUtils::GetExistingListenerManagerForNode(const nsINode *aNode)
return nullptr;
}
if (!sEventListenerManagersHash.ops) {
if (!sEventListenerManagersHash.IsInitialized()) {
// We're already shut down, don't bother creating an event listener
// manager.
@ -3991,7 +3990,7 @@ nsContentUtils::GetExistingListenerManagerForNode(const nsINode *aNode)
void
nsContentUtils::RemoveListenerManager(nsINode *aNode)
{
if (sEventListenerManagersHash.ops) {
if (sEventListenerManagersHash.IsInitialized()) {
EventListenerManagerMapEntry *entry =
static_cast<EventListenerManagerMapEntry *>
(PL_DHashTableLookup(&sEventListenerManagersHash, aNode));

View File

@ -2032,7 +2032,7 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INTERNAL(nsDocument)
tmp->mAnimationController->Traverse(&cb);
}
if (tmp->mSubDocuments && tmp->mSubDocuments->ops) {
if (tmp->mSubDocuments && tmp->mSubDocuments->IsInitialized()) {
PL_DHashTableEnumerate(tmp->mSubDocuments, SubDocTraverser, &cb);
}

View File

@ -148,7 +148,8 @@ public:
{
}
bool ToObject(JSContext* aCx, JS::MutableHandle<JSObject*> aObjp);
virtual bool ToObject(JSContext* aCx, JS::MutableHandle<JSObject*> aObjp)
MOZ_OVERRIDE;
private:
JS::Rooted<JSObject*> mObj;

View File

@ -192,7 +192,7 @@ public:
: mReport(aReport)
{}
NS_IMETHOD Run()
NS_IMETHOD Run() MOZ_OVERRIDE
{
mReport->LogToConsole();
return NS_OK;

View File

@ -215,7 +215,7 @@ nsPropertyTable::SetPropertyInternal(nsPropertyOwner aObject,
} else {
propertyList = new PropertyList(aPropertyName, aPropDtorFunc,
aPropDtorData, aTransfer);
if (!propertyList || !propertyList->mObjectValueMap.ops) {
if (!propertyList || !propertyList->mObjectValueMap.IsInitialized()) {
delete propertyList;
return NS_ERROR_OUT_OF_MEMORY;
}

View File

@ -53,8 +53,8 @@ extern bool gBluetoothDebugFlag;
} \
} while(0)
#define BT_LOGR(msg, ...) printf("%s: " msg, __FUNCTION__, ##__VA_ARGS__))
#define BT_WARNING(msg, ...) printf("%s: " msg, __FUNCTION__, ##__VA_ARGS__))
#define BT_LOGR(msg, ...) printf("%s: " msg, __FUNCTION__, ##__VA_ARGS__)
#define BT_WARNING(msg, ...) printf("%s: " msg, __FUNCTION__, ##__VA_ARGS__)
#endif
/**

View File

@ -66,8 +66,8 @@ extern bool gBluetoothDebugFlag;
} \
} while(0)
#define BT_LOGR(msg, ...) printf("%s: " msg, __FUNCTION__, ##__VA_ARGS__))
#define BT_WARNING(msg, ...) printf("%s: " msg, __FUNCTION__, ##__VA_ARGS__))
#define BT_LOGR(msg, ...) printf("%s: " msg, __FUNCTION__, ##__VA_ARGS__)
#define BT_WARNING(msg, ...) printf("%s: " msg, __FUNCTION__, ##__VA_ARGS__)
#endif
/**

View File

@ -126,8 +126,10 @@ WebGLMemoryTracker::GetBufferCacheMemoryUsed()
buffer;
buffer = buffer->getNext())
{
if (buffer->Target() == LOCAL_GL_ELEMENT_ARRAY_BUFFER)
if (buffer->HasEverBeenBound() &&
buffer->Target() == LOCAL_GL_ELEMENT_ARRAY_BUFFER) {
result += buffer->SizeOfIncludingThis(WebGLBufferMallocSizeOf);
}
}
}
return result;

View File

@ -317,25 +317,25 @@ public:
NS_FORWARD_NSIDOMELEMENT_TO_GENERIC
NS_IMETHOD GetTitle(nsAString& aTitle) MOZ_FINAL {
NS_IMETHOD GetTitle(nsAString& aTitle) MOZ_FINAL MOZ_OVERRIDE {
nsString title;
GetTitle(title);
aTitle.Assign(title);
return NS_OK;
}
NS_IMETHOD GetLang(nsAString& aLang) MOZ_FINAL {
NS_IMETHOD GetLang(nsAString& aLang) MOZ_FINAL MOZ_OVERRIDE {
nsString lang;
GetLang(lang);
aLang.Assign(lang);
return NS_OK;
}
NS_IMETHOD GetDir(nsAString& aDir) MOZ_FINAL {
NS_IMETHOD GetDir(nsAString& aDir) MOZ_FINAL MOZ_OVERRIDE {
nsString dir;
GetDir(dir);
aDir.Assign(dir);
return NS_OK;
}
NS_IMETHOD SetDir(const nsAString& aDir) MOZ_FINAL {
NS_IMETHOD SetDir(const nsAString& aDir) MOZ_FINAL MOZ_OVERRIDE {
mozilla::ErrorResult rv;
SetDir(aDir, rv);
return rv.ErrorCode();
@ -348,131 +348,137 @@ public:
SetClassName(aClassName);
return NS_OK;
}
NS_IMETHOD GetDataset(nsISupports** aDataset) MOZ_FINAL;
NS_IMETHOD GetHidden(bool* aHidden) MOZ_FINAL {
NS_IMETHOD GetDataset(nsISupports** aDataset) MOZ_FINAL MOZ_OVERRIDE;
NS_IMETHOD GetHidden(bool* aHidden) MOZ_FINAL MOZ_OVERRIDE {
*aHidden = Hidden();
return NS_OK;
}
NS_IMETHOD SetHidden(bool aHidden) MOZ_FINAL {
NS_IMETHOD SetHidden(bool aHidden) MOZ_FINAL MOZ_OVERRIDE {
mozilla::ErrorResult rv;
SetHidden(aHidden, rv);
return rv.ErrorCode();
}
NS_IMETHOD DOMBlur() MOZ_FINAL {
NS_IMETHOD DOMBlur() MOZ_FINAL MOZ_OVERRIDE {
mozilla::ErrorResult rv;
Blur(rv);
return rv.ErrorCode();
}
NS_IMETHOD GetItemScope(bool* aItemScope) MOZ_FINAL {
NS_IMETHOD GetItemScope(bool* aItemScope) MOZ_FINAL MOZ_OVERRIDE {
*aItemScope = ItemScope();
return NS_OK;
}
NS_IMETHOD SetItemScope(bool aItemScope) MOZ_FINAL {
NS_IMETHOD SetItemScope(bool aItemScope) MOZ_FINAL MOZ_OVERRIDE {
mozilla::ErrorResult rv;
SetItemScope(aItemScope, rv);
return rv.ErrorCode();
}
NS_IMETHOD GetItemType(nsIVariant** aType) MOZ_FINAL {
NS_IMETHOD GetItemType(nsIVariant** aType) MOZ_FINAL MOZ_OVERRIDE {
GetTokenList(nsGkAtoms::itemtype, aType);
return NS_OK;
}
NS_IMETHOD SetItemType(nsIVariant* aType) MOZ_FINAL {
NS_IMETHOD SetItemType(nsIVariant* aType) MOZ_FINAL MOZ_OVERRIDE {
return SetTokenList(nsGkAtoms::itemtype, aType);
}
NS_IMETHOD GetItemId(nsAString& aId) MOZ_FINAL {
NS_IMETHOD GetItemId(nsAString& aId) MOZ_FINAL MOZ_OVERRIDE {
nsString id;
GetItemId(id);
aId.Assign(aId);
return NS_OK;
}
NS_IMETHOD SetItemId(const nsAString& aId) MOZ_FINAL {
NS_IMETHOD SetItemId(const nsAString& aId) MOZ_FINAL MOZ_OVERRIDE {
mozilla::ErrorResult rv;
SetItemId(aId, rv);
return rv.ErrorCode();
}
NS_IMETHOD GetProperties(nsISupports** aReturn) MOZ_FINAL;
NS_IMETHOD GetItemValue(nsIVariant** aValue) MOZ_FINAL;
NS_IMETHOD SetItemValue(nsIVariant* aValue) MOZ_FINAL;
NS_IMETHOD GetItemRef(nsIVariant** aRef) MOZ_FINAL {
NS_IMETHOD GetProperties(nsISupports** aReturn) MOZ_FINAL MOZ_OVERRIDE;
NS_IMETHOD GetItemValue(nsIVariant** aValue) MOZ_FINAL MOZ_OVERRIDE;
NS_IMETHOD SetItemValue(nsIVariant* aValue) MOZ_FINAL MOZ_OVERRIDE;
NS_IMETHOD GetItemRef(nsIVariant** aRef) MOZ_FINAL MOZ_OVERRIDE {
GetTokenList(nsGkAtoms::itemref, aRef);
return NS_OK;
}
NS_IMETHOD SetItemRef(nsIVariant* aRef) MOZ_FINAL {
NS_IMETHOD SetItemRef(nsIVariant* aRef) MOZ_FINAL MOZ_OVERRIDE {
return SetTokenList(nsGkAtoms::itemref, aRef);
}
NS_IMETHOD GetItemProp(nsIVariant** aProp) MOZ_FINAL {
NS_IMETHOD GetItemProp(nsIVariant** aProp) MOZ_FINAL MOZ_OVERRIDE {
GetTokenList(nsGkAtoms::itemprop, aProp);
return NS_OK;
}
NS_IMETHOD SetItemProp(nsIVariant* aProp) MOZ_FINAL {
NS_IMETHOD SetItemProp(nsIVariant* aProp) MOZ_FINAL MOZ_OVERRIDE {
return SetTokenList(nsGkAtoms::itemprop, aProp);
}
NS_IMETHOD GetAccessKey(nsAString& aAccessKey) MOZ_FINAL {
NS_IMETHOD GetAccessKey(nsAString& aAccessKey) MOZ_FINAL MOZ_OVERRIDE {
nsString accessKey;
GetAccessKey(accessKey);
aAccessKey.Assign(accessKey);
return NS_OK;
}
NS_IMETHOD SetAccessKey(const nsAString& aAccessKey) MOZ_FINAL {
NS_IMETHOD SetAccessKey(const nsAString& aAccessKey) MOZ_FINAL MOZ_OVERRIDE {
mozilla::ErrorResult rv;
SetAccessKey(aAccessKey, rv);
return rv.ErrorCode();
}
NS_IMETHOD GetAccessKeyLabel(nsAString& aAccessKeyLabel) MOZ_FINAL {
NS_IMETHOD GetAccessKeyLabel(nsAString& aAccessKeyLabel)
MOZ_FINAL MOZ_OVERRIDE {
nsString accessKeyLabel;
GetAccessKeyLabel(accessKeyLabel);
aAccessKeyLabel.Assign(accessKeyLabel);
return NS_OK;
}
NS_IMETHOD SetDraggable(bool aDraggable) MOZ_FINAL {
NS_IMETHOD SetDraggable(bool aDraggable) MOZ_FINAL MOZ_OVERRIDE {
mozilla::ErrorResult rv;
SetDraggable(aDraggable, rv);
return rv.ErrorCode();
}
NS_IMETHOD GetContentEditable(nsAString& aContentEditable) MOZ_FINAL {
NS_IMETHOD GetContentEditable(nsAString& aContentEditable)
MOZ_FINAL MOZ_OVERRIDE {
nsString contentEditable;
GetContentEditable(contentEditable);
aContentEditable.Assign(contentEditable);
return NS_OK;
}
NS_IMETHOD SetContentEditable(const nsAString& aContentEditable) MOZ_FINAL {
NS_IMETHOD SetContentEditable(const nsAString& aContentEditable)
MOZ_FINAL MOZ_OVERRIDE {
mozilla::ErrorResult rv;
SetContentEditable(aContentEditable, rv);
return rv.ErrorCode();
}
NS_IMETHOD GetIsContentEditable(bool* aIsContentEditable) MOZ_FINAL {
NS_IMETHOD GetIsContentEditable(bool* aIsContentEditable)
MOZ_FINAL MOZ_OVERRIDE {
*aIsContentEditable = IsContentEditable();
return NS_OK;
}
NS_IMETHOD GetContextMenu(nsIDOMHTMLMenuElement** aContextMenu) MOZ_FINAL;
NS_IMETHOD GetSpellcheck(bool* aSpellcheck) MOZ_FINAL {
NS_IMETHOD GetContextMenu(nsIDOMHTMLMenuElement** aContextMenu)
MOZ_FINAL MOZ_OVERRIDE;
NS_IMETHOD GetSpellcheck(bool* aSpellcheck) MOZ_FINAL MOZ_OVERRIDE {
*aSpellcheck = Spellcheck();
return NS_OK;
}
NS_IMETHOD SetSpellcheck(bool aSpellcheck) MOZ_FINAL {
NS_IMETHOD SetSpellcheck(bool aSpellcheck) MOZ_FINAL MOZ_OVERRIDE {
mozilla::ErrorResult rv;
SetSpellcheck(aSpellcheck, rv);
return rv.ErrorCode();
}
NS_IMETHOD GetOuterHTML(nsAString& aOuterHTML) MOZ_FINAL {
NS_IMETHOD GetOuterHTML(nsAString& aOuterHTML) MOZ_FINAL MOZ_OVERRIDE {
mozilla::dom::Element::GetOuterHTML(aOuterHTML);
return NS_OK;
}
NS_IMETHOD SetOuterHTML(const nsAString& aOuterHTML) MOZ_FINAL {
NS_IMETHOD SetOuterHTML(const nsAString& aOuterHTML) MOZ_FINAL MOZ_OVERRIDE {
mozilla::ErrorResult rv;
mozilla::dom::Element::SetOuterHTML(aOuterHTML, rv);
return rv.ErrorCode();
} \
NS_IMETHOD InsertAdjacentHTML(const nsAString& position,
const nsAString& text) MOZ_FINAL;
NS_IMETHOD ScrollIntoView(bool top, uint8_t _argc) MOZ_FINAL {
const nsAString& text) MOZ_FINAL MOZ_OVERRIDE;
NS_IMETHOD ScrollIntoView(bool top, uint8_t _argc) MOZ_FINAL MOZ_OVERRIDE {
if (!_argc) {
top = true;
}
mozilla::dom::Element::ScrollIntoView(top);
return NS_OK;
}
NS_IMETHOD GetOffsetParent(nsIDOMElement** aOffsetParent) MOZ_FINAL {
NS_IMETHOD GetOffsetParent(nsIDOMElement** aOffsetParent)
MOZ_FINAL MOZ_OVERRIDE {
mozilla::dom::Element* offsetParent = GetOffsetParent();
if (!offsetParent) {
*aOffsetParent = nullptr;
@ -480,41 +486,41 @@ public:
}
return CallQueryInterface(offsetParent, aOffsetParent);
}
NS_IMETHOD GetOffsetTop(int32_t* aOffsetTop) MOZ_FINAL {
NS_IMETHOD GetOffsetTop(int32_t* aOffsetTop) MOZ_FINAL MOZ_OVERRIDE {
*aOffsetTop = OffsetTop();
return NS_OK;
}
NS_IMETHOD GetOffsetLeft(int32_t* aOffsetLeft) MOZ_FINAL {
NS_IMETHOD GetOffsetLeft(int32_t* aOffsetLeft) MOZ_FINAL MOZ_OVERRIDE {
*aOffsetLeft = OffsetLeft();
return NS_OK;
}
NS_IMETHOD GetOffsetWidth(int32_t* aOffsetWidth) MOZ_FINAL {
NS_IMETHOD GetOffsetWidth(int32_t* aOffsetWidth) MOZ_FINAL MOZ_OVERRIDE {
*aOffsetWidth = OffsetWidth();
return NS_OK;
}
NS_IMETHOD GetOffsetHeight(int32_t* aOffsetHeight) MOZ_FINAL {
NS_IMETHOD GetOffsetHeight(int32_t* aOffsetHeight) MOZ_FINAL MOZ_OVERRIDE {
*aOffsetHeight = OffsetHeight();
return NS_OK;
}
NS_IMETHOD DOMClick() MOZ_FINAL {
NS_IMETHOD DOMClick() MOZ_FINAL MOZ_OVERRIDE {
Click();
return NS_OK;
}
NS_IMETHOD GetTabIndex(int32_t* aTabIndex) MOZ_FINAL {
NS_IMETHOD GetTabIndex(int32_t* aTabIndex) MOZ_FINAL MOZ_OVERRIDE {
*aTabIndex = TabIndex();
return NS_OK;
}
NS_IMETHOD SetTabIndex(int32_t aTabIndex) MOZ_FINAL {
NS_IMETHOD SetTabIndex(int32_t aTabIndex) MOZ_FINAL MOZ_OVERRIDE {
mozilla::ErrorResult rv;
SetTabIndex(aTabIndex, rv);
return rv.ErrorCode();
}
NS_IMETHOD Focus() MOZ_FINAL {
NS_IMETHOD Focus() MOZ_FINAL MOZ_OVERRIDE {
mozilla::ErrorResult rv;
Focus(rv);
return rv.ErrorCode();
}
NS_IMETHOD GetDraggable(bool* aDraggable) MOZ_FINAL {
NS_IMETHOD GetDraggable(bool* aDraggable) MOZ_FINAL MOZ_OVERRIDE {
*aDraggable = Draggable();
return NS_OK;
}
@ -522,7 +528,7 @@ public:
return mozilla::dom::Element::GetInnerHTML(aInnerHTML);
}
using mozilla::dom::Element::SetInnerHTML;
NS_IMETHOD SetInnerHTML(const nsAString& aInnerHTML) MOZ_FINAL {
NS_IMETHOD SetInnerHTML(const nsAString& aInnerHTML) MOZ_FINAL MOZ_OVERRIDE {
mozilla::ErrorResult rv;
SetInnerHTML(aInnerHTML, rv);
return rv.ErrorCode();

View File

@ -107,7 +107,6 @@ InvokeAndRetry(ThisType* aThisVal, ReturnType(ThisType::*aMethod)(), MP4Stream*
}
}
MP4Reader::MP4Reader(AbstractMediaDecoder* aDecoder)
: MediaDecoderReader(aDecoder)
, mAudio(MediaData::AUDIO_DATA, Preferences::GetUint("media.mp4-audio-decode-ahead", 2))
@ -196,6 +195,7 @@ MP4Reader::InitLayersBackendType()
}
static bool sIsEMEEnabled = false;
static bool sDemuxSkipToNextKeyframe = true;
nsresult
MP4Reader::Init(MediaDecoderReader* aCloneDonor)
@ -217,6 +217,7 @@ MP4Reader::Init(MediaDecoderReader* aCloneDonor)
if (!sSetupPrefCache) {
sSetupPrefCache = true;
Preferences::AddBoolVarCache(&sIsEMEEnabled, "media.eme.enabled", false);
Preferences::AddBoolVarCache(&sDemuxSkipToNextKeyframe, "media.fmp4.demux-skip", true);
}
return NS_OK;
@ -519,6 +520,29 @@ MP4Reader::GetDecoderData(TrackType aTrack)
return mVideo;
}
Microseconds
MP4Reader::GetNextKeyframeTime()
{
MonitorAutoLock mon(mDemuxerMonitor);
return mDemuxer->GetNextKeyframeTime();
}
bool
MP4Reader::ShouldSkip(bool aSkipToNextKeyframe, int64_t aTimeThreshold)
{
// The MP4Reader doesn't do normal skip-to-next-keyframe if the demuxer
// has exposes where the next keyframe is. We can then instead skip only
// if the time threshold (the current playback position) is after the next
// keyframe in the stream. This means we'll only skip frames that we have
// no hope of ever playing.
Microseconds nextKeyframe = -1;
if (!sDemuxSkipToNextKeyframe ||
(nextKeyframe = GetNextKeyframeTime()) == -1) {
return aSkipToNextKeyframe;
}
return nextKeyframe < aTimeThreshold;
}
nsRefPtr<MediaDecoderReader::VideoDataPromise>
MP4Reader::RequestVideoData(bool aSkipToNextKeyframe,
int64_t aTimeThreshold)
@ -537,7 +561,7 @@ MP4Reader::RequestVideoData(bool aSkipToNextKeyframe,
MOZ_ASSERT(HasVideo() && mPlatform && mVideo.mDecoder);
bool eos = false;
if (aSkipToNextKeyframe) {
if (ShouldSkip(aSkipToNextKeyframe, aTimeThreshold)) {
uint32_t parsed = 0;
eos = !SkipVideoDemuxToNextKeyFrame(aTimeThreshold, parsed);
if (!eos && NS_FAILED(mVideo.mDecoder->Flush())) {

View File

@ -121,6 +121,9 @@ private:
bool IsWaitingOnCodecResource();
virtual bool IsWaitingOnCDMResource() MOZ_OVERRIDE;
Microseconds GetNextKeyframeTime();
bool ShouldSkip(bool aSkipToNextKeyframe, int64_t aTimeThreshold);
size_t SizeOfQueue(TrackType aTrack);
nsRefPtr<MP4Stream> mStream;

View File

@ -356,10 +356,6 @@ AppleVDADecoder::SubmitFrame(mp4_demuxer::MP4Sample* aSample)
block,
frameInfo);
LOG("[%s]: FrameInfo retain count = %ld",
__func__, CFGetRetainCount(frameInfo));
MOZ_ASSERT(CFGetRetainCount(frameInfo) >= 2, "Bad retain count");
if (rv != noErr) {
NS_WARNING("AppleVDADecoder: Couldn't pass frame to decoder");
return NS_ERROR_FAILURE;

View File

@ -48,9 +48,9 @@ MFTDecoder::Create(const GUID& aMFTClsID)
HRESULT
MFTDecoder::SetMediaTypes(IMFMediaType* aInputType,
const GUID& aOutputSubType)
IMFMediaType* aOutputType)
{
mOutputSubtype = aOutputSubType;
mOutputType = aOutputType;
// Set the input type to the one the caller gave us...
HRESULT hr = mDecoder->SetInputType(0, aInputType, 0);
@ -96,21 +96,14 @@ MFTDecoder::SetDecoderOutputType()
RefPtr<IMFMediaType> outputType;
UINT32 typeIndex = 0;
while (SUCCEEDED(mDecoder->GetOutputAvailableType(0, typeIndex++, byRef(outputType)))) {
GUID subtype;
hr = outputType->GetGUID(MF_MT_SUBTYPE, &subtype);
if (FAILED(hr)) {
continue;
}
if (subtype == mOutputSubtype) {
if (subtype == MFAudioFormat_PCM) {
// Set output to PCM 16 bits, we can ignore errors.
outputType->SetUINT32(MF_MT_SAMPLE_SIZE, 2);
outputType->SetUINT32(MF_MT_AUDIO_BITS_PER_SAMPLE, 16);
}
BOOL resultMatch;
hr = mOutputType->Compare(outputType, MF_ATTRIBUTES_MATCH_OUR_ITEMS, &resultMatch);
if (SUCCEEDED(hr) && resultMatch == TRUE) {
hr = mDecoder->SetOutputType(0, outputType, 0);
NS_ENSURE_TRUE(SUCCEEDED(hr), hr);
return S_OK;
}
outputType = nullptr;
}
return E_FAIL;
}

View File

@ -33,11 +33,11 @@ public:
//
// Params:
// - aInputType needs at least major and minor types set.
// - aOutputSubType is the minor type of the same major type e.g.
// MFVideoFormat_H264. This is used to select the output type out
// - aOutputType needs at least major and minor types set.
// This is used to select the matching output type out
// of all the available output types of the MFT.
HRESULT SetMediaTypes(IMFMediaType* aInputType,
const GUID& aOutputSubType);
IMFMediaType* aOutputType);
// Returns the MFT's IMFAttributes object.
TemporaryRef<IMFAttributes> GetAttributes();
@ -92,7 +92,7 @@ private:
RefPtr<IMFTransform> mDecoder;
GUID mOutputSubtype;
RefPtr<IMFMediaType> mOutputType;
// True if the IMFTransform allocates the samples that it returns.
bool mMFTProvidesOutputSamples;

View File

@ -128,34 +128,47 @@ WMFAudioMFTManager::Init()
NS_ENSURE_TRUE(SUCCEEDED(hr), nullptr);
// Setup input/output media types
RefPtr<IMFMediaType> type;
RefPtr<IMFMediaType> inputType;
hr = wmf::MFCreateMediaType(byRef(type));
hr = wmf::MFCreateMediaType(byRef(inputType));
NS_ENSURE_TRUE(SUCCEEDED(hr), nullptr);
hr = type->SetGUID(MF_MT_MAJOR_TYPE, MFMediaType_Audio);
hr = inputType->SetGUID(MF_MT_MAJOR_TYPE, MFMediaType_Audio);
NS_ENSURE_TRUE(SUCCEEDED(hr), nullptr);
hr = type->SetGUID(MF_MT_SUBTYPE, GetMediaSubtypeGUID());
hr = inputType->SetGUID(MF_MT_SUBTYPE, GetMediaSubtypeGUID());
NS_ENSURE_TRUE(SUCCEEDED(hr), nullptr);
hr = type->SetUINT32(MF_MT_AUDIO_SAMPLES_PER_SECOND, mAudioRate);
hr = inputType->SetUINT32(MF_MT_AUDIO_SAMPLES_PER_SECOND, mAudioRate);
NS_ENSURE_TRUE(SUCCEEDED(hr), nullptr);
hr = type->SetUINT32(MF_MT_AUDIO_NUM_CHANNELS, mAudioChannels);
hr = inputType->SetUINT32(MF_MT_AUDIO_NUM_CHANNELS, mAudioChannels);
NS_ENSURE_TRUE(SUCCEEDED(hr), nullptr);
if (mStreamType == AAC) {
hr = type->SetUINT32(MF_MT_AAC_PAYLOAD_TYPE, 0x0); // Raw AAC packet
hr = inputType->SetUINT32(MF_MT_AAC_PAYLOAD_TYPE, 0x0); // Raw AAC packet
NS_ENSURE_TRUE(SUCCEEDED(hr), nullptr);
hr = type->SetBlob(MF_MT_USER_DATA,
mUserData.Elements(),
mUserData.Length());
hr = inputType->SetBlob(MF_MT_USER_DATA,
mUserData.Elements(),
mUserData.Length());
NS_ENSURE_TRUE(SUCCEEDED(hr), nullptr);
}
hr = decoder->SetMediaTypes(type, MFAudioFormat_PCM);
RefPtr<IMFMediaType> outputType;
hr = wmf::MFCreateMediaType(byRef(outputType));
NS_ENSURE_TRUE(SUCCEEDED(hr), nullptr);
hr = outputType->SetGUID(MF_MT_MAJOR_TYPE, MFMediaType_Audio);
NS_ENSURE_TRUE(SUCCEEDED(hr), nullptr);
hr = outputType->SetGUID(MF_MT_SUBTYPE, MFAudioFormat_PCM);
NS_ENSURE_TRUE(SUCCEEDED(hr), nullptr);
hr = outputType->SetUINT32(MF_MT_AUDIO_BITS_PER_SAMPLE, 16);
NS_ENSURE_TRUE(SUCCEEDED(hr), nullptr);
hr = decoder->SetMediaTypes(inputType, outputType);
NS_ENSURE_TRUE(SUCCEEDED(hr), nullptr);
mDecoder = decoder;

View File

@ -188,21 +188,31 @@ WMFVideoMFTManager::Init()
}
// Setup the input/output media types.
RefPtr<IMFMediaType> type;
hr = wmf::MFCreateMediaType(byRef(type));
RefPtr<IMFMediaType> inputType;
hr = wmf::MFCreateMediaType(byRef(inputType));
NS_ENSURE_TRUE(SUCCEEDED(hr), nullptr);
hr = type->SetGUID(MF_MT_MAJOR_TYPE, MFMediaType_Video);
hr = inputType->SetGUID(MF_MT_MAJOR_TYPE, MFMediaType_Video);
NS_ENSURE_TRUE(SUCCEEDED(hr), nullptr);
hr = type->SetGUID(MF_MT_SUBTYPE, GetMediaSubtypeGUID());
hr = inputType->SetGUID(MF_MT_SUBTYPE, GetMediaSubtypeGUID());
NS_ENSURE_TRUE(SUCCEEDED(hr), nullptr);
hr = type->SetUINT32(MF_MT_INTERLACE_MODE, MFVideoInterlace_MixedInterlaceOrProgressive);
hr = inputType->SetUINT32(MF_MT_INTERLACE_MODE, MFVideoInterlace_MixedInterlaceOrProgressive);
NS_ENSURE_TRUE(SUCCEEDED(hr), nullptr);
GUID outputType = mUseHwAccel ? MFVideoFormat_NV12 : MFVideoFormat_YV12;
hr = decoder->SetMediaTypes(type, outputType);
RefPtr<IMFMediaType> outputType;
hr = wmf::MFCreateMediaType(byRef(outputType));
NS_ENSURE_TRUE(SUCCEEDED(hr), nullptr);
hr = outputType->SetGUID(MF_MT_MAJOR_TYPE, MFMediaType_Video);
NS_ENSURE_TRUE(SUCCEEDED(hr), nullptr);
GUID outputSubType = mUseHwAccel ? MFVideoFormat_NV12 : MFVideoFormat_YV12;
hr = outputType->SetGUID(MF_MT_SUBTYPE, outputSubType);
NS_ENSURE_TRUE(SUCCEEDED(hr), nullptr);
hr = decoder->SetMediaTypes(inputType, outputType);
NS_ENSURE_TRUE(SUCCEEDED(hr), nullptr);
mDecoder = decoder;

View File

@ -402,7 +402,7 @@ DestroyJSObjWrapperTable()
static bool
CreateNPObjWrapperTable()
{
MOZ_ASSERT(!sNPObjWrappers.ops);
MOZ_ASSERT(!sNPObjWrappers.IsInitialized());
if (!RegisterGCCallbacks()) {
return false;
@ -419,8 +419,6 @@ DestroyNPObjWrapperTable()
MOZ_ASSERT(sNPObjWrappers.EntryCount() == 0);
PL_DHashTableFinish(&sNPObjWrappers);
sNPObjWrappers.ops = nullptr;
}
static void
@ -439,7 +437,7 @@ OnWrapperDestroyed()
DestroyJSObjWrapperTable();
}
if (sNPObjWrappers.ops) {
if (sNPObjWrappers.IsInitialized()) {
// No more wrappers, and our hash was initialized. Finish the
// hash to prevent leaking it.
DestroyNPObjWrapperTable();
@ -1749,7 +1747,7 @@ NPObjWrapper_Finalize(js::FreeOp *fop, JSObject *obj)
{
NPObject *npobj = (NPObject *)::JS_GetPrivate(obj);
if (npobj) {
if (sNPObjWrappers.ops) {
if (sNPObjWrappers.IsInitialized()) {
PL_DHashTableRemove(&sNPObjWrappers, npobj);
}
}
@ -1765,7 +1763,7 @@ NPObjWrapper_ObjectMoved(JSObject *obj, const JSObject *old)
// The wrapper JSObject has been moved, so we need to update the entry in the
// sNPObjWrappers hash table, if present.
if (!sNPObjWrappers.ops) {
if (!sNPObjWrappers.IsInitialized()) {
return;
}
@ -1824,7 +1822,7 @@ nsNPObjWrapper::OnDestroy(NPObject *npobj)
return;
}
if (!sNPObjWrappers.ops) {
if (!sNPObjWrappers.IsInitialized()) {
// No hash yet (or any more), no used wrappers available.
return;
@ -1874,7 +1872,7 @@ nsNPObjWrapper::GetNewOrUsed(NPP npp, JSContext *cx, NPObject *npobj)
return nullptr;
}
if (!sNPObjWrappers.ops) {
if (!sNPObjWrappers.IsInitialized()) {
// No hash yet (or any more), initialize it.
if (!CreateNPObjWrapperTable()) {
return nullptr;
@ -1960,8 +1958,8 @@ NPObjWrapperPluginDestroyedCallback(PLDHashTable *table, PLDHashEntryHdr *hdr,
if (entry->mNpp == nppcx->npp) {
// Prevent invalidate() and deallocate() from touching the hash
// we're enumerating.
const PLDHashTableOps *ops = table->ops;
table->ops = nullptr;
const PLDHashTableOps *ops = table->Ops();
table->SetOps(nullptr);
NPObject *npobj = entry->mNPObj;
@ -1989,7 +1987,7 @@ NPObjWrapperPluginDestroyedCallback(PLDHashTable *table, PLDHashEntryHdr *hdr,
::JS_SetPrivate(entry->mJSObj, nullptr);
table->ops = ops;
table->SetOps(ops);
if (sDelayedReleases && sDelayedReleases->RemoveElement(npobj)) {
OnWrapperDestroyed();
@ -2030,7 +2028,7 @@ nsJSNPRuntime::OnPluginDestroy(NPP npp)
// Use the safe JSContext here as we're not always able to find the
// JSContext associated with the NPP any more.
AutoSafeJSContext cx;
if (sNPObjWrappers.ops) {
if (sNPObjWrappers.IsInitialized()) {
NppAndCx nppcx = { npp, cx };
PL_DHashTableEnumerate(&sNPObjWrappers,
NPObjWrapperPluginDestroyedCallback, &nppcx);

View File

@ -15,14 +15,14 @@ nsContentSupportMap::Init()
void
nsContentSupportMap::Finish()
{
if (mMap.ops)
if (mMap.IsInitialized())
PL_DHashTableFinish(&mMap);
}
nsresult
nsContentSupportMap::Remove(nsIContent* aElement)
{
if (!mMap.ops)
if (!mMap.IsInitialized())
return NS_ERROR_NOT_INITIALIZED;
nsIContent* child = aElement;

View File

@ -25,7 +25,7 @@ public:
~nsContentSupportMap() { Finish(); }
nsresult Put(nsIContent* aElement, nsTemplateMatch* aMatch) {
if (!mMap.ops)
if (!mMap.IsInitialized())
return NS_ERROR_NOT_INITIALIZED;
PLDHashEntryHdr* hdr = PL_DHashTableAdd(&mMap, aElement);
@ -39,7 +39,7 @@ public:
return NS_OK; }
bool Get(nsIContent* aElement, nsTemplateMatch** aMatch) {
if (!mMap.ops)
if (!mMap.IsInitialized())
return false;
PLDHashEntryHdr* hdr = PL_DHashTableLookup(&mMap, aElement);

View File

@ -859,7 +859,12 @@ DrawTargetD2D1::factory()
return mFactory;
}
HRESULT hr = D2DFactory()->QueryInterface((ID2D1Factory1**)&mFactory);
ID2D1Factory* d2dFactory = D2DFactory();
if (!d2dFactory) {
return nullptr;
}
HRESULT hr = d2dFactory->QueryInterface((ID2D1Factory1**)&mFactory);
if (FAILED(hr)) {
return nullptr;

View File

@ -649,9 +649,6 @@ APZCTreeManager::ReceiveInputEvent(InputData& aEvent,
break;
}
}
if (hitResult == HitOverscrolledApzc) {
result = nsEventStatus_eConsumeNoDefault;
}
return result;
}
@ -772,9 +769,6 @@ APZCTreeManager::ProcessTouchInput(MultiTouchInput& aInput,
outTransform, touchData.mScreenPoint);
}
}
if (mHitResultForInputBlock == HitOverscrolledApzc) {
result = nsEventStatus_eConsumeNoDefault;
}
if (aInput.mType == MultiTouchInput::MULTITOUCH_END) {
if (mTouchCount >= aInput.mTouches.Length()) {
@ -834,9 +828,6 @@ APZCTreeManager::ProcessEvent(WidgetInputEvent& aEvent,
Matrix4x4 outTransform = transformToApzc * transformToGecko;
aEvent.refPoint = TransformTo<LayoutDevicePixel>(outTransform, aEvent.refPoint);
}
if (hitResult == HitOverscrolledApzc) {
result = nsEventStatus_eConsumeNoDefault;
}
return result;
}
@ -1195,8 +1186,6 @@ APZCTreeManager::GetTargetAPZC(const ScreenPoint& aPoint, HitTestResult* aOutHit
PixelCastJustification::ScreenIsParentLayerForRoot);
nsRefPtr<AsyncPanZoomController> target = GetAPZCAtPoint(mRootNode, point, &hitResult);
// If we are in an overscrolled APZC, we should be returning nullptr.
MOZ_ASSERT(!(target && (hitResult == HitOverscrolledApzc)));
if (aOutHitResult) {
*aOutHitResult = hitResult;
}
@ -1322,8 +1311,6 @@ APZCTreeManager::GetAPZCAtPoint(HitTestingTreeNode* aNode,
// This walks the tree in depth-first, reverse order, so that it encounters
// APZCs front-to-back on the screen.
for (HitTestingTreeNode* node = aNode; node; node = node->GetPrevSibling()) {
AsyncPanZoomController* apzc = node->GetApzc();
if (node->IsOutsideClip(aHitTestPoint)) {
// If the point being tested is outside the clip region for this node
// then we don't need to test against this node or any of its children.
@ -1342,10 +1329,6 @@ APZCTreeManager::GetAPZCAtPoint(HitTestingTreeNode* aNode,
ParentLayerPoint childPoint = ViewAs<ParentLayerPixel>(hitTestPointForChildLayers.ref(),
PixelCastJustification::MovingDownToChildren);
result = GetAPZCAtPoint(node->GetLastChild(), childPoint, aOutHitResult);
if (*aOutHitResult == HitOverscrolledApzc) {
// We matched an overscrolled APZC, abort.
return nullptr;
}
}
// If we didn't match anything in the subtree, check |node|.
@ -1365,15 +1348,6 @@ APZCTreeManager::GetAPZCAtPoint(HitTestingTreeNode* aNode,
}
}
// If we are overscrolled, and the point matches us or one of our children,
// the result is inside an overscrolled APZC, inform our caller of this
// (callers typically ignore events targeted at overscrolled APZCs).
if (*aOutHitResult != HitNothing && apzc && apzc->IsOverscrolled()) {
APZCTM_LOG("Result is inside overscrolled APZC %p\n", apzc);
*aOutHitResult = HitOverscrolledApzc;
return nullptr;
}
if (*aOutHitResult != HitNothing) {
if (result && !gfxPrefs::LayoutEventRegionsEnabled()) {
// When event-regions are disabled, we treat scrollinfo layers as
@ -1523,7 +1497,7 @@ APZCTreeManager::GetScreenToApzcTransform(const AsyncPanZoomController *aApzc) c
// ancestorUntransform is updated to RC.Inverse() * QC.Inverse() when parent == P
ancestorUntransform = parent->GetAncestorTransform().Inverse();
// asyncUntransform is updated to PA.Inverse() when parent == P
Matrix4x4 asyncUntransform = Matrix4x4(parent->GetCurrentAsyncTransform()).Inverse();
Matrix4x4 asyncUntransform = parent->GetCurrentAsyncTransformWithOverscroll().Inverse();
// untransformSinceLastApzc is RC.Inverse() * QC.Inverse() * PA.Inverse()
Matrix4x4 untransformSinceLastApzc = ancestorUntransform * asyncUntransform;
@ -1555,7 +1529,7 @@ APZCTreeManager::GetApzcToGeckoTransform(const AsyncPanZoomController *aApzc) co
// leftmost matrix in a multiplication is applied first.
// asyncUntransform is LA.Inverse()
Matrix4x4 asyncUntransform = Matrix4x4(aApzc->GetCurrentAsyncTransform()).Inverse();
Matrix4x4 asyncUntransform = aApzc->GetCurrentAsyncTransformWithOverscroll().Inverse();
// aTransformToGeckoOut is initialized to LA.Inverse() * LD * MC * NC * OC * PC
result = asyncUntransform * aApzc->GetTransformToLastDispatchedPaint() * aApzc->GetAncestorTransform();

View File

@ -14,7 +14,11 @@ enum HitTestResult {
HitNothing,
HitLayer,
HitDispatchToContentRegion,
HitOverscrolledApzc,
};
enum CancelAnimationFlags : uint32_t {
Default = 0, /* Cancel all animations */
ExcludeOverscroll = 1 /* Don't clear overscroll */
};
}

View File

@ -1146,7 +1146,8 @@ nsEventStatus AsyncPanZoomController::OnTouchStart(const MultiTouchInput& aEvent
case FLING:
case ANIMATING_ZOOM:
case SMOOTH_SCROLL:
CurrentTouchBlock()->GetOverscrollHandoffChain()->CancelAnimations();
case OVERSCROLL_ANIMATION:
CurrentTouchBlock()->GetOverscrollHandoffChain()->CancelAnimations(ExcludeOverscroll);
// Fall through.
case NOTHING: {
mX.StartTouch(point.x, aEvent.mTime);
@ -1226,8 +1227,8 @@ nsEventStatus AsyncPanZoomController::OnTouchMove(const MultiTouchInput& aEvent)
case OVERSCROLL_ANIMATION:
// Should not receive a touch-move in the OVERSCROLL_ANIMATION state
// as touch blocks that begin in an overscrolled state
// are ignored.
// as touch blocks that begin in an overscrolled state cancel the
// animation.
NS_WARNING("Received impossible touch in OnTouchMove");
break;
}
@ -1269,7 +1270,11 @@ nsEventStatus AsyncPanZoomController::OnTouchEnd(const MultiTouchInput& aEvent)
// that were not big enough to trigger scrolling. Clear that out.
mX.SetVelocity(0);
mY.SetVelocity(0);
SetState(NOTHING);
// It's possible we may be overscrolled if the user tapped during a
// previous overscroll pan. Make sure to snap back in this situation.
if (!SnapBackIfOverscrolled()) {
SetState(NOTHING);
}
return nsEventStatus_eIgnore;
case PANNING:
@ -1310,9 +1315,9 @@ nsEventStatus AsyncPanZoomController::OnTouchEnd(const MultiTouchInput& aEvent)
return nsEventStatus_eIgnore;
case OVERSCROLL_ANIMATION:
// Should not receive a touch-move in the OVERSCROLL_ANIMATION state
// as touch blocks that begin in an overscrolled state
// are ignored.
// Should not receive a touch-end in the OVERSCROLL_ANIMATION state
// as touch blocks that begin in an overscrolled state cancel the
// animation.
NS_WARNING("Received impossible touch in OnTouchEnd");
break;
}
@ -2164,7 +2169,7 @@ void AsyncPanZoomController::StartAnimation(AsyncPanZoomAnimation* aAnimation)
ScheduleComposite();
}
void AsyncPanZoomController::CancelAnimation() {
void AsyncPanZoomController::CancelAnimation(CancelAnimationFlags aFlags) {
ReentrantMonitorAutoEnter lock(mMonitor);
APZC_LOG("%p running CancelAnimation in state %d\n", this, mState);
SetState(NOTHING);
@ -2176,7 +2181,7 @@ void AsyncPanZoomController::CancelAnimation() {
// Setting the state to nothing and cancelling the animation can
// preempt normal mechanisms for relieving overscroll, so we need to clear
// overscroll here.
if (mX.IsOverscrolled() || mY.IsOverscrolled()) {
if (!(aFlags & ExcludeOverscroll) && IsOverscrolled()) {
ClearOverscroll();
RequestContentRepaint();
ScheduleComposite();
@ -2653,6 +2658,10 @@ ViewTransform AsyncPanZoomController::GetCurrentAsyncTransform() const {
return ViewTransform(mFrameMetrics.GetAsyncZoom(), -translation);
}
Matrix4x4 AsyncPanZoomController::GetCurrentAsyncTransformWithOverscroll() const {
return Matrix4x4(GetCurrentAsyncTransform()) * GetOverscrollTransform();
}
Matrix4x4 AsyncPanZoomController::GetTransformToLastDispatchedPaint() const {
ReentrantMonitorAutoEnter lock(mMonitor);

View File

@ -20,6 +20,7 @@
#include "InputData.h"
#include "Axis.h"
#include "InputQueue.h"
#include "APZUtils.h"
#include "LayersTypes.h"
#include "TaskThrottler.h"
#include "mozilla/gfx/Matrix.h"
@ -217,6 +218,12 @@ public:
*/
ViewTransform GetCurrentAsyncTransform() const;
/**
* Returns the same transform as GetCurrentAsyncTransform(), but includes
* any transform due to axis over-scroll.
*/
Matrix4x4 GetCurrentAsyncTransformWithOverscroll() const;
/**
* Returns the transform to take something from the coordinate space of the
* last thing we know gecko painted, to the coordinate space of the last thing
@ -285,8 +292,10 @@ public:
/**
* Cancels any currently running animation.
* aFlags is a bit-field to provide specifics of how to cancel the animation.
* See CancelAnimationFlags.
*/
void CancelAnimation();
void CancelAnimation(CancelAnimationFlags aFlags = Default);
/**
* Clear any overscroll on this APZC.

View File

@ -126,6 +126,8 @@ bool Axis::AdjustDisplacement(ParentLayerCoord aDisplacement,
return false;
}
StopSamplingOverscrollAnimation();
ParentLayerCoord displacement = aDisplacement;
// First consume any overscroll in the opposite direction along this axis.
@ -160,12 +162,13 @@ ParentLayerCoord Axis::ApplyResistance(ParentLayerCoord aRequestedOverscroll) co
// The actual overscroll is the requested overscroll multiplied by this
// factor; this should prevent overscrolling by more than the composition
// length.
float resistanceFactor = 1 - fabsf(mOverscroll) / GetCompositionLength();
float resistanceFactor = 1 - fabsf(GetOverscroll()) / GetCompositionLength();
return resistanceFactor < 0 ? ParentLayerCoord(0) : aRequestedOverscroll * resistanceFactor;
}
void Axis::OverscrollBy(ParentLayerCoord aOverscroll) {
MOZ_ASSERT(CanScroll());
StopSamplingOverscrollAnimation();
aOverscroll = ApplyResistance(aOverscroll);
if (aOverscroll > 0) {
#ifdef DEBUG
@ -200,6 +203,12 @@ ParentLayerCoord Axis::GetOverscroll() const {
return result;
}
void Axis::StopSamplingOverscrollAnimation() {
ParentLayerCoord overscroll = GetOverscroll();
ClearOverscroll();
mOverscroll = overscroll;
}
void Axis::StepOverscrollAnimation(double aStepDurationMilliseconds) {
// Apply spring physics to the overscroll as time goes on.
// Note: this method of sampling isn't perfectly smooth, as it assumes

View File

@ -251,6 +251,10 @@ protected:
// actual overscroll amount.
ParentLayerCoord ApplyResistance(ParentLayerCoord aOverscroll) const;
// Helper function to disable overscroll transformations triggered by
// SampleOverscrollAnimation().
void StopSamplingOverscrollAnimation();
// Helper function for SampleOverscrollAnimation().
void StepOverscrollAnimation(double aStepDurationMilliseconds);

View File

@ -174,7 +174,7 @@ HitTestingTreeNode::Untransform(const ParentLayerPoint& aPoint) const
// convert into Layer coordinate space
gfx::Matrix4x4 localTransform = mTransform;
if (mApzc) {
localTransform = localTransform * gfx::Matrix4x4(mApzc->GetCurrentAsyncTransform());
localTransform = localTransform * mApzc->GetCurrentAsyncTransformWithOverscroll();
}
gfx::Point4D point = localTransform.Inverse().ProjectPoint(aPoint.ToUnknownPoint());
return point.HasPositiveWCoord()

View File

@ -186,7 +186,7 @@ InputQueue::CancelAnimationsForNewBlock(CancelableBlockState* aBlock)
INPQ_LOG("block %p tagged as fast-motion\n", touch);
}
}
aBlock->GetOverscrollHandoffChain()->CancelAnimations();
aBlock->GetOverscrollHandoffChain()->CancelAnimations(ExcludeOverscroll);
}
}

View File

@ -88,9 +88,12 @@ OverscrollHandoffChain::FlushRepaints() const
}
void
OverscrollHandoffChain::CancelAnimations() const
OverscrollHandoffChain::CancelAnimations(CancelAnimationFlags aFlags) const
{
ForEachApzc(&AsyncPanZoomController::CancelAnimation);
MOZ_ASSERT(Length() > 0);
for (uint32_t i = 0; i < Length(); ++i) {
mChain[i]->CancelAnimation(aFlags);
}
}
void

View File

@ -11,6 +11,7 @@
#include "nsAutoPtr.h"
#include "nsISupportsImpl.h" // for NS_INLINE_DECL_REFCOUNTING
#include "Units.h" // for ScreenPoint
#include "APZUtils.h" // for CancelAnimationFlags
namespace mozilla {
namespace layers {
@ -93,7 +94,7 @@ public:
void FlushRepaints() const;
// Cancel animations all the way up the chain.
void CancelAnimations() const;
void CancelAnimations(CancelAnimationFlags aFlags = Default) const;
// Clear overscroll all the way up the chain.
void ClearOverscroll() const;

View File

@ -229,7 +229,7 @@ public:
}
virtual ~gfxUnknownSurface() { }
virtual const nsIntSize GetSize() const { return mSize; }
virtual const nsIntSize GetSize() const MOZ_OVERRIDE { return mSize; }
private:
nsIntSize mSize;

View File

@ -640,7 +640,7 @@ public:
~FontNameCache()
{
if (!mMap.ops) {
if (!mMap.IsInitialized()) {
return;
}
if (!mWriteNeeded || !mCache) {
@ -656,7 +656,7 @@ public:
void Init()
{
if (!mMap.ops || !mCache) {
if (!mMap.IsInitialized() || !mCache) {
return;
}
uint32_t size;
@ -712,7 +712,7 @@ public:
GetInfoForFile(const nsCString& aFileName, nsCString& aFaceList,
uint32_t *aTimestamp, uint32_t *aFilesize)
{
if (!mMap.ops) {
if (!mMap.IsInitialized()) {
return;
}
PLDHashEntryHdr *hdr =
@ -736,7 +736,7 @@ public:
CacheFileInfo(const nsCString& aFileName, const nsCString& aFaceList,
uint32_t aTimestamp, uint32_t aFilesize)
{
if (!mMap.ops) {
if (!mMap.IsInitialized()) {
return;
}
FNCMapEntry* entry =

View File

@ -312,7 +312,7 @@ public:
// This gets called when the timeout has expired on a zero-refcount
// font; we just delete it.
virtual void NotifyExpired(gfxFont *aFont);
virtual void NotifyExpired(gfxFont *aFont) MOZ_OVERRIDE;
// Cleans out the hashtable and removes expired fonts waiting for cleanup.
// Other gfxFont objects may be still in use but they will be pushed
@ -1197,7 +1197,7 @@ public:
moz_free(p);
}
CompressedGlyph *GetCharacterGlyphs() {
virtual CompressedGlyph *GetCharacterGlyphs() MOZ_OVERRIDE {
return &mCharGlyphsStorage[0];
}

View File

@ -45,7 +45,8 @@ ComputeImageFlags(ImageURL* uri, const nsCString& aMimeType, bool isMultiPart)
// We default to the static globals.
bool isDiscardable = gfxPrefs::ImageMemDiscardable();
bool doDecodeOnDraw = gfxPrefs::ImageMemDecodeOnDraw();
bool doDecodeOnDraw = gfxPrefs::ImageMemDecodeOnDraw() &&
gfxPrefs::AsyncPanZoomEnabled();
bool doDownscaleDuringDecode = gfxPrefs::ImageDownscaleDuringDecodeEnabled();
// We want UI to be as snappy as possible and not to flicker. Disable
@ -64,9 +65,12 @@ ComputeImageFlags(ImageURL* uri, const nsCString& aMimeType, bool isMultiPart)
isDiscardable = doDecodeOnDraw = false;
}
// Downscale-during-decode is only enabled for certain content types.
if (doDownscaleDuringDecode && !ShouldDownscaleDuringDecode(aMimeType)) {
// Downscale-during-decode and decode-on-draw are only enabled for certain
// content types.
if ((doDownscaleDuringDecode || doDecodeOnDraw) &&
!ShouldDownscaleDuringDecode(aMimeType)) {
doDownscaleDuringDecode = false;
doDecodeOnDraw = false;
}
// For multipart/x-mixed-replace, we basically want a direct channel to the

View File

@ -35,6 +35,7 @@
#include "mozilla/gfx/2D.h"
#include "mozilla/DebugOnly.h"
#include "mozilla/Likely.h"
#include "mozilla/RefPtr.h"
#include "mozilla/Move.h"
#include "mozilla/MemoryReporting.h"
@ -271,6 +272,7 @@ RasterImage::RasterImage(ProgressTracker* aProgressTracker,
mSourceBuffer(new SourceBuffer()),
mFrameCount(0),
mHasSize(false),
mBlockedOnload(false),
mDecodeOnDraw(false),
mTransient(false),
mDiscardable(false),
@ -1166,26 +1168,58 @@ RasterImage::OnImageDataComplete(nsIRequest*, nsISupports*, nsresult aStatus,
DoError();
}
// Notify our listeners, which will fire this image's load event.
MOZ_ASSERT(mHasSize || mError, "Need to know size before firing load event");
MOZ_ASSERT(!mHasSize ||
(mProgressTracker->GetProgress() & FLAG_SIZE_AVAILABLE),
"Should have notified that the size is available if we have it");
Progress loadProgress = LoadCompleteProgress(aLastPart, mError, finalStatus);
if (mBlockedOnload) {
// For decode-on-draw images, we want to send notifications as if we've
// already finished decoding. Otherwise some observers will never even try
// to draw.
MOZ_ASSERT(mDecodeOnDraw, "Blocked onload but not decode-on-draw");
loadProgress |= FLAG_FRAME_COMPLETE |
FLAG_DECODE_COMPLETE |
FLAG_ONLOAD_UNBLOCKED;
}
// Notify our listeners, which will fire this image's load event.
NotifyProgress(loadProgress);
return finalStatus;
}
void
RasterImage::BlockOnloadForDecodeOnDraw()
{
if (mHasSourceData) {
// OnImageDataComplete got called before we got to run. No point in blocking
// onload now.
return;
}
// Block onload. We'll unblock it in OnImageDataComplete.
mBlockedOnload = true;
NotifyProgress(FLAG_DECODE_STARTED | FLAG_ONLOAD_BLOCKED);
}
nsresult
RasterImage::OnImageDataAvailable(nsIRequest*,
nsISupports*,
nsIInputStream* aInStr,
uint64_t,
uint64_t aOffset,
uint32_t aCount)
{
nsresult rv;
if (MOZ_UNLIKELY(mDecodeOnDraw && aOffset == 0)) {
nsCOMPtr<nsIRunnable> runnable =
NS_NewRunnableMethod(this, &RasterImage::BlockOnloadForDecodeOnDraw);
NS_DispatchToMainThread(runnable);
}
// WriteToSourceBuffer always consumes everything it gets if it doesn't run
// out of memory.
uint32_t bytesRead;
@ -1405,6 +1439,11 @@ RasterImage::WantDecodedFrames(const nsIntSize& aSize, uint32_t aFlags,
NS_IMETHODIMP
RasterImage::RequestDecode()
{
// For decode-on-draw images, we only act on RequestDecodeForSize.
if (mDecodeOnDraw) {
return NS_OK;
}
return RequestDecodeForSize(mSize, DECODE_FLAGS_DEFAULT);
}
@ -1417,6 +1456,11 @@ RasterImage::StartDecoding()
NS_NewRunnableMethod(this, &RasterImage::StartDecoding));
}
// For decode-on-draw images, we only act on RequestDecodeForSize.
if (mDecodeOnDraw) {
return NS_OK;
}
return RequestDecodeForSize(mSize, FLAG_SYNC_DECODE);
}
@ -1457,7 +1501,7 @@ bool
RasterImage::IsDecoded()
{
// XXX(seth): We need to get rid of this; it's not reliable.
return mHasBeenDecoded || mError;
return mHasBeenDecoded || mError || (mDecodeOnDraw && mHasSourceData);
}
NS_IMETHODIMP

View File

@ -242,6 +242,8 @@ public:
nsresult aStatus,
bool aLastPart) MOZ_OVERRIDE;
void BlockOnloadForDecodeOnDraw();
/**
* A hint of the number of bytes of source data that the image contains. If
* called early on, this can help reduce copying and reallocations by
@ -387,6 +389,7 @@ private: // data
// Boolean flags (clustered together to conserve space):
bool mHasSize:1; // Has SetSize() been called?
bool mBlockedOnload:1; // Did send BLOCK_ONLOAD?
bool mDecodeOnDraw:1; // Decoding on draw?
bool mTransient:1; // Is the image short-lived?
bool mDiscardable:1; // Is container discardable?

View File

@ -145,7 +145,7 @@ protected:
: mOwner(owner), mStatus(status)
{}
NS_IMETHOD Run() {
NS_IMETHOD Run() MOZ_OVERRIDE {
mOwner->DoCancel(mStatus);
return NS_OK;
}

View File

@ -45,7 +45,7 @@ public:
virtual int32_t operator() (const char16_t*,
const char16_t*,
uint32_t,
uint32_t) const;
uint32_t) const MOZ_OVERRIDE;
};
class nsCaseInsensitiveUTF8StringComparator : public nsCStringComparator
@ -54,7 +54,7 @@ public:
virtual int32_t operator() (const char*,
const char*,
uint32_t,
uint32_t) const;
uint32_t) const MOZ_OVERRIDE;
};
class nsCaseInsensitiveStringArrayComparator
@ -73,7 +73,7 @@ public:
virtual int operator() (const char16_t*,
const char16_t*,
uint32_t,
uint32_t) const;
uint32_t) const MOZ_OVERRIDE;
};
inline bool

View File

@ -66,6 +66,12 @@ if CONFIG['MOZ_SANDBOX'] and CONFIG['OS_TARGET'] == 'Linux':
'mozsandbox',
]
# gcc lto likes to put the top level asm in syscall.cc in a different partition
# from the function using it which breaks the build. Work around that by
# forcing there to be only one partition.
if '-flto' in CONFIG['OS_CXXFLAGS'] and not CONFIG['CLANG_CXX']:
LDFLAGS += ['--param lto-partitions=1']
if CONFIG['_MSC_VER']:
# Always enter a Windows program through wmain, whether or not we're
# a console application.

View File

@ -2928,21 +2928,21 @@ JitProfilingFrameIterator::operator++()
JitFrameLayout *frame = framePtr();
FrameType prevType = frame->prevType();
if (prevType == JitFrame_IonJS) {
if (prevType == JitFrame_IonJS || prevType == JitFrame_Unwound_IonJS) {
returnAddressToFp_ = frame->returnAddress();
fp_ = GetPreviousRawFrame<JitFrameLayout, uint8_t *>(frame);
type_ = JitFrame_IonJS;
return;
}
if (prevType == JitFrame_BaselineJS) {
if (prevType == JitFrame_BaselineJS || prevType == JitFrame_Unwound_BaselineJS) {
returnAddressToFp_ = frame->returnAddress();
fp_ = GetPreviousRawFrame<JitFrameLayout, uint8_t *>(frame);
type_ = JitFrame_BaselineJS;
return;
}
if (prevType == JitFrame_BaselineStub) {
if (prevType == JitFrame_BaselineStub || prevType == JitFrame_Unwound_BaselineStub) {
BaselineStubFrameLayout *stubFrame =
GetPreviousRawFrame<JitFrameLayout, BaselineStubFrameLayout *>(frame);
MOZ_ASSERT(stubFrame->prevType() == JitFrame_BaselineJS);
@ -2954,7 +2954,7 @@ JitProfilingFrameIterator::operator++()
return;
}
if (prevType == JitFrame_Rectifier) {
if (prevType == JitFrame_Rectifier || prevType == JitFrame_Unwound_Rectifier) {
RectifierFrameLayout *rectFrame =
GetPreviousRawFrame<JitFrameLayout, RectifierFrameLayout *>(frame);
FrameType rectPrevType = rectFrame->prevType();

View File

@ -156,8 +156,8 @@ class NS_NO_VTABLE nsXPCClassInfo : public nsIClassInfo,
public:
NS_DECLARE_STATIC_IID_ACCESSOR(NS_XPCCLASSINFO_IID)
NS_IMETHOD_(MozExternalRefCountType) AddRef() = 0;
NS_IMETHOD_(MozExternalRefCountType) Release() = 0;
NS_IMETHOD_(MozExternalRefCountType) AddRef() MOZ_OVERRIDE = 0;
NS_IMETHOD_(MozExternalRefCountType) Release() MOZ_OVERRIDE = 0;
virtual void PreserveWrapper(nsISupports *aNative) = 0;
};

View File

@ -153,7 +153,7 @@ nsFrameManager::GetPlaceholderFrameFor(const nsIFrame* aFrame)
{
NS_PRECONDITION(aFrame, "null param unexpected");
if (mPlaceholderMap.ops) {
if (mPlaceholderMap.IsInitialized()) {
PlaceholderMapEntry *entry = static_cast<PlaceholderMapEntry*>
(PL_DHashTableLookup(const_cast<PLDHashTable*>(&mPlaceholderMap),
aFrame));
@ -171,7 +171,7 @@ nsFrameManager::RegisterPlaceholderFrame(nsPlaceholderFrame* aPlaceholderFrame)
NS_PRECONDITION(aPlaceholderFrame, "null param unexpected");
NS_PRECONDITION(nsGkAtoms::placeholderFrame == aPlaceholderFrame->GetType(),
"unexpected frame type");
if (!mPlaceholderMap.ops) {
if (!mPlaceholderMap.IsInitialized()) {
PL_DHashTableInit(&mPlaceholderMap, &PlaceholderMapOps,
sizeof(PlaceholderMapEntry));
}
@ -193,7 +193,7 @@ nsFrameManager::UnregisterPlaceholderFrame(nsPlaceholderFrame* aPlaceholderFrame
NS_PRECONDITION(nsGkAtoms::placeholderFrame == aPlaceholderFrame->GetType(),
"unexpected frame type");
if (mPlaceholderMap.ops) {
if (mPlaceholderMap.IsInitialized()) {
PL_DHashTableRemove(&mPlaceholderMap,
aPlaceholderFrame->GetOutOfFlowFrame());
}
@ -211,10 +211,9 @@ UnregisterPlaceholders(PLDHashTable* table, PLDHashEntryHdr* hdr,
void
nsFrameManager::ClearPlaceholderFrameMap()
{
if (mPlaceholderMap.ops) {
if (mPlaceholderMap.IsInitialized()) {
PL_DHashTableEnumerate(&mPlaceholderMap, UnregisterPlaceholders, nullptr);
PL_DHashTableFinish(&mPlaceholderMap);
mPlaceholderMap.ops = nullptr;
}
}

View File

@ -37,7 +37,6 @@ public:
, mDisplayContentsMap(nullptr)
, mIsDestroyingFrames(false)
{
mPlaceholderMap.ops = nullptr;
}
bool IsDestroyingFrames() { return mIsDestroyingFrames; }

View File

@ -1082,14 +1082,14 @@ public:
RectAccumulator();
virtual void AddRect(const nsRect& aRect);
virtual void AddRect(const nsRect& aRect) MOZ_OVERRIDE;
};
struct RectListBuilder : public RectCallback {
DOMRectList* mRectList;
explicit RectListBuilder(DOMRectList* aList);
virtual void AddRect(const nsRect& aRect);
virtual void AddRect(const nsRect& aRect) MOZ_OVERRIDE;
};
static nsIFrame* GetContainingBlockForClientRect(nsIFrame* aFrame);

View File

@ -34,7 +34,7 @@ skip-if = (toolkit == 'gonk' && debug) #debug-only failure
[test_bug564115.html]
skip-if = buildapp == 'mulet' || (buildapp == 'b2g' && (toolkit != 'gonk' || debug)) || toolkit == 'android' || e10s #TIMED_OUT # b2g-debug(times out on window.open and focus event) b2g-desktop(times out on window.open and focus event)
[test_bug571352.html]
skip-if = buildapp == 'mulet' || buildapp == 'b2g' || toolkit == 'android' #TIMED_OUT # b2g(shift-click multi-select not working?) b2g-debug(shift-click multi-select not working?) b2g-desktop(shift-click multi-select not working?)
skip-if = (os == 'mac' && os_version == '10.10') || buildapp == 'mulet' || buildapp == 'b2g' || toolkit == 'android' #TIMED_OUT # OS X 10.10 - bug 947690, b2g(shift-click multi-select not working?) b2g-debug(shift-click multi-select not working?) b2g-desktop(shift-click multi-select not working?)
[test_bug572406.html]
[test_bug572649.html]
skip-if = toolkit == 'android' #TIMED_OUT

View File

@ -1425,8 +1425,7 @@ nsDisplayImage::GetContainer(LayerManager* aManager,
nsDisplayListBuilder* aBuilder)
{
nsRefPtr<ImageContainer> container;
nsresult rv = mImage->GetImageContainer(aManager, getter_AddRefs(container));
NS_ENSURE_SUCCESS(rv, nullptr);
mImage->GetImageContainer(aManager, getter_AddRefs(container));
return container.forget();
}

View File

@ -218,7 +218,7 @@ RuleHash_CIMatchEntry(PLDHashTable *table, const PLDHashEntryHdr *hdr,
nsIAtom *match_atom = const_cast<nsIAtom*>(static_cast<const nsIAtom*>
(key));
// Use our extra |getKey| callback to avoid code duplication.
nsIAtom *entry_atom = ToLocalOps(table->ops)->getKey(table, hdr);
nsIAtom *entry_atom = ToLocalOps(table->Ops())->getKey(table, hdr);
// Check for case-sensitive match first.
if (match_atom == entry_atom)
@ -240,7 +240,7 @@ RuleHash_CSMatchEntry(PLDHashTable *table, const PLDHashEntryHdr *hdr,
nsIAtom *match_atom = const_cast<nsIAtom*>(static_cast<const nsIAtom*>
(key));
// Use our extra |getKey| callback to avoid code duplication.
nsIAtom *entry_atom = ToLocalOps(table->ops)->getKey(table, hdr);
nsIAtom *entry_atom = ToLocalOps(table->Ops())->getKey(table, hdr);
return match_atom == entry_atom;
}
@ -454,8 +454,7 @@ protected:
void AppendUniversalRule(const RuleSelectorPair& aRuleInfo);
int32_t mRuleCount;
// The hashtables are lazily initialized; we use a null .ops to
// indicate that they need initialization.
// The hashtables are lazily initialized.
PLDHashTable mIdTable;
PLDHashTable mClassTable;
PLDHashTable mTagTable;
@ -514,11 +513,6 @@ RuleHash::RuleHash(bool aQuirksMode)
#endif
{
MOZ_COUNT_CTOR(RuleHash);
mTagTable.ops = nullptr;
mIdTable.ops = nullptr;
mClassTable.ops = nullptr;
mNameSpaceTable.ops = nullptr;
}
RuleHash::~RuleHash()
@ -561,16 +555,16 @@ RuleHash::~RuleHash()
delete [] mEnumList;
}
// delete arena for strings and small objects
if (mIdTable.ops) {
if (mIdTable.IsInitialized()) {
PL_DHashTableFinish(&mIdTable);
}
if (mClassTable.ops) {
if (mClassTable.IsInitialized()) {
PL_DHashTableFinish(&mClassTable);
}
if (mTagTable.ops) {
if (mTagTable.IsInitialized()) {
PL_DHashTableFinish(&mTagTable);
}
if (mNameSpaceTable.ops) {
if (mNameSpaceTable.IsInitialized()) {
PL_DHashTableFinish(&mNameSpaceTable);
}
}
@ -611,7 +605,7 @@ void RuleHash::AppendRule(const RuleSelectorPair& aRuleInfo)
selector = selector->mNext;
}
if (nullptr != selector->mIDList) {
if (!mIdTable.ops) {
if (!mIdTable.IsInitialized()) {
PL_DHashTableInit(&mIdTable,
mQuirksMode ? &RuleHash_IdTable_CIOps.ops
: &RuleHash_IdTable_CSOps.ops,
@ -621,7 +615,7 @@ void RuleHash::AppendRule(const RuleSelectorPair& aRuleInfo)
RULE_HASH_STAT_INCREMENT(mIdSelectors);
}
else if (nullptr != selector->mClassList) {
if (!mClassTable.ops) {
if (!mClassTable.IsInitialized()) {
PL_DHashTableInit(&mClassTable,
mQuirksMode ? &RuleHash_ClassTable_CIOps.ops
: &RuleHash_ClassTable_CSOps.ops,
@ -632,7 +626,7 @@ void RuleHash::AppendRule(const RuleSelectorPair& aRuleInfo)
}
else if (selector->mLowercaseTag) {
RuleValue ruleValue(aRuleInfo, mRuleCount++, mQuirksMode);
if (!mTagTable.ops) {
if (!mTagTable.IsInitialized()) {
PL_DHashTableInit(&mTagTable, &RuleHash_TagTable_Ops,
sizeof(RuleHashTagTableEntry));
}
@ -645,7 +639,7 @@ void RuleHash::AppendRule(const RuleSelectorPair& aRuleInfo)
}
}
else if (kNameSpaceID_Unknown != selector->mNameSpace) {
if (!mNameSpaceTable.ops) {
if (!mNameSpaceTable.IsInitialized()) {
PL_DHashTableInit(&mNameSpaceTable, &RuleHash_NameSpaceTable_Ops,
sizeof(RuleHashTableEntry));
}
@ -705,7 +699,7 @@ void RuleHash::EnumerateAllRules(Element* aElement, ElementDependentRuleProcesso
RULE_HASH_STAT_INCREMENT_LIST_COUNT(mUniversalRules, mElementUniversalCalls);
}
// universal rules within the namespace
if (kNameSpaceID_Unknown != nameSpace && mNameSpaceTable.ops) {
if (kNameSpaceID_Unknown != nameSpace && mNameSpaceTable.IsInitialized()) {
RuleHashTableEntry *entry = static_cast<RuleHashTableEntry*>
(PL_DHashTableLookup(&mNameSpaceTable, NS_INT32_TO_PTR(nameSpace)));
if (PL_DHASH_ENTRY_IS_BUSY(entry)) {
@ -713,7 +707,7 @@ void RuleHash::EnumerateAllRules(Element* aElement, ElementDependentRuleProcesso
RULE_HASH_STAT_INCREMENT_LIST_COUNT(entry->mRules, mElementNameSpaceCalls);
}
}
if (mTagTable.ops) {
if (mTagTable.IsInitialized()) {
RuleHashTableEntry *entry = static_cast<RuleHashTableEntry*>
(PL_DHashTableLookup(&mTagTable, tag));
if (PL_DHASH_ENTRY_IS_BUSY(entry)) {
@ -721,7 +715,7 @@ void RuleHash::EnumerateAllRules(Element* aElement, ElementDependentRuleProcesso
RULE_HASH_STAT_INCREMENT_LIST_COUNT(entry->mRules, mElementTagCalls);
}
}
if (id && mIdTable.ops) {
if (id && mIdTable.IsInitialized()) {
RuleHashTableEntry *entry = static_cast<RuleHashTableEntry*>
(PL_DHashTableLookup(&mIdTable, id));
if (PL_DHASH_ENTRY_IS_BUSY(entry)) {
@ -729,7 +723,7 @@ void RuleHash::EnumerateAllRules(Element* aElement, ElementDependentRuleProcesso
RULE_HASH_STAT_INCREMENT_LIST_COUNT(entry->mRules, mElementIdCalls);
}
}
if (mClassTable.ops) {
if (mClassTable.IsInitialized()) {
for (int32_t index = 0; index < classCount; ++index) {
RuleHashTableEntry *entry = static_cast<RuleHashTableEntry*>
(PL_DHashTableLookup(&mClassTable, classList->AtomAt(index)));
@ -792,25 +786,25 @@ RuleHash::SizeOfExcludingThis(MallocSizeOf aMallocSizeOf) const
{
size_t n = 0;
if (mIdTable.ops) {
if (mIdTable.IsInitialized()) {
n += PL_DHashTableSizeOfExcludingThis(&mIdTable,
SizeOfRuleHashTableEntry,
aMallocSizeOf);
}
if (mClassTable.ops) {
if (mClassTable.IsInitialized()) {
n += PL_DHashTableSizeOfExcludingThis(&mClassTable,
SizeOfRuleHashTableEntry,
aMallocSizeOf);
}
if (mTagTable.ops) {
if (mTagTable.IsInitialized()) {
n += PL_DHashTableSizeOfExcludingThis(&mTagTable,
SizeOfRuleHashTableEntry,
aMallocSizeOf);
}
if (mNameSpaceTable.ops) {
if (mNameSpaceTable.IsInitialized()) {
n += PL_DHashTableSizeOfExcludingThis(&mNameSpaceTable,
SizeOfRuleHashTableEntry,
aMallocSizeOf);
@ -3362,9 +3356,8 @@ struct CascadeEnumData {
mCacheKey(aKey),
mSheetType(aSheetType)
{
if (!PL_DHashTableInit(&mRulesByWeight, &gRulesByWeightOps,
sizeof(RuleByWeightEntry), fallible_t(), 32))
mRulesByWeight.ops = nullptr;
PL_DHashTableInit(&mRulesByWeight, &gRulesByWeightOps,
sizeof(RuleByWeightEntry), 32);
// Initialize our arena
PL_INIT_ARENA_POOL(&mArena, "CascadeEnumDataArena",
@ -3373,7 +3366,7 @@ struct CascadeEnumData {
~CascadeEnumData()
{
if (mRulesByWeight.ops)
if (mRulesByWeight.IsInitialized())
PL_DHashTableFinish(&mRulesByWeight);
PL_FinishArenaPool(&mArena);
}
@ -3587,7 +3580,7 @@ nsCSSRuleProcessor::RefreshRuleCascade(nsPresContext* aPresContext)
newCascade->mCounterStyleRules,
newCascade->mCacheKey,
mSheetType);
if (!data.mRulesByWeight.ops)
if (!data.mRulesByWeight.IsInitialized())
return; /* out of memory */
for (uint32_t i = 0; i < mSheets.Length(); ++i) {

View File

@ -238,16 +238,16 @@ nsHTMLStyleSheet::nsHTMLStyleSheet(nsIDocument* aDocument)
, mTableTHRule(new TableTHRule())
{
MOZ_ASSERT(aDocument);
mMappedAttrTable.ops = nullptr;
mLangRuleTable.ops = nullptr;
}
nsHTMLStyleSheet::~nsHTMLStyleSheet()
{
if (mLangRuleTable.ops)
if (mLangRuleTable.IsInitialized()) {
PL_DHashTableFinish(&mLangRuleTable);
if (mMappedAttrTable.ops)
}
if (mMappedAttrTable.IsInitialized()) {
PL_DHashTableFinish(&mMappedAttrTable);
}
}
NS_IMPL_ISUPPORTS(nsHTMLStyleSheet, nsIStyleRuleProcessor)
@ -425,13 +425,11 @@ nsHTMLStyleSheet::Reset()
mVisitedRule = nullptr;
mActiveRule = nullptr;
if (mLangRuleTable.ops) {
if (mLangRuleTable.IsInitialized()) {
PL_DHashTableFinish(&mLangRuleTable);
mLangRuleTable.ops = nullptr;
}
if (mMappedAttrTable.ops) {
if (mMappedAttrTable.IsInitialized()) {
PL_DHashTableFinish(&mMappedAttrTable);
mMappedAttrTable.ops = nullptr;
}
}
@ -481,7 +479,7 @@ nsHTMLStyleSheet::SetVisitedLinkColor(nscolor aColor)
already_AddRefed<nsMappedAttributes>
nsHTMLStyleSheet::UniqueMappedAttributes(nsMappedAttributes* aMapped)
{
if (!mMappedAttrTable.ops) {
if (!mMappedAttrTable.IsInitialized()) {
PL_DHashTableInit(&mMappedAttrTable, &MappedAttrTable_Ops,
sizeof(MappedAttrTableEntry));
}
@ -502,7 +500,7 @@ nsHTMLStyleSheet::DropMappedAttributes(nsMappedAttributes* aMapped)
{
NS_ENSURE_TRUE_VOID(aMapped);
NS_ASSERTION(mMappedAttrTable.ops, "table uninitialized");
NS_ASSERTION(mMappedAttrTable.IsInitialized(), "table uninitialized");
#ifdef DEBUG
uint32_t entryCount = mMappedAttrTable.EntryCount() - 1;
#endif
@ -515,7 +513,7 @@ nsHTMLStyleSheet::DropMappedAttributes(nsMappedAttributes* aMapped)
nsIStyleRule*
nsHTMLStyleSheet::LangRuleFor(const nsString& aLanguage)
{
if (!mLangRuleTable.ops) {
if (!mLangRuleTable.IsInitialized()) {
PL_DHashTableInit(&mLangRuleTable, &LangRuleTable_Ops,
sizeof(LangRuleTableEntry));
}
@ -545,7 +543,7 @@ nsHTMLStyleSheet::DOMSizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const
{
size_t n = aMallocSizeOf(this);
if (mMappedAttrTable.ops) {
if (mMappedAttrTable.IsInitialized()) {
n += PL_DHashTableSizeOfExcludingThis(&mMappedAttrTable,
SizeOfAttributesEntryExcludingThis,
aMallocSizeOf);

View File

@ -19,14 +19,12 @@ SpanningCellSorter::SpanningCellSorter()
, mSortedHashTable(nullptr)
{
memset(mArray, 0, sizeof(mArray));
mHashTable.ops = nullptr;
}
SpanningCellSorter::~SpanningCellSorter()
{
if (mHashTable.ops) {
if (mHashTable.IsInitialized()) {
PL_DHashTableFinish(&mHashTable);
mHashTable.ops = nullptr;
}
delete [] mSortedHashTable;
}
@ -72,7 +70,7 @@ SpanningCellSorter::AddCell(int32_t aColSpan, int32_t aRow, int32_t aCol)
i->next = mArray[index];
mArray[index] = i;
} else {
if (!mHashTable.ops) {
if (!mHashTable.IsInitialized()) {
PL_DHashTableInit(&mHashTable, &HashTableOps,
sizeof(HashTableEntry));
}
@ -147,7 +145,7 @@ SpanningCellSorter::GetNext(int32_t *aColSpan)
/* prepare to enumerate the hash */
mState = ENUMERATING_HASH;
mEnumerationIndex = 0;
if (mHashTable.ops) {
if (mHashTable.IsInitialized()) {
HashTableEntry **sh =
new HashTableEntry*[mHashTable.EntryCount()];
if (!sh) {
@ -162,7 +160,9 @@ SpanningCellSorter::GetNext(int32_t *aColSpan)
}
/* fall through */
case ENUMERATING_HASH:
if (mHashTable.ops && mEnumerationIndex < mHashTable.EntryCount()) {
if (mHashTable.IsInitialized() &&
mEnumerationIndex < mHashTable.EntryCount())
{
Item *result = mSortedHashTable[mEnumerationIndex]->mItems;
*aColSpan = mSortedHashTable[mEnumerationIndex]->mColSpan;
NS_ASSERTION(result, "holes in hash table");

View File

@ -434,8 +434,7 @@ nsImageBoxFrame::GetContainer(LayerManager* aManager)
}
nsRefPtr<ImageContainer> container;
nsresult rv = imgCon->GetImageContainer(aManager, getter_AddRefs(container));
NS_ENSURE_SUCCESS(rv, nullptr);
imgCon->GetImageContainer(aManager, getter_AddRefs(container));
return container.forget();
}

View File

@ -48,8 +48,8 @@ Box::Box(BoxContext* aContext, uint64_t aOffset, const Box* aParent)
if ((mParent && !mParent->mRange.Contains(bigLengthRange)) ||
!byteRange->Contains(bigLengthRange) ||
!mContext->mSource->CachedReadAt(aOffset, bigLength,
sizeof(bigLengthRange), &bytes) ||
bytes != sizeof(bigLengthRange)) {
sizeof(bigLength), &bytes) ||
bytes != sizeof(bigLength)) {
return;
}
size = BigEndian::readUint64(bigLength);
@ -94,7 +94,7 @@ Box::Read(nsTArray<uint8_t>* aDest)
{
aDest->SetLength(mRange.mEnd - mChildOffset);
size_t bytes;
if (!mContext->mSource->CachedReadAt(mChildOffset, &(*aDest)[0],
if (!mContext->mSource->CachedReadAt(mChildOffset, aDest->Elements(),
aDest->Length(), &bytes) ||
bytes != aDest->Length()) {
// Byte ranges are being reported incorrectly

View File

@ -186,6 +186,31 @@ void SampleIterator::Seek(Microseconds aTime)
mCurrentSample = syncSample;
}
Microseconds
SampleIterator::GetNextKeyframeTime()
{
nsTArray<Moof>& moofs = mIndex->mMoofParser->Moofs();
size_t sample = mCurrentSample + 1;
size_t moof = mCurrentMoof;
while (true) {
while (true) {
if (moof == moofs.Length()) {
return -1;
}
if (sample < moofs[moof].mIndex.Length()) {
break;
}
sample = 0;
++moof;
}
if (moofs[moof].mIndex[sample].mSync) {
return moofs[moof].mIndex[sample].mDecodeTime;
}
++sample;
}
MOZ_ASSERT(false); // should not be reached.
}
Index::Index(const stagefright::Vector<MediaSource::Indice>& aIndex,
Stream* aSource, uint32_t aTrackId, Microseconds aTimestampOffset,
Monitor* aMonitor)

View File

@ -286,21 +286,43 @@ public:
void
Moof::ParseTrun(Box& aBox, Tfhd& aTfhd, Tfdt& aTfdt, Mdhd& aMdhd, Edts& aEdts)
{
if (!aMdhd.mTimescale) {
if (!aTfhd.IsValid() || !aTfdt.IsValid() ||
!aMdhd.IsValid() || !aEdts.IsValid()) {
return;
}
BoxReader reader(aBox);
if (!reader->CanReadType<uint32_t>()) {
return;
}
uint32_t flags = reader->ReadU32();
if ((flags & 0x404) == 0x404) {
// Can't use these flags together
reader->DiscardRemaining();
mValid = true;
return;
}
uint8_t version = flags >> 24;
if (!reader->CanReadType<uint32_t>()) {
return;
}
uint32_t sampleCount = reader->ReadU32();
if (sampleCount == 0) {
mValid = true;
return;
}
size_t need =
((flags & 1) ? sizeof(uint32_t) : 0) +
((flags & 4) ? sizeof(uint32_t) : 0);
uint16_t flag[] = { 0x100, 0x200, 0x400, 0x800, 0 };
for (size_t i = 0; flag[i]; i++) {
if (flags & flag[i]) {
need += sizeof(uint32_t) * sampleCount;
}
}
if (reader->Remaining() < need) {
return;
}
@ -354,13 +376,22 @@ Moof::ParseTrun(Box& aBox, Tfhd& aTfhd, Tfdt& aTfdt, Mdhd& aMdhd, Edts& aEdts)
}
mTimeRange = Interval<Microseconds>(ctsOrder[0]->mCompositionRange.start,
ctsOrder.LastElement()->mCompositionRange.end);
mValid = true;
}
Tkhd::Tkhd(Box& aBox)
{
BoxReader reader(aBox);
if (!reader->CanReadType<uint32_t>()) {
return;
}
uint32_t flags = reader->ReadU32();
uint8_t version = flags >> 24;
size_t need =
3*(version ? sizeof(int64_t) : sizeof(int32_t)) + 2*sizeof(int32_t);
if (reader->Remaining() < need) {
return;
}
if (version == 0) {
mCreationTime = reader->ReadU32();
mModificationTime = reader->ReadU32();
@ -378,13 +409,23 @@ Tkhd::Tkhd(Box& aBox)
}
// More stuff that we don't care about
reader->DiscardRemaining();
mValid = true;
}
Mdhd::Mdhd(Box& aBox)
{
BoxReader reader(aBox);
if (!reader->CanReadType<uint32_t>()) {
return;
}
uint32_t flags = reader->ReadU32();
uint8_t version = flags >> 24;
size_t need =
3*(version ? sizeof(int64_t) : sizeof(int32_t)) + 2*sizeof(uint32_t);
if (reader->Remaining() < need) {
return;
}
if (version == 0) {
mCreationTime = reader->ReadU32();
mModificationTime = reader->ReadU32();
@ -398,17 +439,24 @@ Mdhd::Mdhd(Box& aBox)
}
// language and pre_defined=0
reader->ReadU32();
if (mTimescale) {
mValid = true;
}
}
Trex::Trex(Box& aBox)
{
BoxReader reader(aBox);
if (reader->Remaining() < 6*sizeof(uint32_t)) {
return;
}
mFlags = reader->ReadU32();
mTrackId = reader->ReadU32();
mDefaultSampleDescriptionIndex = reader->ReadU32();
mDefaultSampleDuration = reader->ReadU32();
mDefaultSampleSize = reader->ReadU32();
mDefaultSampleFlags = reader->ReadU32();
mValid = true;
}
Tfhd::Tfhd(Box& aBox, Trex& aTrex) : Trex(aTrex)
@ -418,7 +466,20 @@ Tfhd::Tfhd(Box& aBox, Trex& aTrex) : Trex(aTrex)
MOZ_ASSERT(aBox.Parent()->Parent()->IsType("moof"));
BoxReader reader(aBox);
if (!reader->CanReadType<uint32_t>()) {
return;
}
mFlags = reader->ReadU32();
size_t need = sizeof(uint32_t) /* trackid */;
uint8_t flag[] = { 1, 2, 8, 0x10, 0x20, 0 };
for (size_t i = 0; flag[i]; i++) {
if (mFlags & flag[i]) {
need += sizeof(uint32_t);
}
}
if (reader->Remaining() < need) {
return;
}
mBaseDataOffset =
mFlags & 1 ? reader->ReadU32() : aBox.Parent()->Parent()->Offset();
mTrackId = reader->ReadU32();
@ -434,19 +495,28 @@ Tfhd::Tfhd(Box& aBox, Trex& aTrex) : Trex(aTrex)
if (mFlags & 0x20) {
mDefaultSampleFlags = reader->ReadU32();
}
mValid = true;
}
Tfdt::Tfdt(Box& aBox)
{
BoxReader reader(aBox);
if (!reader->CanReadType<uint32_t>()) {
return;
}
uint32_t flags = reader->ReadU32();
uint8_t version = flags >> 24;
size_t need = version ? sizeof(uint64_t) : sizeof(uint32_t) ;
if (reader->Remaining() < need) {
return;
}
if (version == 0) {
mBaseMediaDecodeTime = reader->ReadU32();
} else if (version == 1) {
mBaseMediaDecodeTime = reader->ReadU64();
}
reader->DiscardRemaining();
mValid = true;
}
Edts::Edts(Box& aBox)
@ -458,9 +528,16 @@ Edts::Edts(Box& aBox)
}
BoxReader reader(child);
if (!reader->CanReadType<uint32_t>()) {
return;
}
uint32_t flags = reader->ReadU32();
uint8_t version = flags >> 24;
size_t need =
sizeof(uint32_t) + 2*(version ? sizeof(int64_t) : sizeof(uint32_t));
if (reader->Remaining() < need) {
return;
}
uint32_t entryCount = reader->ReadU32();
NS_ASSERTION(entryCount == 1, "Can't handle videos with multiple edits");
if (entryCount != 1) {
@ -483,9 +560,16 @@ Edts::Edts(Box& aBox)
Saiz::Saiz(Box& aBox) : mAuxInfoType("sinf"), mAuxInfoTypeParameter(0)
{
BoxReader reader(aBox);
if (!reader->CanReadType<uint32_t>()) {
return;
}
uint32_t flags = reader->ReadU32();
uint8_t version = flags >> 24;
size_t need =
((flags & 1) ? 2*sizeof(uint32_t) : 0) + sizeof(uint8_t) + sizeof(uint32_t);
if (reader->Remaining() < need) {
return;
}
if (flags & 1) {
mAuxInfoType = reader->ReadU32();
mAuxInfoTypeParameter = reader->ReadU32();
@ -497,21 +581,34 @@ Saiz::Saiz(Box& aBox) : mAuxInfoType("sinf"), mAuxInfoTypeParameter(0)
mSampleInfoSize.AppendElement(defaultSampleInfoSize);
}
} else {
reader->ReadArray(mSampleInfoSize, count);
if (!reader->ReadArray(mSampleInfoSize, count)) {
return;
}
}
mValid = true;
}
Saio::Saio(Box& aBox) : mAuxInfoType("sinf"), mAuxInfoTypeParameter(0)
{
BoxReader reader(aBox);
if (!reader->CanReadType<uint32_t>()) {
return;
}
uint32_t flags = reader->ReadU32();
uint8_t version = flags >> 24;
size_t need = ((flags & 1) ? (2*sizeof(uint32_t)) : 0) + sizeof(uint32_t);
if (reader->Remaining() < need) {
return;
}
if (flags & 1) {
mAuxInfoType = reader->ReadU32();
mAuxInfoTypeParameter = reader->ReadU32();
}
size_t count = reader->ReadU32();
need = (version ? sizeof(uint64_t) : sizeof(uint32_t)) * count;
if (reader->Remaining() < count) {
return;
}
mOffsets.SetCapacity(count);
if (version == 0) {
for (size_t i = 0; i < count; i++) {
@ -522,5 +619,6 @@ Saio::Saio(Box& aBox) : mAuxInfoType("sinf"), mAuxInfoTypeParameter(0)
mOffsets.AppendElement(reader->ReadU64());
}
}
mValid = true;
}
}

View File

@ -36,14 +36,14 @@ public:
void SetData(const nsTArray<uint8_t>& aData)
{
MOZ_ASSERT(!mPtr && !mRemaining);
mPtr = &aData[0];
mPtr = aData.Elements();
mRemaining = aData.Length();
mLength = mRemaining;
}
~ByteReader()
{
MOZ_ASSERT(!mRemaining);
NS_ASSERTION(!mRemaining, "Not all bytes have been processed");
}
size_t Offset()

View File

@ -22,6 +22,7 @@ public:
explicit SampleIterator(Index* aIndex);
MP4Sample* GetNext();
void Seek(Microseconds aTime);
Microseconds GetNextKeyframeTime();
private:
Sample* Get();

View File

@ -16,7 +16,22 @@ class Box;
class BoxContext;
class Moof;
class Tkhd
class Atom
{
public:
Atom()
: mValid(false)
{
}
virtual bool IsValid()
{
return mValid;
}
protected:
bool mValid;
};
class Tkhd : public Atom
{
public:
Tkhd()
@ -34,7 +49,7 @@ public:
uint64_t mDuration;
};
class Mdhd
class Mdhd : public Atom
{
public:
Mdhd()
@ -57,7 +72,7 @@ public:
uint64_t mDuration;
};
class Trex
class Trex : public Atom
{
public:
explicit Trex(uint32_t aTrackId)
@ -83,26 +98,42 @@ public:
class Tfhd : public Trex
{
public:
explicit Tfhd(Trex& aTrex) : Trex(aTrex), mBaseDataOffset(0) {}
explicit Tfhd(Trex& aTrex)
: Trex(aTrex)
, mBaseDataOffset(0)
{
mValid = aTrex.IsValid();
}
Tfhd(Box& aBox, Trex& aTrex);
uint64_t mBaseDataOffset;
};
class Tfdt
class Tfdt : public Atom
{
public:
Tfdt() : mBaseMediaDecodeTime(0) {}
Tfdt()
: mBaseMediaDecodeTime(0)
{
}
explicit Tfdt(Box& aBox);
uint64_t mBaseMediaDecodeTime;
};
class Edts
class Edts : public Atom
{
public:
Edts() : mMediaStart(0) {}
Edts()
: mMediaStart(0)
{
}
explicit Edts(Box& aBox);
virtual bool IsValid()
{
// edts is optional
return true;
}
int64_t mMediaStart;
};
@ -116,7 +147,7 @@ struct Sample
bool mSync;
};
class Saiz
class Saiz : public Atom
{
public:
explicit Saiz(Box& aBox);
@ -126,7 +157,7 @@ public:
nsTArray<uint8_t> mSampleInfoSize;
};
class Saio
class Saio : public Atom
{
public:
explicit Saio(Box& aBox);
@ -142,13 +173,12 @@ public:
bool GetByteRanges(nsTArray<MediaByteRange>* aByteRanges);
private:
int64_t mMoofOffset;
Saiz& mSaiz;
Saio& mSaio;
};
class Moof
class Moof : public Atom
{
public:
Moof(Box& aBox, Trex& aTrex, Mdhd& aMdhd, Edts& aEdts, Microseconds aTimestampOffset);

View File

@ -73,6 +73,10 @@ public:
int64_t GetEvictionOffset(Microseconds aTime);
// Returns timestamp of next keyframe, or -1 if demuxer can't
// report this.
Microseconds GetNextKeyframeTime();
private:
AudioDecoderConfig mAudioConfig;
VideoDecoderConfig mVideoConfig;
@ -84,6 +88,7 @@ private:
nsTArray<Interval<Microseconds>> mCachedTimeRanges;
Microseconds mTimestampOffset;
Monitor* mMonitor;
Microseconds mNextKeyframeTime;
};
} // namespace mozilla

View File

@ -75,7 +75,8 @@ private:
MP4Demuxer::MP4Demuxer(Stream* source, Microseconds aTimestampOffset, Monitor* aMonitor)
: mPrivate(new StageFrightPrivate()), mSource(source),
mTimestampOffset(aTimestampOffset), mMonitor(aMonitor)
mTimestampOffset(aTimestampOffset), mMonitor(aMonitor),
mNextKeyframeTime(-1)
{
mPrivate->mExtractor = new MPEG4Extractor(new DataSourceAdapter(source));
}
@ -248,6 +249,9 @@ MP4Demuxer::DemuxVideoSample()
sample->crypto.mode = mVideoConfig.crypto.mode;
sample->crypto.key.AppendElements(mVideoConfig.crypto.key);
}
if (sample->composition_timestamp >= mNextKeyframeTime) {
mNextKeyframeTime = mPrivate->mVideoIterator->GetNextKeyframeTime();
}
}
return sample.forget();
}
@ -333,4 +337,14 @@ MP4Demuxer::GetEvictionOffset(Microseconds aTime)
return offset == std::numeric_limits<uint64_t>::max() ? -1 : offset;
}
Microseconds
MP4Demuxer::GetNextKeyframeTime()
{
mMonitor->AssertCurrentThreadOwns();
if (!mPrivate->mVideoIterator) {
return -1;
}
return mNextKeyframeTime;
}
} // namespace mp4_demuxer

Some files were not shown because too many files have changed in this diff Show More