Merge inbound to m-c. a=merge

This commit is contained in:
Ryan VanderMeulen 2015-04-09 22:43:57 -04:00
commit 9feefd9d6d
263 changed files with 2958 additions and 2380 deletions

View File

@ -294,13 +294,14 @@ bool
DocAccessibleChild::RecvTextSubstring(const uint64_t& aID,
const int32_t& aStartOffset,
const int32_t& aEndOffset,
nsString* aText)
nsString* aText, bool* aValid)
{
HyperTextAccessible* acc = IdToHyperTextAccessible(aID);
if (!acc) {
return true;
}
*aValid = acc->IsValidRange(aStartOffset, aEndOffset);
acc->TextSubstring(aStartOffset, aEndOffset, *aText);
return true;
}
@ -561,10 +562,11 @@ DocAccessibleChild::RecvReplaceText(const uint64_t& aID,
bool
DocAccessibleChild::RecvInsertText(const uint64_t& aID,
const nsString& aText,
const int32_t& aPosition)
const int32_t& aPosition, bool* aValid)
{
HyperTextAccessible* acc = IdToHyperTextAccessible(aID);
if (acc && acc->IsTextRole()) {
*aValid = acc->IsValidOffset(aPosition);
acc->InsertText(aText, aPosition);
}
@ -574,7 +576,7 @@ DocAccessibleChild::RecvInsertText(const uint64_t& aID,
bool
DocAccessibleChild::RecvCopyText(const uint64_t& aID,
const int32_t& aStartPos,
const int32_t& aEndPos)
const int32_t& aEndPos, bool* aValid)
{
HyperTextAccessible* acc = IdToHyperTextAccessible(aID);
if (acc && acc->IsTextRole()) {
@ -587,10 +589,11 @@ DocAccessibleChild::RecvCopyText(const uint64_t& aID,
bool
DocAccessibleChild::RecvCutText(const uint64_t& aID,
const int32_t& aStartPos,
const int32_t& aEndPos)
const int32_t& aEndPos, bool* aValid)
{
HyperTextAccessible* acc = IdToHyperTextAccessible(aID);
if (acc && acc->IsTextRole()) {
*aValid = acc->IsValidRange(aStartPos, aEndPos);
acc->CutText(aStartPos, aEndPos);
}
@ -600,10 +603,11 @@ DocAccessibleChild::RecvCutText(const uint64_t& aID,
bool
DocAccessibleChild::RecvDeleteText(const uint64_t& aID,
const int32_t& aStartPos,
const int32_t& aEndPos)
const int32_t& aEndPos, bool* aValid)
{
HyperTextAccessible* acc = IdToHyperTextAccessible(aID);
if (acc && acc->IsTextRole()) {
*aValid = acc->IsValidRange(aStartPos, aEndPos);
acc->DeleteText(aStartPos, aEndPos);
}
@ -612,10 +616,11 @@ DocAccessibleChild::RecvDeleteText(const uint64_t& aID,
bool
DocAccessibleChild::RecvPasteText(const uint64_t& aID,
const int32_t& aPosition)
const int32_t& aPosition, bool* aValid)
{
HyperTextAccessible* acc = IdToHyperTextAccessible(aID);
if (acc && acc->IsTextRole()) {
*aValid = acc->IsValidOffset(aPosition);
acc->PasteText(aPosition);
}

View File

@ -75,8 +75,8 @@ public:
virtual bool RecvTextSubstring(const uint64_t& aID,
const int32_t& aStartOffset,
const int32_t& aEndOffset, nsString* aText)
override;
const int32_t& aEndOffset, nsString* aText,
bool* aValid) override;
virtual bool RecvGetTextAfterOffset(const uint64_t& aID,
const int32_t& aOffset,
@ -166,22 +166,22 @@ public:
virtual bool RecvInsertText(const uint64_t& aID,
const nsString& aText,
const int32_t& aPosition) override;
const int32_t& aPosition, bool* aValid) override;
virtual bool RecvCopyText(const uint64_t& aID,
const int32_t& aStartPos,
const int32_t& aEndPos) override;
const int32_t& aEndPos, bool* aValid) override;
virtual bool RecvCutText(const uint64_t& aID,
const int32_t& aStartPos,
const int32_t& aEndPos) override;
const int32_t& aEndPos, bool* aValid) override;
virtual bool RecvDeleteText(const uint64_t& aID,
const int32_t& aStartPos,
const int32_t& aEndPos) override;
const int32_t& aEndPos, bool* aValid) override;
virtual bool RecvPasteText(const uint64_t& aID,
const int32_t& aPosition) override;
const int32_t& aPosition, bool* aValid) override;
virtual bool RecvImagePosition(const uint64_t& aID,
const uint32_t& aCoordType,

View File

@ -82,7 +82,7 @@ child:
prio(high) sync CharacterCount(uint64_t aID) returns(int32_t aCount);
prio(high) sync SelectionCount(uint64_t aID) returns(int32_t aCount);
prio(high) sync TextSubstring(uint64_t aID, int32_t aStartOffset, int32_t
aEndOffset) returns(nsString aText);
aEndOffset) returns(nsString aText, bool aValid);
prio(high) sync GetTextAfterOffset(uint64_t aID, int32_t aOffset, int32_t aBoundaryType)
returns(nsString aText, int32_t aStartOffset, int32_t aEndOffset);
prio(high) sync GetTextAtOffset(uint64_t aID, int32_t aOffset, int32_t aBoundaryType)
@ -124,11 +124,16 @@ child:
int32_t aX, int32_t aY);
prio(high) sync ReplaceText(uint64_t aID, nsString aText);
prio(high) sync InsertText(uint64_t aID, nsString aText, int32_t aPosition);
prio(high) sync CopyText(uint64_t aID, int32_t aStartPos, int32_t aEndPos);
prio(high) sync CutText(uint64_t aID, int32_t aStartPos, int32_t aEndPos);
prio(high) sync DeleteText(uint64_t aID, int32_t aStartPos, int32_t aEndPos);
prio(high) sync PasteText(uint64_t aID, int32_t aPosition);
prio(high) sync InsertText(uint64_t aID, nsString aText, int32_t aPosition)
returns(bool aValid);
prio(high) sync CopyText(uint64_t aID, int32_t aStartPos, int32_t aEndPos)
returns(bool aValid);
prio(high) sync CutText(uint64_t aID, int32_t aStartPos, int32_t aEndPos)
returns(bool aValid);
prio(high) sync DeleteText(uint64_t aID, int32_t aStartPos, int32_t aEndPos)
returns(bool aValid);
prio(high) sync PasteText(uint64_t aID, int32_t aPosition)
returns(bool aValid);
prio(high) sync ImagePosition(uint64_t aID, uint32_t aCoordType) returns(nsIntPoint aRetVal);
prio(high) sync ImageSize(uint64_t aID) returns(IntSize aRetVal);

View File

@ -181,11 +181,13 @@ ProxyAccessible::SelectionCount()
return count;
}
void
bool
ProxyAccessible::TextSubstring(int32_t aStartOffset, int32_t aEndOfset,
nsString& aText) const
{
unused << mDoc->SendTextSubstring(mID, aStartOffset, aEndOfset, &aText);
bool valid;
unused << mDoc->SendTextSubstring(mID, aStartOffset, aEndOfset, &aText, &valid);
return valid;
}
void
@ -333,34 +335,44 @@ ProxyAccessible::ReplaceText(const nsString& aText)
unused << mDoc->SendReplaceText(mID, aText);
}
void
bool
ProxyAccessible::InsertText(const nsString& aText, int32_t aPosition)
{
unused << mDoc->SendInsertText(mID, aText, aPosition);
bool valid;
unused << mDoc->SendInsertText(mID, aText, aPosition, &valid);
return valid;
}
void
bool
ProxyAccessible::CopyText(int32_t aStartPos, int32_t aEndPos)
{
unused << mDoc->SendCopyText(mID, aStartPos, aEndPos);
bool valid;
unused << mDoc->SendCopyText(mID, aStartPos, aEndPos, &valid);
return valid;
}
void
bool
ProxyAccessible::CutText(int32_t aStartPos, int32_t aEndPos)
{
unused << mDoc->SendCutText(mID, aStartPos, aEndPos);
bool valid;
unused << mDoc->SendCutText(mID, aStartPos, aEndPos, &valid);
return valid;
}
void
bool
ProxyAccessible::DeleteText(int32_t aStartPos, int32_t aEndPos)
{
unused << mDoc->SendDeleteText(mID, aStartPos, aEndPos);
bool valid;
unused << mDoc->SendDeleteText(mID, aStartPos, aEndPos, &valid);
return valid;
}
void
bool
ProxyAccessible::PasteText(int32_t aPosition)
{
unused << mDoc->SendPasteText(mID, aPosition);
bool valid;
unused << mDoc->SendPasteText(mID, aPosition, &valid);
return valid;
}
nsIntPoint

View File

@ -114,7 +114,7 @@ public:
/**
* Get the text between the given offsets.
*/
void TextSubstring(int32_t aStartOffset, int32_t aEndOfset,
bool TextSubstring(int32_t aStartOffset, int32_t aEndOfset,
nsString& aText) const;
void GetTextAfterOffset(int32_t aOffset, AccessibleTextBoundary aBoundaryType,
@ -169,15 +169,15 @@ public:
void ReplaceText(const nsString& aText);
void InsertText(const nsString& aText, int32_t aPosition);
bool InsertText(const nsString& aText, int32_t aPosition);
void CopyText(int32_t aStartPos, int32_t aEndPos);
bool CopyText(int32_t aStartPos, int32_t aEndPos);
void CutText(int32_t aStartPos, int32_t aEndPos);
bool CutText(int32_t aStartPos, int32_t aEndPos);
void DeleteText(int32_t aStartPos, int32_t aEndPos);
bool DeleteText(int32_t aStartPos, int32_t aEndPos);
void PasteText(int32_t aPosition);
bool PasteText(int32_t aPosition);
nsIntPoint ImagePosition(uint32_t aCoordType);

View File

@ -0,0 +1,52 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=2 et sw=2 tw=80: */
/* 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/. *
*/
#ifndef MOZILLA_A11Y_ProxyWrappers_h
#define MOZILLA_A11Y_ProxyWrappers_h
#include "HyperTextAccessible.h"
namespace mozilla {
namespace a11y {
class ProxyAccessibleWrap : public AccessibleWrap
{
public:
ProxyAccessibleWrap(ProxyAccessible* aProxy) :
AccessibleWrap(nullptr, nullptr)
{
mType = eProxyType;
mBits.proxy = aProxy;
}
virtual void Shutdown() override
{
mBits.proxy = nullptr;
}
};
class HyperTextProxyAccessibleWrap : public ProxyAccessibleWrap,
public ia2AccessibleEditableText,
public ia2AccessibleHypertext
{
HyperTextProxyAccessibleWrap(ProxyAccessible* aProxy) :
ProxyAccessibleWrap(aProxy) {}
};
template<typename T>
inline ProxyAccessible*
HyperTextProxyFor(T* aWrapper)
{
static_assert(mozilla::IsBaseOf<IUnknown, T>::value, "only IAccessible* should be passed in");
auto wrapper = static_cast<HyperTextProxyAccessibleWrap*>(aWrapper);
return wrapper->IsProxy() ? wrapper->Proxy() : nullptr;
}
}
}
#endif

View File

@ -619,22 +619,7 @@ ia2Accessible::get_attributes(BSTR* aAttributes)
nsTArray<Attribute> attrs;
acc->Proxy()->Attributes(&attrs);
nsString attrStr;
size_t attrCount = attrs.Length();
for (size_t i = 0; i < attrCount; i++) {
EscapeAttributeChars(attrs[i].Name());
EscapeAttributeChars(attrs[i].Value());
AppendUTF8toUTF16(attrs[i].Name(), attrStr);
attrStr.Append(':');
attrStr.Append(attrs[i].Value());
attrStr.Append(';');
}
if (attrStr.IsEmpty())
return S_FALSE;
*aAttributes = ::SysAllocStringLen(attrStr.get(), attrStr.Length());
return *aAttributes ? S_OK : E_OUTOFMEMORY;
return ConvertToIA2Attributes(&attrs, aAttributes);
A11Y_TRYBLOCK_END
}
@ -747,6 +732,28 @@ EscapeAttributeChars(String& aStr)
}
}
HRESULT
ia2Accessible::ConvertToIA2Attributes(nsTArray<Attribute>* aAttributes,
BSTR* aIA2Attributes)
{
nsString attrStr;
size_t attrCount = aAttributes->Length();
for (size_t i = 0; i < attrCount; i++) {
EscapeAttributeChars(aAttributes->ElementAt(i).Name());
EscapeAttributeChars(aAttributes->ElementAt(i).Value());
AppendUTF8toUTF16(aAttributes->ElementAt(i).Name(), attrStr);
attrStr.Append(':');
attrStr.Append(aAttributes->ElementAt(i).Value());
attrStr.Append(';');
}
if (attrStr.IsEmpty())
return S_FALSE;
*aIA2Attributes = ::SysAllocStringLen(attrStr.get(), attrStr.Length());
return *aIA2Attributes ? S_OK : E_OUTOFMEMORY;
}
HRESULT
ia2Accessible::ConvertToIA2Attributes(nsIPersistentProperties* aAttributes,
BSTR* aIA2Attributes)

View File

@ -13,6 +13,7 @@
namespace mozilla {
namespace a11y {
class Attribute;
class ia2Accessible : public IAccessible2_2
{
@ -106,6 +107,8 @@ public:
// Helper method
static HRESULT ConvertToIA2Attributes(nsIPersistentProperties* aAttributes,
BSTR* aIA2Attributes);
static HRESULT ConvertToIA2Attributes(nsTArray<Attribute>* aAttributes,
BSTR* aIA2Attributes);
};
} // namespace a11y

View File

@ -10,6 +10,7 @@
#include "AccessibleEditableText_i.c"
#include "HyperTextAccessible-inl.h"
#include "HyperTextAccessibleWrap.h"
#include "ProxyWrappers.h"
#include "nsCOMPtr.h"
#include "nsString.h"
@ -23,6 +24,10 @@ ia2AccessibleEditableText::copyText(long aStartOffset, long aEndOffset)
{
A11Y_TRYBLOCK_BEGIN
if (ProxyAccessible* proxy = HyperTextProxyFor(this)) {
return proxy->CopyText(aStartOffset, aEndOffset) ? S_OK : E_INVALIDARG;
}
HyperTextAccessible* textAcc = static_cast<HyperTextAccessibleWrap*>(this);
if (textAcc->IsDefunct())
return CO_E_OBJNOTCONNECTED;
@ -41,6 +46,10 @@ ia2AccessibleEditableText::deleteText(long aStartOffset, long aEndOffset)
{
A11Y_TRYBLOCK_BEGIN
if (ProxyAccessible* proxy = HyperTextProxyFor(this)) {
return proxy->DeleteText(aStartOffset, aEndOffset) ? S_OK : E_INVALIDARG;
}
HyperTextAccessible* textAcc = static_cast<HyperTextAccessibleWrap*>(this);
if (textAcc->IsDefunct())
return CO_E_OBJNOTCONNECTED;
@ -59,6 +68,12 @@ ia2AccessibleEditableText::insertText(long aOffset, BSTR *aText)
{
A11Y_TRYBLOCK_BEGIN
uint32_t length = ::SysStringLen(*aText);
nsAutoString text(*aText, length);
if (ProxyAccessible* proxy = HyperTextProxyFor(this)) {
return proxy->InsertText(text, aOffset) ? S_OK : E_INVALIDARG;
}
HyperTextAccessible* textAcc = static_cast<HyperTextAccessibleWrap*>(this);
if (textAcc->IsDefunct())
return CO_E_OBJNOTCONNECTED;
@ -66,9 +81,6 @@ ia2AccessibleEditableText::insertText(long aOffset, BSTR *aText)
if (!textAcc->IsValidOffset(aOffset))
return E_INVALIDARG;
uint32_t length = ::SysStringLen(*aText);
nsAutoString text(*aText, length);
textAcc->InsertText(text, aOffset);
return S_OK;
@ -80,6 +92,10 @@ ia2AccessibleEditableText::cutText(long aStartOffset, long aEndOffset)
{
A11Y_TRYBLOCK_BEGIN
if (ProxyAccessible* proxy = HyperTextProxyFor(this)) {
return proxy->CutText(aStartOffset, aEndOffset) ? S_OK : E_INVALIDARG;
}
HyperTextAccessible* textAcc = static_cast<HyperTextAccessibleWrap*>(this);
if (textAcc->IsDefunct())
return CO_E_OBJNOTCONNECTED;
@ -98,6 +114,10 @@ ia2AccessibleEditableText::pasteText(long aOffset)
{
A11Y_TRYBLOCK_BEGIN
if (ProxyAccessible* proxy = HyperTextProxyFor(this)) {
return proxy->PasteText(aOffset) ? S_OK : E_INVALIDARG;
}
HyperTextAccessible* textAcc = static_cast<HyperTextAccessibleWrap*>(this);
if (textAcc->IsDefunct())
return CO_E_OBJNOTCONNECTED;

View File

@ -12,6 +12,7 @@
#include "HyperTextAccessibleWrap.h"
#include "HyperTextAccessible-inl.h"
#include "ProxyWrappers.h"
using namespace mozilla::a11y;
@ -22,6 +23,11 @@ ia2AccessibleText::addSelection(long aStartOffset, long aEndOffset)
{
A11Y_TRYBLOCK_BEGIN
if (ProxyAccessible* proxy = HyperTextProxyFor(this)) {
return proxy->AddToSelection(aStartOffset, aEndOffset) ?
S_OK : E_INVALIDARG;
}
HyperTextAccessible* textAcc = static_cast<HyperTextAccessibleWrap*>(this);
if (textAcc->IsDefunct())
return CO_E_OBJNOTCONNECTED;
@ -45,16 +51,23 @@ ia2AccessibleText::get_attributes(long aOffset, long *aStartOffset,
*aEndOffset = 0;
*aTextAttributes = nullptr;
HyperTextAccessible* textAcc = static_cast<HyperTextAccessibleWrap*>(this);
if (textAcc->IsDefunct())
return CO_E_OBJNOTCONNECTED;
int32_t startOffset = 0, endOffset = 0;
nsCOMPtr<nsIPersistentProperties> attributes =
textAcc->TextAttributes(true, aOffset, &startOffset, &endOffset);
HRESULT hr;
if (ProxyAccessible* proxy = HyperTextProxyFor(this)) {
nsAutoTArray<Attribute, 10> attrs;
proxy->TextAttributes(true, aOffset, &attrs, &startOffset, &endOffset);
hr = AccessibleWrap::ConvertToIA2Attributes(&attrs, aTextAttributes);
} else {
HyperTextAccessible* textAcc = static_cast<HyperTextAccessibleWrap*>(this);
if (textAcc->IsDefunct())
return CO_E_OBJNOTCONNECTED;
nsCOMPtr<nsIPersistentProperties> attributes =
textAcc->TextAttributes(true, aOffset, &startOffset, &endOffset);
hr = AccessibleWrap::ConvertToIA2Attributes(attributes, aTextAttributes);
}
HRESULT hr = AccessibleWrap::ConvertToIA2Attributes(attributes,
aTextAttributes);
if (FAILED(hr))
return hr;
@ -76,11 +89,16 @@ ia2AccessibleText::get_caretOffset(long *aOffset)
*aOffset = -1;
HyperTextAccessible* textAcc = static_cast<HyperTextAccessibleWrap*>(this);
if (textAcc->IsDefunct())
return CO_E_OBJNOTCONNECTED;
if (ProxyAccessible* proxy = HyperTextProxyFor(this)) {
*aOffset = proxy->CaretOffset();
} else {
HyperTextAccessible* textAcc = static_cast<HyperTextAccessibleWrap*>(this);
if (textAcc->IsDefunct())
return CO_E_OBJNOTCONNECTED;
*aOffset = textAcc->CaretOffset();
}
*aOffset = textAcc->CaretOffset();
return *aOffset != -1 ? S_OK : S_FALSE;
A11Y_TRYBLOCK_END
@ -98,15 +116,19 @@ ia2AccessibleText::get_characterExtents(long aOffset,
return E_INVALIDARG;
*aX = *aY = *aWidth = *aHeight = 0;
HyperTextAccessible* textAcc = static_cast<HyperTextAccessibleWrap*>(this);
if (textAcc->IsDefunct())
return CO_E_OBJNOTCONNECTED;
uint32_t geckoCoordType = (aCoordType == IA2_COORDTYPE_SCREEN_RELATIVE) ?
nsIAccessibleCoordinateType::COORDTYPE_SCREEN_RELATIVE :
nsIAccessibleCoordinateType::COORDTYPE_PARENT_RELATIVE;
nsIntRect rect;
if (ProxyAccessible* proxy = HyperTextProxyFor(this)) {
rect = proxy->CharBounds(aOffset, geckoCoordType);
} else {
HyperTextAccessible* textAcc = static_cast<HyperTextAccessibleWrap*>(this);
if (textAcc->IsDefunct())
return CO_E_OBJNOTCONNECTED;
nsIntRect rect = textAcc->CharBounds(aOffset, geckoCoordType);
rect = textAcc->CharBounds(aOffset, geckoCoordType);
}
*aX = rect.x;
*aY = rect.y;
@ -126,11 +148,16 @@ ia2AccessibleText::get_nSelections(long* aNSelections)
return E_INVALIDARG;
*aNSelections = 0;
HyperTextAccessible* textAcc = static_cast<HyperTextAccessibleWrap*>(this);
if (textAcc->IsDefunct())
return CO_E_OBJNOTCONNECTED;
if (ProxyAccessible* proxy = HyperTextProxyFor(this)) {
*aNSelections = proxy->SelectionCount();
} else {
HyperTextAccessible* textAcc = static_cast<HyperTextAccessibleWrap*>(this);
if (textAcc->IsDefunct())
return CO_E_OBJNOTCONNECTED;
*aNSelections = textAcc->SelectionCount();
}
*aNSelections = textAcc->SelectionCount();
return S_OK;
A11Y_TRYBLOCK_END
@ -147,15 +174,20 @@ ia2AccessibleText::get_offsetAtPoint(long aX, long aY,
return E_INVALIDARG;
*aOffset = 0;
HyperTextAccessible* textAcc = static_cast<HyperTextAccessibleWrap*>(this);
if (textAcc->IsDefunct())
return CO_E_OBJNOTCONNECTED;
uint32_t geckoCoordType = (aCoordType == IA2_COORDTYPE_SCREEN_RELATIVE) ?
nsIAccessibleCoordinateType::COORDTYPE_SCREEN_RELATIVE :
nsIAccessibleCoordinateType::COORDTYPE_PARENT_RELATIVE;
*aOffset = textAcc->OffsetAtPoint(aX, aY, geckoCoordType);
if (ProxyAccessible* proxy = HyperTextProxyFor(this)) {
*aOffset = proxy->OffsetAtPoint(aX, aY, geckoCoordType);
} else {
HyperTextAccessible* textAcc = static_cast<HyperTextAccessibleWrap*>(this);
if (textAcc->IsDefunct())
return CO_E_OBJNOTCONNECTED;
*aOffset = textAcc->OffsetAtPoint(aX, aY, geckoCoordType);
}
return *aOffset == -1 ? S_FALSE : S_OK;
A11Y_TRYBLOCK_END
@ -171,13 +203,20 @@ ia2AccessibleText::get_selection(long aSelectionIndex, long* aStartOffset,
return E_INVALIDARG;
*aStartOffset = *aEndOffset = 0;
HyperTextAccessible* textAcc = static_cast<HyperTextAccessibleWrap*>(this);
if (textAcc->IsDefunct())
return CO_E_OBJNOTCONNECTED;
int32_t startOffset = 0, endOffset = 0;
if (!textAcc->SelectionBoundsAt(aSelectionIndex, &startOffset, &endOffset))
return E_INVALIDARG;
if (ProxyAccessible* proxy = HyperTextProxyFor(this)) {
nsString unused;
if (!proxy->SelectionBoundsAt(aSelectionIndex, unused, &startOffset,
&endOffset))
return E_INVALIDARG;
} else {
HyperTextAccessible* textAcc = static_cast<HyperTextAccessibleWrap*>(this);
if (textAcc->IsDefunct())
return CO_E_OBJNOTCONNECTED;
if (!textAcc->SelectionBoundsAt(aSelectionIndex, &startOffset, &endOffset))
return E_INVALIDARG;
}
*aStartOffset = startOffset;
*aEndOffset = endOffset;
@ -196,15 +235,22 @@ ia2AccessibleText::get_text(long aStartOffset, long aEndOffset, BSTR* aText)
*aText = nullptr;
HyperTextAccessible* textAcc = static_cast<HyperTextAccessibleWrap*>(this);
if (textAcc->IsDefunct())
return CO_E_OBJNOTCONNECTED;
if (!textAcc->IsValidRange(aStartOffset, aEndOffset))
return E_INVALIDARG;
nsAutoString text;
textAcc->TextSubstring(aStartOffset, aEndOffset, text);
if (ProxyAccessible* proxy = HyperTextProxyFor(this)) {
if (!proxy->TextSubstring(aStartOffset, aEndOffset, text)) {
return E_INVALIDARG;
}
} else {
HyperTextAccessible* textAcc = static_cast<HyperTextAccessibleWrap*>(this);
if (textAcc->IsDefunct())
return CO_E_OBJNOTCONNECTED;
if (!textAcc->IsValidRange(aStartOffset, aEndOffset))
return E_INVALIDARG;
textAcc->TextSubstring(aStartOffset, aEndOffset, text);
}
if (text.IsEmpty())
return S_FALSE;
@ -361,6 +407,10 @@ ia2AccessibleText::removeSelection(long aSelectionIndex)
{
A11Y_TRYBLOCK_BEGIN
if (ProxyAccessible* proxy = HyperTextProxyFor(this)) {
return proxy->RemoveFromSelection(aSelectionIndex) ? S_OK : E_INVALIDARG;
}
HyperTextAccessible* textAcc = static_cast<HyperTextAccessibleWrap*>(this);
if (textAcc->IsDefunct())
return CO_E_OBJNOTCONNECTED;
@ -376,6 +426,10 @@ ia2AccessibleText::setCaretOffset(long aOffset)
{
A11Y_TRYBLOCK_BEGIN
if (ProxyAccessible* proxy = HyperTextProxyFor(this)) {
return proxy->SetCaretOffset(aOffset) ? S_OK : E_INVALIDARG;
}
HyperTextAccessible* textAcc = static_cast<HyperTextAccessibleWrap*>(this);
if (textAcc->IsDefunct())
return CO_E_OBJNOTCONNECTED;
@ -395,6 +449,11 @@ ia2AccessibleText::setSelection(long aSelectionIndex, long aStartOffset,
{
A11Y_TRYBLOCK_BEGIN
if (ProxyAccessible* proxy = HyperTextProxyFor(this)) {
return proxy->SetSelectionBoundsAt(aSelectionIndex, aStartOffset,
aEndOffset) ? S_OK : E_INVALIDARG;
}
HyperTextAccessible* textAcc = static_cast<HyperTextAccessibleWrap*>(this);
if (textAcc->IsDefunct())
return CO_E_OBJNOTCONNECTED;
@ -414,6 +473,11 @@ ia2AccessibleText::get_nCharacters(long* aNCharacters)
return E_INVALIDARG;
*aNCharacters = 0;
if (ProxyAccessible* proxy = HyperTextProxyFor(this)) {
*aNCharacters = proxy->CharacterCount();
return S_OK;
}
HyperTextAccessible* textAcc = static_cast<HyperTextAccessibleWrap*>(this);
if (textAcc->IsDefunct())
return CO_E_OBJNOTCONNECTED;
@ -430,6 +494,11 @@ ia2AccessibleText::scrollSubstringTo(long aStartIndex, long aEndIndex,
{
A11Y_TRYBLOCK_BEGIN
if (ProxyAccessible* proxy = HyperTextProxyFor(this)) {
proxy->ScrollSubstringTo(aStartIndex, aEndIndex, aScrollType);
return S_OK;
}
HyperTextAccessible* textAcc = static_cast<HyperTextAccessibleWrap*>(this);
if (textAcc->IsDefunct())
return CO_E_OBJNOTCONNECTED;
@ -450,6 +519,16 @@ ia2AccessibleText::scrollSubstringToPoint(long aStartIndex, long aEndIndex,
{
A11Y_TRYBLOCK_BEGIN
uint32_t geckoCoordType = (aCoordType == IA2_COORDTYPE_SCREEN_RELATIVE) ?
nsIAccessibleCoordinateType::COORDTYPE_SCREEN_RELATIVE :
nsIAccessibleCoordinateType::COORDTYPE_PARENT_RELATIVE;
if (ProxyAccessible* proxy = HyperTextProxyFor(this)) {
proxy->ScrollSubstringToPoint(aStartIndex, aEndIndex, geckoCoordType, aX,
aY);
return S_OK;
}
HyperTextAccessible* textAcc = static_cast<HyperTextAccessibleWrap*>(this);
if (textAcc->IsDefunct())
return CO_E_OBJNOTCONNECTED;
@ -457,10 +536,6 @@ ia2AccessibleText::scrollSubstringToPoint(long aStartIndex, long aEndIndex,
if (!textAcc->IsValidRange(aStartIndex, aEndIndex))
return E_INVALIDARG;
uint32_t geckoCoordType = (aCoordType == IA2_COORDTYPE_SCREEN_RELATIVE) ?
nsIAccessibleCoordinateType::COORDTYPE_SCREEN_RELATIVE :
nsIAccessibleCoordinateType::COORDTYPE_PARENT_RELATIVE;
textAcc->ScrollSubstringToPoint(aStartIndex, aEndIndex,
geckoCoordType, aX, aY);
return S_OK;

View File

@ -39,6 +39,7 @@ LOCAL_INCLUDES += [
'/accessible/base',
'/accessible/generic',
'/accessible/html',
'/accessible/windows',
'/accessible/windows/msaa',
'/accessible/xpcom',
'/accessible/xul',

View File

@ -11,6 +11,7 @@
#include "HyperTextAccessibleWrap.h"
#include "nsWinUtils.h"
#include "mozilla/a11y/ProxyAccessible.h"
#include "ProxyWrappers.h"
#include "mozilla/ClearOnShutdown.h"
@ -35,22 +36,6 @@ a11y::PlatformShutdown()
nsWinUtils::ShutdownWindowEmulation();
}
class ProxyAccessibleWrap : public AccessibleWrap
{
public:
ProxyAccessibleWrap(ProxyAccessible* aProxy) :
AccessibleWrap(nullptr, nullptr)
{
mType = eProxyType;
mBits.proxy = aProxy;
}
virtual void Shutdown() override
{
mBits.proxy = nullptr;
}
};
void
a11y::ProxyCreated(ProxyAccessible* aProxy, uint32_t)
{

View File

@ -48,6 +48,7 @@ LOCAL_INCLUDES += [
'/accessible/base',
'/accessible/generic',
'/accessible/html',
'/accessible/windows',
'/accessible/windows/ia2',
'/accessible/windows/sdn',
'/accessible/windows/uia',

View File

@ -31,7 +31,7 @@ MailtoProtocolHandler.prototype = {
return uri;
},
newChannel: function Proto_newChannel(aURI) {
newChannel2: function Proto_newChannel2(aURI, aLoadInfo) {
cpmm.sendAsyncMessage("mail-handler", {
URI: aURI.spec,
type: "mail" });
@ -39,6 +39,10 @@ MailtoProtocolHandler.prototype = {
throw Components.results.NS_ERROR_ILLEGAL_VALUE;
},
newChannel: function Proto_newChannel(aURI) {
return newChannel2(aURI, null);
},
classID: Components.ID("{50777e53-0331-4366-a191-900999be386c}"),
QueryInterface: XPCOMUtils.generateQI([Ci.nsIProtocolHandler])
};

View File

@ -40,7 +40,7 @@ SmsProtocolHandler.prototype = {
return uri;
},
newChannel: function Proto_newChannel(aURI) {
newChannel2: function Proto_newChannel2(aURI, aLoadInfo) {
let number = TelURIParser.parseURI('sms', aURI.spec);
let body = "";
let query = aURI.spec.split("?")[1];
@ -65,6 +65,10 @@ SmsProtocolHandler.prototype = {
throw Components.results.NS_ERROR_ILLEGAL_VALUE;
},
newChannel: function Proto_newChannel(aURI) {
return newChannel2(aURI, null);
},
classID: Components.ID("{81ca20cb-0dad-4e32-8566-979c8998bd73}"),
QueryInterface: XPCOMUtils.generateQI([Ci.nsIProtocolHandler])
};

View File

@ -39,7 +39,7 @@ TelProtocolHandler.prototype = {
return uri;
},
newChannel: function Proto_newChannel(aURI) {
newChannel2: function Proto_newChannel(aURI, aLoadInfo) {
let number = TelURIParser.parseURI('tel', aURI.spec);
if (number) {
@ -51,6 +51,10 @@ TelProtocolHandler.prototype = {
throw Components.results.NS_ERROR_ILLEGAL_VALUE;
},
newChannel: function Proto_newChannel(aURI) {
return newChannel2(aURI, null);
},
classID: Components.ID("{782775dd-7351-45ea-aff1-0ffa872cfdd2}"),
QueryInterface: XPCOMUtils.generateQI([Ci.nsIProtocolHandler])
};

View File

@ -731,7 +731,10 @@ function test_renotify_installed() {
function test_cancel() {
function complete_install(callback) {
let url = TESTROOT + "slowinstall.sjs?continue=true"
NetUtil.asyncFetch(url, callback || (() => {}));
NetUtil.asyncFetch({
uri: url,
loadUsingSystemPrincipal: true
}, callback || (() => {}));
}
// Wait for the progress notification

View File

@ -43,9 +43,17 @@ DistributionCustomizer.prototype = {
_iniFile: null,
get _ini() {
let ini = Cc["@mozilla.org/xpcom/ini-parser-factory;1"].
let ini = null;
try {
if (this._iniFile) {
ini = Cc["@mozilla.org/xpcom/ini-parser-factory;1"].
getService(Ci.nsIINIParserFactory).
createINIParser(this._iniFile);
}
} catch (e) {
// Unable to parse INI.
Cu.reportError("Unable to parse distribution.ini");
}
this.__defineGetter__("_ini", function() ini);
return this._ini;
},
@ -202,7 +210,7 @@ DistributionCustomizer.prototype = {
_customizationsApplied: false,
applyCustomizations: function DIST_applyCustomizations() {
this._customizationsApplied = true;
if (!this._iniFile)
if (!this._ini)
return this._checkCustomizationComplete();
// nsPrefService loads very early. Reload prefs so we can set
@ -220,7 +228,7 @@ DistributionCustomizer.prototype = {
}),
_doApplyBookmarks: Task.async(function* () {
if (!this._iniFile)
if (!this._ini)
return;
let sections = enumToObject(this._ini.getSections());
@ -264,7 +272,7 @@ DistributionCustomizer.prototype = {
_prefDefaultsApplied: false,
applyPrefDefaults: function DIST_applyPrefDefaults() {
this._prefDefaultsApplied = true;
if (!this._iniFile)
if (!this._ini)
return this._checkCustomizationComplete();
let sections = enumToObject(this._ini.getSections());
@ -354,7 +362,7 @@ DistributionCustomizer.prototype = {
},
_checkCustomizationComplete: function DIST__checkCustomizationComplete() {
let prefDefaultsApplied = this._prefDefaultsApplied || !this._iniFile;
let prefDefaultsApplied = this._prefDefaultsApplied || !this._ini;
if (this._customizationsApplied && this._bookmarksApplied &&
prefDefaultsApplied) {
let os = Cc["@mozilla.org/observer-service;1"].

View File

@ -52,6 +52,7 @@ SEARCH_PATHS = [
'testing/marionette/client',
'testing/marionette/transport',
'testing/marionette/driver',
'testing/luciddream',
'testing/mozbase/mozcrash',
'testing/mozbase/mozdebug',
'testing/mozbase/mozdevice',
@ -84,6 +85,7 @@ MACH_MODULES = [
'python/mozbuild/mozbuild/backend/mach_commands.py',
'python/mozbuild/mozbuild/frontend/mach_commands.py',
'services/common/tests/mach_commands.py',
'testing/luciddream/mach_commands.py',
'testing/mach_commands.py',
'testing/taskcluster/mach_commands.py',
'testing/marionette/mach_commands.py',

View File

@ -63,6 +63,7 @@ ProtocolHandler.prototype =
}
return uri;
},
newChannel2: function() { throw Cr.NS_ERROR_NOT_IMPLEMENTED },
newChannel: function() { throw Cr.NS_ERROR_NOT_IMPLEMENTED },
QueryInterface: XPCOMUtils.generateQI([
Ci.nsIProtocolHandler

View File

@ -53,83 +53,6 @@ include_deps = $(eval $(if $(2),,-)include $(1))
ifndef INCLUDED_AUTOCONF_MK
default::
else
# Integrate with mozbuild-generated make files. We first verify that no
# variables provided by the automatically generated .mk files are
# present. If they are, this is a violation of the separation of
# responsibility between Makefile.in and mozbuild files.
_MOZBUILD_EXTERNAL_VARIABLES := \
ANDROID_GENERATED_RESFILES \
ANDROID_RES_DIRS \
CMSRCS \
CMMSRCS \
CPP_UNIT_TESTS \
DIRS \
EXTRA_DSO_LDOPTS \
EXTRA_JS_MODULES \
EXTRA_PP_COMPONENTS \
EXTRA_PP_JS_MODULES \
FORCE_SHARED_LIB \
FORCE_STATIC_LIB \
FINAL_LIBRARY \
HOST_CSRCS \
HOST_CMMSRCS \
HOST_EXTRA_LIBS \
HOST_LIBRARY_NAME \
HOST_PROGRAM \
HOST_SIMPLE_PROGRAMS \
IS_COMPONENT \
JAR_MANIFEST \
JAVA_JAR_TARGETS \
LD_VERSION_SCRIPT \
LIBRARY_NAME \
LIBS \
MAKE_FRAMEWORK \
MODULE \
MSVC_ENABLE_PGO \
NO_DIST_INSTALL \
OS_LIBS \
PARALLEL_DIRS \
PREF_JS_EXPORTS \
PROGRAM \
PYTHON_UNIT_TESTS \
RESOURCE_FILES \
SDK_HEADERS \
SDK_LIBRARY \
SHARED_LIBRARY_LIBS \
SHARED_LIBRARY_NAME \
SIMPLE_PROGRAMS \
SONAME \
STATIC_LIBRARY_NAME \
TEST_DIRS \
TOOL_DIRS \
XPCSHELL_TESTS \
XPIDL_MODULE \
$(NULL)
_DEPRECATED_VARIABLES := \
ANDROID_RESFILES \
EXPORT_LIBRARY \
EXTRA_LIBS \
HOST_LIBS \
LIBXUL_LIBRARY \
MOCHITEST_A11Y_FILES \
MOCHITEST_BROWSER_FILES \
MOCHITEST_BROWSER_FILES_PARTS \
MOCHITEST_CHROME_FILES \
MOCHITEST_FILES \
MOCHITEST_FILES_PARTS \
MOCHITEST_METRO_FILES \
MOCHITEST_ROBOCOP_FILES \
SHORT_LIBNAME \
TESTING_JS_MODULES \
TESTING_JS_MODULE_DIR \
$(NULL)
# Freeze the values specified by moz.build to catch them if they fail.
$(foreach var,$(_MOZBUILD_EXTERNAL_VARIABLES) $(_DEPRECATED_VARIABLES),$(eval $(var)_FROZEN := '$($(var))'))
TIERS := export $(if $(COMPILE_ENVIRONMENT),compile )misc libs tools
endif

View File

@ -34,18 +34,6 @@ ifndef EXTERNALLY_MANAGED_MAKE_FILE
# scenarios.
_current_makefile = $(CURDIR)/$(firstword $(MAKEFILE_LIST))
CHECK_MOZBUILD_VARIABLES = $(foreach var,$(_MOZBUILD_EXTERNAL_VARIABLES), \
$(if $(subst $($(var)_FROZEN),,'$($(var))'), \
$(error Variable $(var) is defined in $(_current_makefile). It should only be defined in moz.build files),\
)) $(foreach var,$(_DEPRECATED_VARIABLES), \
$(if $(subst $($(var)_FROZEN),,'$($(var))'), \
$(error Variable $(var) is defined in $(_current_makefile). This variable has been deprecated. It does nothing. It must be removed in order to build),\
))
# Check variables set after autoconf.mk (included at the top of Makefiles) is
# included and before config.mk is included.
_eval_for_side_effects := $(CHECK_MOZBUILD_VARIABLES)
# Import the automatically generated backend file. If this file doesn't exist,
# the backend hasn't been properly configured. We want this to be a fatal
# error, hence not using "-include".
@ -54,8 +42,6 @@ GLOBAL_DEPS += backend.mk
include backend.mk
endif
# Freeze the values specified by moz.build to catch them if they fail.
$(foreach var,$(_MOZBUILD_EXTERNAL_VARIABLES) $(_DEPRECATED_VARIABLES),$(eval $(var)_FROZEN := '$($(var))'))
endif
space = $(NULL) $(NULL)
@ -697,6 +683,3 @@ export CL_INCLUDES_PREFIX
export NONASCII
DEFINES += -DNO_NSPR_10_SUPPORT
# Freeze the values specified by moz.build to catch them if they fail.
$(foreach var,$(_MOZBUILD_EXTERNAL_VARIABLES) $(_DEPRECATED_VARIABLES),$(eval $(var)_FROZEN := '$($(var))'))

View File

@ -6,10 +6,6 @@ ifndef INCLUDED_RULES_MK
include $(topsrcdir)/config/rules.mk
endif
# Make sure that anything that needs to be defined in moz.build wasn't
# overwritten after including rules.mk.
_eval_for_side_effects := $(CHECK_MOZBUILD_VARIABLES)
# The traditional model of directory traversal with make is as follows:
# make -C foo
# Entering foo

View File

@ -16,10 +16,6 @@ $(error Do not include rules.mk twice!)
endif
INCLUDED_RULES_MK = 1
# Make sure that anything that needs to be defined in moz.build wasn't
# overwritten after including config.mk.
_eval_for_side_effects := $(CHECK_MOZBUILD_VARIABLES)
ifndef INCLUDED_CONFIG_MK
include $(topsrcdir)/config/config.mk
endif
@ -1635,10 +1631,3 @@ endif
export:: $(GENERATED_FILES)
GARBAGE += $(GENERATED_FILES)
# We may have modified "frozen" variables in rules.mk (we do that), but we don't
# want Makefile.in doing that, so collect the possibly modified variables here,
# and check them again in recurse.mk, which is always included after Makefile.in
# contents.
$(foreach var,$(_MOZBUILD_EXTERNAL_VARIABLES),$(eval $(var)_FROZEN := '$($(var))'))
$(foreach var,$(_DEPRECATED_VARIABLES),$(eval $(var)_FROZEN := '$($(var))'))

View File

@ -39,7 +39,8 @@ ParseInteger(const nsAString& aString, int32_t& aInt)
return !(parseResult &
( nsContentUtils::eParseHTMLInteger_Error |
nsContentUtils::eParseHTMLInteger_DidNotConsumeAllInput |
nsContentUtils::eParseHTMLInteger_IsPercent ));
nsContentUtils::eParseHTMLInteger_IsPercent |
nsContentUtils::eParseHTMLInteger_NonStandard ));
}
ResponsiveImageSelector::ResponsiveImageSelector(nsIContent *aContent)
@ -620,11 +621,13 @@ ResponsiveImageCandidate::ConsumeDescriptors(nsAString::const_iterator& aIter,
// End of current descriptor, consume it, skip spaces
// ("After descriptor" state in spec) before continuing
descriptors.AddDescriptor(Substring(currentDescriptor, iter));
for (; iter != end && *iter == char16_t(' '); ++iter);
for (; iter != end && nsContentUtils::IsHTMLWhitespace(*iter); ++iter);
if (iter == end) {
break;
}
currentDescriptor = iter;
// Leave one whitespace so the loop advances to this position next iteration
iter--;
} else if (*iter == char16_t('(')) {
inParens = true;
}

View File

@ -1380,19 +1380,6 @@ nsHTMLCopyEncoder::SetSelection(nsISelection* aSelection)
mIsTextWidget = true;
break;
}
else if (selContent->IsElement()) {
nsRefPtr<nsStyleContext> styleContext =
nsComputedDOMStyle::GetStyleContextForElementNoFlush(selContent->AsElement(),
nullptr, nullptr);
if (styleContext) {
const nsStyleText* textStyle = styleContext->StyleText();
if (textStyle->WhiteSpaceOrNewlineIsSignificant()) {
// Copy as plaintext for all preformatted elements
mIsTextWidget = true;
}
break;
}
}
}
// normalize selection if we are not in a widget

View File

@ -40,12 +40,14 @@ var ios = Cc["@mozilla.org/network/io-service;1"]
var PROTOCOL_SCHEME = "jsproto";
function CustomChannel(uri) {
function CustomChannel(uri, loadInfo) {
this.URI = this.originalURI = uri;
this.loadInfo = loadInfo;
}
CustomChannel.prototype = {
URI: null,
originalURI: null,
loadInfo: null,
contentCharset: "utf-8",
contentLength: 0,
contentType: "text/plain",
@ -111,8 +113,11 @@ CustomProtocol.prototype = {
uri.spec = spec;
return uri.QueryInterface(Ci.nsIURI);
},
newChannel: function newChannel(URI) {
return new CustomChannel(URI);
newChannel2: function newChannel2(URI, loadInfo) {
return new CustomChannel(URI, loadInfo);
},
newChannel: function newChannel(URI) {
return newChannel2(URI);
},
QueryInterface: XPCOMUtils.generateQI([Ci.nsISupports,
Ci.nsISupportsWeakReference,

View File

@ -32,6 +32,21 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=116083
</div>
<script type="application/javascript">
const Cc = SpecialPowers.Cc;
const Ci = SpecialPowers.Ci;
function hasExpectedFlavors() {
var flavors = [
"text/plain",
"text/html",
"application/x-moz-nativehtml",
];
var cb = Cc["@mozilla.org/widget/clipboard;1"].
getService(Ci.nsIClipboard);
return cb.hasDataMatchingFlavors(flavors, flavors.length,
cb.kGlobalClipboard);
}
SimpleTest.waitForExplicitFinish();
SimpleTest.waitForFocus(function nextTest() {
var div = document.querySelector("#content>div");
@ -47,6 +62,7 @@ SimpleTest.waitForFocus(function nextTest() {
synthesizeKey("C", {accelKey: true});
}, function() {
ok(true, div.getAttribute("style") + " passed");
ok(hasExpectedFlavors(), "The clipboard has the expected flavors");
div.parentNode.removeChild(div);
nextTest();
}, function() {

View File

@ -4,6 +4,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
Components.utils.import("resource://testing-common/httpd.js");
Components.utils.import("resource://gre/modules/Services.jsm");
const nsIDocumentEncoder = Components.interfaces.nsIDocumentEncoder;
const replacementChar = Components.interfaces.nsIConverterInputStream.DEFAULT_REPLACEMENT_CHARACTER;
@ -16,7 +17,12 @@ function loadContentFile(aFile, aCharset) {
var file = do_get_file(aFile);
var ios = Components.classes['@mozilla.org/network/io-service;1']
.getService(Components.interfaces.nsIIOService);
var chann = ios.newChannelFromURI ( ios.newFileURI (file) );
var chann = ios.newChannelFromURI2(ios.newFileURI(file),
null, // aLoadingNode
Services.scriptSecurityManager.getSystemPrincipal(),
null, // aTriggeringPrincipal
Components.interfaces.nsILoadInfo.SEC_NORMAL,
Components.interfaces.nsIContentPolicy.TYPE_OTHER);
chann.contentCharset = aCharset;
/*var inputStream = Components.classes["@mozilla.org/scriptableinputstream;1"]

View File

@ -38,7 +38,7 @@ function serviceWorkerTestExec(testFile) {
document.body.appendChild(iframe);
}
navigator.serviceWorker.register("worker_wrapper.js" + "?" + (Math.random()), {scope: "."})
navigator.serviceWorker.register("worker_wrapper.js", {scope: "."})
.then(function(registration) {
if (registration.installing) {
registration.installing.onstatechange = function(e) {

View File

@ -199,12 +199,14 @@ AudioSegment::WriteTo(uint64_t aID, AudioMixer& aMixer, uint32_t aOutputChannels
offset += frames * aOutputChannels;
#if !defined(MOZILLA_XPCOMRT_API)
if (!c.mTimeStamp.IsNull()) {
TimeStamp now = TimeStamp::Now();
// would be more efficient to c.mTimeStamp to ms on create time then pass here
LogTime(AsyncLatencyLogger::AudioMediaStreamTrack, aID,
(now - c.mTimeStamp).ToMilliseconds(), c.mTimeStamp);
}
#endif // !defined(MOZILLA_XPCOMRT_API)
}
if (offset) {

View File

@ -198,7 +198,10 @@ public:
MOZ_ASSERT(channels == segmentChannelCount);
output.SetLength(channels);
bufferPtrs.SetLength(channels);
#if !defined(MOZILLA_XPCOMRT_API)
// FIXME Bug 1126414 - XPCOMRT does not support dom::WebAudioUtils::SpeexResamplerProcess
uint32_t inFrames = c.mDuration;
#endif // !defined(MOZILLA_XPCOMRT_API)
// Round up to allocate; the last frame may not be used.
NS_ASSERTION((UINT32_MAX - aInRate + 1) / c.mDuration >= aOutRate,
"Dropping samples");
@ -208,10 +211,13 @@ public:
T* out = output[i].AppendElements(outSize);
uint32_t outFrames = outSize;
#if !defined(MOZILLA_XPCOMRT_API)
// FIXME Bug 1126414 - XPCOMRT does not support dom::WebAudioUtils::SpeexResamplerProcess
dom::WebAudioUtils::SpeexResamplerProcess(aResampler, i,
in, &inFrames,
out, &outFrames);
MOZ_ASSERT(inFrames == c.mDuration);
#endif // !defined(MOZILLA_XPCOMRT_API)
bufferPtrs[i] = out;
output[i].SetLength(outFrames);
}

View File

@ -0,0 +1,53 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* vim:set ts=4 sw=4 sts=4 ci et: */
/* 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/. */
#include "SimpleImageBuffer.h"
#include "mozilla/NullPtr.h"
namespace mozilla {
void
SimpleImageBuffer::SetImage(const unsigned char* frame, unsigned int size, int width, int height)
{
mWidth = width;
mHeight = height;
if (!mBuffer || (size > mBufferSize)) {
if (mBuffer) {
delete[] mBuffer;
mBuffer = nullptr;
}
mBufferSize = size;
if (size > 0) {
mBuffer = new unsigned char[size];
}
}
if (mBuffer) {
if (frame && (size > 0)) {
memcpy((void *)mBuffer, (const void*)frame, size);
}
mSize = size;
}
}
void
SimpleImageBuffer::Copy(const SimpleImageBuffer* aImage)
{
if (aImage) {
SetImage(aImage->mBuffer, aImage->mSize, aImage->mWidth, aImage->mHeight);
}
}
const unsigned char*
SimpleImageBuffer::GetImage(unsigned int* size) const
{
if (size) {
*size = mSize;
}
return mBuffer;
}
} // namespace mozilla

View File

@ -0,0 +1,50 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* vim:set ts=4 sw=4 sts=4 ci et: */
/* 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/. */
#ifndef simple_image_buffer_h
#define simple_image_buffer_h
#include "mozilla/NullPtr.h"
#include "nsISupportsImpl.h"
namespace mozilla {
class SimpleImageBuffer {
NS_INLINE_DECL_THREADSAFE_REFCOUNTING(SimpleImageBuffer)
public:
SimpleImageBuffer() : mBuffer(nullptr), mBufferSize(0), mSize(0), mWidth(0), mHeight(0) {}
void SetImage(const unsigned char* frame, unsigned int size, int width, int height);
void Copy(const SimpleImageBuffer* aImage);
const unsigned char* GetImage(unsigned int* size) const;
void GetWidthAndHeight(int* width, int* height) const
{
if (width) {
*width = mWidth;
}
if (height) {
*height = mHeight;
}
}
protected:
~SimpleImageBuffer()
{
delete[] mBuffer;
}
const unsigned char* mBuffer;
unsigned int mBufferSize;
unsigned int mSize;
int mWidth;
int mHeight;
private:
SimpleImageBuffer(const SimpleImageBuffer& aImage);
SimpleImageBuffer& operator=(const SimpleImageBuffer& aImage);
};
} // namespace mozilla
#endif // simple_image_buffer_h

View File

@ -39,6 +39,7 @@ VideoFrame::TakeFrom(VideoFrame* aFrame)
mForceBlack = aFrame->GetForceBlack();
}
#if !defined(MOZILLA_XPCOMRT_API)
/* static */ already_AddRefed<Image>
VideoFrame::CreateBlackImage(const gfxIntSize& aSize)
{
@ -83,6 +84,7 @@ VideoFrame::CreateBlackImage(const gfxIntSize& aSize)
return image.forget();
}
#endif // !defined(MOZILLA_XPCOMRT_API)
VideoChunk::VideoChunk()
{}

View File

@ -10,7 +10,11 @@
#include "nsCOMPtr.h"
#include "gfxPoint.h"
#include "nsAutoPtr.h"
#if defined(MOZILLA_XPCOMRT_API)
#include "SimpleImageBuffer.h"
#else
#include "ImageContainer.h"
#endif
namespace mozilla {
@ -20,7 +24,11 @@ class Image;
class VideoFrame {
public:
#if defined(MOZILLA_XPCOMRT_API)
typedef mozilla::SimpleImageBuffer Image;
#else
typedef mozilla::layers::Image Image;
#endif
VideoFrame(already_AddRefed<Image>& aImage, const gfxIntSize& aIntrinsicSize);
VideoFrame();
@ -44,8 +52,10 @@ public:
void SetNull();
void TakeFrom(VideoFrame* aFrame);
#if !defined(MOZILLA_XPCOMRT_API)
// Create a planar YCbCr black image.
static already_AddRefed<Image> CreateBlackImage(const gfxIntSize& aSize);
#endif // !defined(MOZILLA_XPCOMRT_API)
protected:
// mImage can be null to indicate "no video" (aka "empty frame"). It can
@ -93,7 +103,11 @@ struct VideoChunk {
class VideoSegment : public MediaSegmentBase<VideoSegment, VideoChunk> {
public:
#if defined(MOZILLA_XPCOMRT_API)
typedef mozilla::SimpleImageBuffer Image;
#else
typedef mozilla::layers::Image Image;
#endif
typedef mozilla::gfx::IntSize IntSize;
VideoSegment();

View File

@ -16,6 +16,7 @@ DIRS += [
'webrtc',
'webspeech',
'webvtt',
'standalone',
]
if CONFIG['MOZ_RAW']:

View File

@ -0,0 +1,47 @@
# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
# vim: set filetype=python:
# 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/.
if CONFIG['OS_TARGET'] != 'WINNT' and CONFIG['MOZ_WIDGET_TOOLKIT'] != 'gonk':
Library('media_standalone')
UNIFIED_SOURCES += [
'../AudioChannelFormat.cpp',
'../AudioSegment.cpp',
'../SimpleImageBuffer.cpp',
'../VideoSegment.cpp',
]
if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'cocoa':
UNIFIED_SOURCES += ['../systemservices/OSXRunLoopSingleton.cpp']
MSVC_ENABLE_PGO = True
LOCAL_INCLUDES += [
'/caps',
'/dom/base',
'/dom/camera',
'/layout/generic',
'/layout/xul',
'/netwerk/base',
]
if CONFIG['MOZ_WEBRTC']:
LOCAL_INCLUDES += [
'/media/webrtc/signaling/src/common',
'/media/webrtc/trunk',
]
DEFINES['MOZILLA_INTERNAL_API'] = True
DEFINES['MOZILLA_XPCOMRT_API'] = True
DEFINES['MOZILLA_EXTERNAL_LINKAGE'] = True
include('/ipc/chromium/chromium-config.mozbuild')
# Suppress some GCC warnings being treated as errors:
# - about attributes on forward declarations for types that are already
# defined, which complains about an important MOZ_EXPORT for android::AString
if CONFIG['GNU_CC']:
CXXFLAGS += ['-Wno-error=attributes']

View File

@ -47,6 +47,7 @@ class ParentSingleton : public nsISupports
{
public:
static const size_t DecodedLength = 18;
static const size_t EncodedLength = DecodedLength * 4 / 3;
OriginKey(const nsACString& aKey, int64_t aSecondsStamp)
: mKey(aKey)
@ -67,7 +68,7 @@ class ParentSingleton : public nsISupports
OriginKey* key;
if (!mKeys.Get(aOrigin, &key)) {
nsCString salt; // Make a new one
nsresult rv = GenerateRandomName(salt, key->DecodedLength * 4 / 3);
nsresult rv = GenerateRandomName(salt, key->EncodedLength);
if (NS_WARN_IF(NS_FAILED(rv))) {
return rv;
}
@ -207,7 +208,7 @@ class ParentSingleton : public nsISupports
const nsACString& origin = Substring(s, f+1);
// Validate key
if (key.Length() != OriginKey::DecodedLength) {
if (key.Length() != OriginKey::EncodedLength) {
continue;
}
nsCString dummy;

View File

@ -69,7 +69,7 @@
ok(img.currentSrc.endsWith("non_existent_image.404"), "Should have synchronously selected source");
img.removeAttribute("src");
is(img.currentSrc, null, "Should have dropped currentSrc");
is(img.currentSrc, '', "Should have dropped currentSrc");
// Load another image while previous load is still pending
img.src = testPNG200;

View File

@ -65,7 +65,7 @@
info("test 1");
img.srcset = testPNG100;
img.src = testPNG50;
is(img.currentSrc, null, "Should not have synchronously selected source");
is(img.currentSrc, '', "Should not have synchronously selected source");
// No events should have fired synchronously, now we should get just one load (and no 404 error)
expectEvents(1, 0, nextTest);

View File

@ -62,7 +62,7 @@ partial interface HTMLImageElement {
[SetterThrows, Pref="dom.image.picture.enabled"]
attribute DOMString sizes;
[Pref="dom.image.srcset.enabled"]
readonly attribute DOMString? currentSrc;
readonly attribute DOMString currentSrc;
};
// Mozilla extensions.

View File

@ -44,13 +44,8 @@ PaintWithMask(gfxContext* aContext, float aOpacity, Layer* aMaskLayer)
{
AutoMoz2DMaskData mask;
if (GetMaskData(aMaskLayer, Point(), &mask)) {
if (aOpacity < 1.0) {
aContext->PushGroup(gfxContentType::COLOR_ALPHA);
aContext->Paint(aOpacity);
aContext->PopGroupToSource();
}
aContext->SetMatrix(ThebesMatrix(mask.GetTransform()));
aContext->Mask(mask.GetSurface());
aContext->Mask(mask.GetSurface(), aOpacity);
return;
}

View File

@ -767,17 +767,17 @@ gfxContext::Mask(gfxASurface *surface, const gfxPoint& offset)
gfxPoint pt = surface->GetDeviceOffset();
Mask(sourceSurf, Point(offset.x - pt.x, offset.y - pt.y));
Mask(sourceSurf, 1.0f, Point(offset.x - pt.x, offset.y - pt.y));
}
void
gfxContext::Mask(SourceSurface *surface, const Point& offset)
gfxContext::Mask(SourceSurface *surface, float alpha, const Point& offset)
{
// We clip here to bind to the mask surface bounds, see above.
mDT->MaskSurface(PatternFromState(this),
surface,
offset,
DrawOptions(1.0f, CurrentState().op, CurrentState().aaMode));
DrawOptions(alpha, CurrentState().op, CurrentState().aaMode));
}
void

View File

@ -319,7 +319,7 @@ public:
*/
void Mask(gfxASurface *surface, const gfxPoint& offset = gfxPoint(0.0, 0.0));
void Mask(mozilla::gfx::SourceSurface *surface, const mozilla::gfx::Point& offset = mozilla::gfx::Point());
void Mask(mozilla::gfx::SourceSurface *surface, float alpha = 1.0f, const mozilla::gfx::Point& offset = mozilla::gfx::Point());
/**
** Line Properties

View File

@ -1715,8 +1715,8 @@ class _GenerateProtocolCode(ipdl.ast.Visitor):
def genTransitionFunc(self):
ptype = self.protocol.decl.type
usesend, sendvar = set(), ExprVar('__Send')
userecv, recvvar = set(), ExprVar('__Recv')
usesend, sendvar = set(), ExprVar('Send__')
userecv, recvvar = set(), ExprVar('Recv__')
def sameTrigger(trigger, actionexpr):
if trigger is ipdl.ast.SEND or trigger is ipdl.ast.CALL:
@ -1881,9 +1881,9 @@ def _generateMessageClass(clsname, msgid, priority, prettyName, compress):
# generate a logging function
# 'pfx' will be something like "[FooParent] sent"
pfxvar = ExprVar('__pfx')
otherpid = ExprVar('__otherPid')
receiving = ExprVar('__receiving')
pfxvar = ExprVar('pfx__')
otherpid = ExprVar('otherPid__')
receiving = ExprVar('receiving__')
logger = MethodDefn(MethodDecl(
'Log',
params=([ Decl(Type('std::string', const=1, ref=1), pfxvar.name),
@ -1892,7 +1892,7 @@ def _generateMessageClass(clsname, msgid, priority, prettyName, compress):
const=1))
# TODO/cjones: allow selecting what information is printed to
# the log
msgvar = ExprVar('__logmsg')
msgvar = ExprVar('logmsg__')
logger.addstmt(StmtDecl(Decl(Type('std::string'), msgvar.name)))
def appendToMsg(thing):
@ -3072,18 +3072,18 @@ class _GenerateProtocolActorCode(ipdl.ast.Visitor):
## OnMessageReceived()/OnCallReceived()
# save these away for use in message handler case stmts
msgvar = ExprVar('__msg')
msgvar = ExprVar('msg__')
self.msgvar = msgvar
replyvar = ExprVar('__reply')
replyvar = ExprVar('reply__')
self.replyvar = replyvar
itervar = ExprVar('__iter')
itervar = ExprVar('iter__')
self.itervar = itervar
var = ExprVar('__v')
var = ExprVar('v__')
self.var = var
# for ctor recv cases, we can't read the actor ID into a PFoo*
# because it doesn't exist on this side yet. Use a "special"
# actor handle instead
handlevar = ExprVar('__handle')
handlevar = ExprVar('handle__')
self.handlevar = handlevar
msgtype = ExprCall(ExprSelect(msgvar, '.', 'type'), [ ])
@ -3136,14 +3136,14 @@ class _GenerateProtocolActorCode(ipdl.ast.Visitor):
return method
if dispatches:
routevar = ExprVar('__route')
routevar = ExprVar('route__')
routedecl = StmtDecl(
Decl(_actorIdType(), routevar.name),
init=ExprCall(ExprSelect(msgvar, '.', 'routing_id')))
routeif = StmtIf(ExprBinary(
ExprVar('MSG_ROUTING_CONTROL'), '!=', routevar))
routedvar = ExprVar('__routed')
routedvar = ExprVar('routed__')
routeif.ifb.addstmt(
StmtDecl(Decl(Type('ChannelListener', ptr=1),
routedvar.name),
@ -4392,7 +4392,7 @@ class _GenerateProtocolActorCode(ipdl.ast.Visitor):
## Write([const] PFoo* var)
write = MethodDefn(self.writeMethodDecl(intype, var))
nullablevar = ExprVar('__nullable')
nullablevar = ExprVar('nullable__')
write.decl.params.append(Decl(Type.BOOL, nullablevar.name))
# id_t id;
# if (!var)
@ -4692,7 +4692,7 @@ class _GenerateProtocolActorCode(ipdl.ast.Visitor):
outtype = _cxxPtrToType(uniontype, self.side)
ud = uniontype._ast
typename = '__type'
typename = 'type__'
uniontdef = Typedef(_cxxBareType(uniontype, typename), typename)
typevar = ExprVar('type')
@ -5298,7 +5298,7 @@ class _GenerateProtocolActorCode(ipdl.ast.Visitor):
return stmts
def sendAsync(self, md, msgexpr, actor=None):
sendok = ExprVar('__sendok')
sendok = ExprVar('sendok__')
return (
sendok,
([ Whitespace.NL,
@ -5315,7 +5315,7 @@ class _GenerateProtocolActorCode(ipdl.ast.Visitor):
)
def sendBlocking(self, md, msgexpr, replyexpr, actor=None):
sendok = ExprVar('__sendok')
sendok = ExprVar('sendok__')
return (
sendok,
([ Whitespace.NL,
@ -5405,7 +5405,7 @@ class _GenerateProtocolActorCode(ipdl.ast.Visitor):
ExprVar('js::ProfileEntry::Category::OTHER') ]))
def saveActorId(self, md):
idvar = ExprVar('__id')
idvar = ExprVar('id__')
if md.decl.type.hasReply():
# only save the ID if we're actually going to use it, to
# avoid unused-variable warnings

View File

@ -848,7 +848,7 @@ class AsmJSModule
uint8_t * interruptExit_;
uint8_t * outOfBoundsExit_;
StaticLinkData staticLinkData_;
HeapPtrArrayBufferObjectMaybeShared maybeHeap_;
RelocatablePtrArrayBufferObjectMaybeShared maybeHeap_;
AsmJSModule ** prevLinked_;
AsmJSModule * nextLinked_;
bool dynamicallyLinked_;

View File

@ -252,6 +252,8 @@
_(storeXY) \
_(storeXYZ) \
_(check)
#define ION_ONLY_INT32X4_SIMD_OP(_) \
_(bool)
#define FOREACH_COMMONX4_SIMD_OP(_) \
ION_COMMONX4_SIMD_OP(_) \
COMP_COMMONX4_TO_INT32X4_SIMD_OP(_)

View File

@ -300,10 +300,12 @@ namespace StructType {
bool FieldsArrayGetter(JSContext* cx, JS::CallArgs args);
static bool FieldGetter(JSContext* cx, HandleObject obj, HandleId idval,
MutableHandleValue vp);
static bool FieldSetter(JSContext* cx, HandleObject obj, HandleId idval,
MutableHandleValue vp, ObjectOpResult& result);
enum {
SLOT_FIELDNAME
};
static bool FieldGetter(JSContext* cx, unsigned argc, Value* vp);
static bool FieldSetter(JSContext* cx, unsigned argc, Value* vp);
static bool AddressOfField(JSContext* cx, unsigned argc, jsval* vp);
static bool Define(JSContext* cx, unsigned argc, jsval* vp);
}
@ -4923,14 +4925,30 @@ StructType::DefineInternal(JSContext* cx, JSObject* typeObj_, JSObject* fieldsOb
// Add the field to the StructType's 'prototype' property.
AutoStableStringChars nameChars(cx);
if (!nameChars.initTwoByte(cx, name))
return false;
return false;
RootedFunction getter(cx, NewFunctionWithReserved(cx, StructType::FieldGetter, 0, 0, nullptr));
if (!getter)
return false;
SetFunctionNativeReserved(getter, StructType::SLOT_FIELDNAME,
StringValue(JS_FORGET_STRING_FLATNESS(name)));
RootedObject getterObj(cx, JS_GetFunctionObject(getter));
RootedFunction setter(cx, NewFunctionWithReserved(cx, StructType::FieldSetter, 1, 0, nullptr));
if (!setter)
return false;
SetFunctionNativeReserved(setter, StructType::SLOT_FIELDNAME,
StringValue(JS_FORGET_STRING_FLATNESS(name)));
RootedObject setterObj(cx, JS_GetFunctionObject(setter));
if (!JS_DefineUCProperty(cx, prototype,
nameChars.twoByteChars(), name->length(), UndefinedHandleValue,
JSPROP_SHARED | JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_PROPOP_ACCESSORS,
JS_PROPERTYOP_GETTER(StructType::FieldGetter),
JS_PROPERTYOP_SETTER(StructType::FieldSetter)))
JSPROP_SHARED | JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_GETTER | JSPROP_SETTER,
JS_DATA_TO_FUNC_PTR(JSNative, getterObj.get()),
JS_DATA_TO_FUNC_PTR(JSNative, setterObj.get())))
{
return false;
}
size_t fieldSize = CType::GetSize(fieldType);
size_t fieldAlign = CType::GetAlignment(fieldType);
@ -5271,8 +5289,16 @@ StructType::FieldsArrayGetter(JSContext* cx, JS::CallArgs args)
}
bool
StructType::FieldGetter(JSContext* cx, HandleObject obj, HandleId idval, MutableHandleValue vp)
StructType::FieldGetter(JSContext* cx, unsigned argc, Value* vp)
{
CallArgs args = CallArgsFromVp(argc, vp);
if (!args.thisv().isObject()) {
JS_ReportError(cx, "not a CData");
return false;
}
RootedObject obj(cx, &args.thisv().toObject());
if (!CData::IsCData(obj)) {
JS_ReportError(cx, "not a CData");
return false;
@ -5284,19 +5310,31 @@ StructType::FieldGetter(JSContext* cx, HandleObject obj, HandleId idval, Mutable
return false;
}
const FieldInfo* field = LookupField(cx, typeObj, JSID_TO_FLAT_STRING(idval));
RootedValue nameVal(cx, GetFunctionNativeReserved(&args.callee(), SLOT_FIELDNAME));
Rooted<JSFlatString*> name(cx, JS_FlattenString(cx, nameVal.toString()));
if (!name)
return false;
const FieldInfo* field = LookupField(cx, typeObj, name);
if (!field)
return false;
char* data = static_cast<char*>(CData::GetData(obj)) + field->mOffset;
RootedObject fieldType(cx, field->mType);
return ConvertToJS(cx, fieldType, obj, data, false, false, vp);
return ConvertToJS(cx, fieldType, obj, data, false, false, args.rval());
}
bool
StructType::FieldSetter(JSContext* cx, HandleObject obj, HandleId idval, MutableHandleValue vp,
ObjectOpResult& result)
StructType::FieldSetter(JSContext* cx, unsigned argc, Value* vp)
{
CallArgs args = CallArgsFromVp(argc, vp);
if (!args.thisv().isObject()) {
JS_ReportError(cx, "not a CData");
return false;
}
RootedObject obj(cx, &args.thisv().toObject());
if (!CData::IsCData(obj)) {
JS_ReportError(cx, "not a CData");
return false;
@ -5308,14 +5346,19 @@ StructType::FieldSetter(JSContext* cx, HandleObject obj, HandleId idval, Mutable
return false;
}
const FieldInfo* field = LookupField(cx, typeObj, JSID_TO_FLAT_STRING(idval));
RootedValue nameVal(cx, GetFunctionNativeReserved(&args.callee(), SLOT_FIELDNAME));
Rooted<JSFlatString*> name(cx, JS_FlattenString(cx, nameVal.toString()));
if (!name)
return false;
const FieldInfo* field = LookupField(cx, typeObj, name);
if (!field)
return false;
args.rval().setUndefined();
char* data = static_cast<char*>(CData::GetData(obj)) + field->mOffset;
if (!ImplicitConvert(cx, vp, field->mType, data, false, nullptr))
return false;
return result.succeed();
return ImplicitConvert(cx, args.get(0), field->mType, data, false, nullptr);
}
bool

View File

@ -67,53 +67,10 @@ CurrentThreadIsIonCompiling()
return TlsPerThreadData.get()->ionCompiling;
}
static bool
GCIsSweepingOnMainThread(JSRuntime* rt, Zone* zone)
bool
CurrentThreadIsGCSweeping()
{
return rt->isHeapMajorCollecting() && rt->gc.state() == SWEEP &&
(zone->isGCSweeping() || rt->isAtomsZone(zone));
}
static bool
GCIsSweepingOnBackgroundThread(JSRuntime* rt, Zone* zone)
{
return rt->gc.isBackgroundSweeping() &&
(zone->isGCBackgroundSweeping() || rt->isAtomsZone(zone));
}
static bool
ThingMayHaveDifferentRuntime(TenuredCell* cell)
{
// Some GC things may be associated with another runtime.
AllocKind kind = cell->getAllocKind();
if (kind == AllocKind::STRING)
return static_cast<const JSString*>(cell)->isPermanentAtom();
else if (kind == AllocKind::SYMBOL)
return static_cast<const JS::Symbol*>(cell)->isWellKnownSymbol();
return false;
}
void
CheckGCIsSweepingZone(gc::Cell* cell)
{
MOZ_ASSERT(!IsInsideNursery(cell));
TenuredCell* tenured = &cell->asTenured();
if (ThingMayHaveDifferentRuntime(tenured))
return;
Zone* zone = tenured->zoneFromAnyThread();
JSRuntime* rt = zone->runtimeFromAnyThread();
if (CurrentThreadCanAccessRuntime(rt)) {
// We're on the main thread.
MOZ_ASSERT(GCIsSweepingOnMainThread(rt, zone));
} else {
// We're not on the main thread, so we're either on a helper thread run
// while the GC is active on the main thread or we are background
// sweeping.
MOZ_ASSERT(GCIsSweepingOnMainThread(rt, zone) ||
GCIsSweepingOnBackgroundThread(rt, zone));
}
return js::TlsPerThreadData.get()->gcSweeping;
}
#endif // DEBUG

View File

@ -192,6 +192,9 @@ class JitCode;
// a helper thread.
bool
CurrentThreadIsIonCompiling();
bool
CurrentThreadIsGCSweeping();
#endif
bool
@ -287,11 +290,6 @@ ZoneOfIdFromAnyThread(const jsid& id)
void
ValueReadBarrier(const Value& value);
#ifdef DEBUG
void
CheckGCIsSweepingZone(gc::Cell* cell);
#endif
template <typename T>
struct InternalGCMethods {};
@ -308,13 +306,6 @@ struct InternalGCMethods<T*>
static void postBarrierRemove(T** vp) { T::writeBarrierPostRemove(*vp, vp); }
static void readBarrier(T* v) { T::readBarrier(v); }
#ifdef DEBUG
static void checkGCIsSweeping(T* v) {
if (v)
CheckGCIsSweepingZone(v);
}
#endif
};
template <>
@ -392,13 +383,6 @@ struct InternalGCMethods<Value>
}
static void readBarrier(const Value& v) { ValueReadBarrier(v); }
#ifdef DEBUG
static void checkGCIsSweeping(const Value& v) {
if (v.isMarkable())
CheckGCIsSweepingZone(v.toGCThing());
}
#endif
};
template <>
@ -422,13 +406,6 @@ struct InternalGCMethods<jsid>
static void postBarrier(jsid* idp) {}
static void postBarrierRelocate(jsid* idp) {}
static void postBarrierRemove(jsid* idp) {}
#ifdef DEBUG
static void checkGCIsSweeping(jsid id) {
if (JSID_IS_GCTHING(id))
CheckGCIsSweepingZone(JSID_TO_GCTHING(id).asCell());
}
#endif
};
template <typename T>
@ -472,10 +449,6 @@ class BarrieredBase : public BarrieredBaseMixins<T>
protected:
void pre() { InternalGCMethods<T>::preBarrier(value); }
void pre(Zone* zone) { InternalGCMethods<T>::preBarrier(zone, value); }
#ifdef DEBUG
void checkGCIsSweeping() { InternalGCMethods<T>::checkGCIsSweeping(value); }
#endif
};
template <>
@ -542,7 +515,9 @@ class HeapPtr : public BarrieredBase<T>
explicit HeapPtr(T v) : BarrieredBase<T>(v) { post(); }
explicit HeapPtr(const HeapPtr<T>& v) : BarrieredBase<T>(v) { post(); }
#ifdef DEBUG
~HeapPtr() { this->checkGCIsSweeping(); }
~HeapPtr() {
MOZ_ASSERT(CurrentThreadIsGCSweeping());
}
#endif
void init(T v) {
@ -555,13 +530,6 @@ class HeapPtr : public BarrieredBase<T>
protected:
void post() { InternalGCMethods<T>::postBarrier(&this->value); }
/* Make this friend so it can access pre() and post(). */
template <class T1, class T2>
friend inline void
BarrieredSetPair(Zone* zone,
HeapPtr<T1*>& v1, T1* val1,
HeapPtr<T2*>& v2, T2* val2);
private:
void set(const T& v) {
this->pre();
@ -684,26 +652,6 @@ class RelocatablePtr : public BarrieredBase<T>
}
};
/*
* This is a hack for RegExpStatics::updateFromMatch. It allows us to do two
* barriers with only one branch to check if we're in an incremental GC.
*/
template <class T1, class T2>
static inline void
BarrieredSetPair(Zone* zone,
HeapPtr<T1*>& v1, T1* val1,
HeapPtr<T2*>& v2, T2* val2)
{
if (T1::needWriteBarrierPre(zone)) {
v1.pre();
v2.pre();
}
v1.unsafeSet(val1);
v2.unsafeSet(val2);
v1.post();
v2.post();
}
/*
* This is a hack for RegExpStatics::updateFromMatch. It allows us to do two
* barriers with only one branch to check if we're in an incremental GC.
@ -841,6 +789,7 @@ typedef RelocatablePtr<jit::JitCode*> RelocatablePtrJitCode;
typedef RelocatablePtr<JSLinearString*> RelocatablePtrLinearString;
typedef RelocatablePtr<JSString*> RelocatablePtrString;
typedef RelocatablePtr<JSAtom*> RelocatablePtrAtom;
typedef RelocatablePtr<ArrayBufferObjectMaybeShared*> RelocatablePtrArrayBufferObjectMaybeShared;
typedef HeapPtr<NativeObject*> HeapPtrNativeObject;
typedef HeapPtr<ArrayObject*> HeapPtrArrayObject;

View File

@ -172,6 +172,31 @@ class AutoMaybeStartBackgroundAllocation
}
};
// In debug builds, set/unset the GC sweeping flag for the current thread.
struct AutoSetThreadIsSweeping
{
#ifdef DEBUG
explicit AutoSetThreadIsSweeping(MOZ_GUARD_OBJECT_NOTIFIER_ONLY_PARAM)
: threadData_(js::TlsPerThreadData.get())
{
MOZ_ASSERT(!threadData_->gcSweeping);
threadData_->gcSweeping = true;
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
}
~AutoSetThreadIsSweeping() {
MOZ_ASSERT(threadData_->gcSweeping);
threadData_->gcSweeping = false;
}
private:
PerThreadData* threadData_;
MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
#else
AutoSetThreadIsSweeping() {}
#endif
};
} /* namespace gc */
} /* namespace js */

View File

@ -690,22 +690,6 @@ MarkInternal(JSTracer* trc, T** thingp)
namespace js {
namespace gc {
template <typename T>
void
MarkUnbarriered(JSTracer* trc, T** thingp, const char* name)
{
trc->setTracingName(name);
MarkInternal(trc, thingp);
}
template <typename T>
static void
Mark(JSTracer* trc, BarrieredBase<T*>* thing, const char* name)
{
trc->setTracingName(name);
MarkInternal(trc, thing->unsafeGet());
}
void
MarkPermanentAtom(JSTracer* trc, JSAtom* atom, const char* name)
{
@ -753,46 +737,6 @@ MarkWellKnownSymbol(JSTracer* trc, JS::Symbol* sym)
trc->clearTracingDetails();
}
} /* namespace gc */
} /* namespace js */
template <typename T>
static void
MarkRoot(JSTracer* trc, T** thingp, const char* name)
{
JS_ROOT_MARKING_ASSERT(trc);
trc->setTracingName(name);
MarkInternal(trc, thingp);
}
template <typename T>
static void
MarkRange(JSTracer* trc, size_t len, HeapPtr<T*>* vec, const char* name)
{
for (size_t i = 0; i < len; ++i) {
if (vec[i].get()) {
trc->setTracingIndex(name, i);
MarkInternal(trc, vec[i].unsafeGet());
}
}
}
template <typename T>
static void
MarkRootRange(JSTracer* trc, size_t len, T** vec, const char* name)
{
JS_ROOT_MARKING_ASSERT(trc);
for (size_t i = 0; i < len; ++i) {
if (vec[i]) {
trc->setTracingIndex(name, i);
MarkInternal(trc, &vec[i]);
}
}
}
namespace js {
namespace gc {
template <typename T>
static inline void
CheckIsMarkedThing(T* thingp)
@ -1016,78 +960,6 @@ UpdateIfRelocated(JSRuntime* rt, T** thingp)
return *thingp;
}
#define DeclMarkerImpl(base, type) \
void \
Mark##base(JSTracer* trc, BarrieredBase<type*>* thing, const char* name) \
{ \
Mark<type>(trc, thing, name); \
} \
\
void \
Mark##base##Root(JSTracer* trc, type** thingp, const char* name) \
{ \
MarkRoot<type>(trc, thingp, name); \
} \
\
void \
Mark##base##Unbarriered(JSTracer* trc, type** thingp, const char* name) \
{ \
MarkUnbarriered<type>(trc, thingp, name); \
} \
\
/* Explicitly instantiate MarkUnbarriered<type*>. It is referenced from */ \
/* other translation units and the instantiation might otherwise get */ \
/* inlined away. */ \
template void MarkUnbarriered<type>(JSTracer*, type**, const char*); \
\
void \
Mark##base##Range(JSTracer* trc, size_t len, HeapPtr<type*>* vec, const char* name) \
{ \
MarkRange<type>(trc, len, vec, name); \
} \
\
void \
Mark##base##RootRange(JSTracer* trc, size_t len, type** vec, const char* name) \
{ \
MarkRootRange<type>(trc, len, vec, name); \
} \
\
bool \
Is##base##Marked(type** thingp) \
{ \
return IsMarkedUnbarriered<type*>(thingp); \
} \
\
bool \
Is##base##Marked(BarrieredBase<type*>* thingp) \
{ \
return IsMarked<type*>(thingp); \
} \
\
bool \
Is##base##AboutToBeFinalized(type** thingp) \
{ \
return IsAboutToBeFinalizedUnbarriered<type*>(thingp); \
} \
\
bool \
Is##base##AboutToBeFinalized(BarrieredBase<type*>* thingp) \
{ \
return IsAboutToBeFinalized<type*>(thingp); \
} \
\
type * \
Update##base##IfRelocated(JSRuntime* rt, BarrieredBase<type*>* thingp) \
{ \
return UpdateIfRelocated<type>(rt, thingp->unsafeGet()); \
} \
\
type * \
Update##base##IfRelocated(JSRuntime* rt, type** thingp) \
{ \
return UpdateIfRelocated<type>(rt, thingp); \
}
} /* namespace gc */
} /* namespace js */
@ -1280,7 +1152,7 @@ ShouldMarkCrossCompartment(JSTracer* trc, JSObject* src, Value val)
void
gc::MarkValueForBarrier(JSTracer* trc, Value* valuep, const char* name)
{
MOZ_ASSERT(!trc->runtime()->isHeapBusy());
MOZ_ASSERT(!trc->runtime()->isHeapCollecting());
TraceManuallyBarrieredEdge(trc, valuep, name);
}

View File

@ -86,64 +86,6 @@ namespace gc {
/*** Object Marking ***/
/*
* These functions expose marking functionality for all of the different GC
* thing kinds. For each GC thing, there are several variants. As an example,
* these are the variants generated for JSObject. They are listed from most to
* least desirable for use:
*
* MarkObject(JSTracer* trc, const HeapPtrObject& thing, const char* name);
* This function should be used for marking JSObjects, in preference to all
* others below. Use it when you have HeapPtrObject, which automatically
* implements write barriers.
*
* MarkObjectRoot(JSTracer* trc, JSObject* thing, const char* name);
* This function is only valid during the root marking phase of GC (i.e.,
* when MarkRuntime is on the stack).
*
* MarkObjectUnbarriered(JSTracer* trc, JSObject* thing, const char* name);
* Like MarkObject, this function can be called at any time. It is more
* forgiving, since it doesn't demand a HeapPtr as an argument. Its use
* should always be accompanied by a comment explaining how write barriers
* are implemented for the given field.
*
* Additionally, the functions MarkObjectRange and MarkObjectRootRange are
* defined for marking arrays of object pointers.
*
* The following functions are provided to test whether a GC thing is marked
* under different circumstances:
*
* IsObjectAboutToBeFinalized(JSObject** thing);
* This function is indended to be used in code used to sweep GC things. It
* indicates whether the object will will be finialized in the current group
* of compartments being swept. Note that this will return false for any
* object not in the group of compartments currently being swept, as even if
* it is unmarked it may still become marked before it is swept.
*
* IsObjectMarked(JSObject** thing);
* This function is indended to be used in rare cases in code used to mark
* GC things. It indicates whether the object is currently marked.
*
* UpdateObjectIfRelocated(JSObject** thingp);
* In some circumstances -- e.g. optional weak marking -- it is necessary
* to look at the pointer before marking it strongly or weakly. In these
* cases, the following must be called to update the pointer before use.
*/
#define DeclMarker(base, type) \
void Mark##base(JSTracer* trc, BarrieredBase<type*>* thing, const char* name); \
void Mark##base##Root(JSTracer* trc, type** thingp, const char* name); \
void Mark##base##Unbarriered(JSTracer* trc, type** thingp, const char* name); \
void Mark##base##Range(JSTracer* trc, size_t len, HeapPtr<type*>* thing, const char* name); \
void Mark##base##RootRange(JSTracer* trc, size_t len, type** thing, const char* name); \
bool Is##base##Marked(type** thingp); \
bool Is##base##Marked(BarrieredBase<type*>* thingp); \
bool Is##base##AboutToBeFinalized(type** thingp); \
bool Is##base##AboutToBeFinalized(BarrieredBase<type*>* thingp); \
type* Update##base##IfRelocated(JSRuntime* rt, BarrieredBase<type*>* thingp); \
type* Update##base##IfRelocated(JSRuntime* rt, type** thingp);
#undef DeclMarker
void
MarkPermanentAtom(JSTracer* trc, JSAtom* atom, const char* name);
@ -219,16 +161,6 @@ template <typename T>
bool
IsAboutToBeFinalized(ReadBarriered<T>* thingp);
inline bool
IsAboutToBeFinalized(const js::jit::VMFunction** vmfunc)
{
/*
* Preserves entries in the WeakCache<VMFunction, JitCode>
* iff the JitCode has been marked.
*/
return false;
}
inline Cell*
ToMarkable(const Value& v)
{

View File

@ -700,8 +700,10 @@ js::Nursery::moveObjectToTenured(MinorCollectionTracer* trc,
// The shape's list head may point into the old object. This can only
// happen for dictionaries, which are native objects.
if (&nsrc->shape_ == ndst->shape_->listp)
if (&nsrc->shape_ == ndst->shape_->listp) {
MOZ_ASSERT(nsrc->shape_->inDictionary());
ndst->shape_->listp = &ndst->shape_;
}
}
if (src->is<InlineTypedObject>())

View File

@ -39,9 +39,6 @@ JS::Zone::Zone(JSRuntime* rt)
gcState_(NoGC),
gcScheduled_(false),
gcPreserveCode_(false),
#ifdef DEBUG
gcBackgroundSweeping_(false),
#endif
jitUsingBarriers_(false),
listNext_(NotOnList)
{
@ -273,15 +270,6 @@ Zone::notifyObservingDebuggers()
}
}
#ifdef DEBUG
void
Zone::setGCBackgroundSweeping(bool newState)
{
MOZ_ASSERT(gcBackgroundSweeping_ != newState);
gcBackgroundSweeping_ = newState;
}
#endif
JS::Zone*
js::ZoneOfValue(const JS::Value& value)
{

View File

@ -226,9 +226,6 @@ struct Zone : public JS::shadow::Zone,
// For testing purposes, return the index of the zone group which this zone
// was swept in in the last GC.
unsigned lastZoneGroupIndex() { return gcLastZoneGroupIndex; }
void setGCBackgroundSweeping(bool newState);
bool isGCBackgroundSweeping() { return gcBackgroundSweeping_; }
#endif
private:
@ -303,9 +300,6 @@ struct Zone : public JS::shadow::Zone,
GCState gcState_;
bool gcScheduled_;
bool gcPreserveCode_;
#ifdef DEBUG
bool gcBackgroundSweeping_;
#endif
bool jitUsingBarriers_;
// Allow zones to be linked into a list

View File

@ -0,0 +1,15 @@
load(libdir + 'simd.js');
setJitCompilerOption("ion.warmup.trigger", 50);
const T = -1, F = 0;
function f() {
for (var i = 0; i < 150; i++) {
assertEqX4(SIMD.int32x4.bool(i + 1, true, 'hey', null), [T, T, T, F]);
assertEqX4(SIMD.int32x4.bool(undefined, '', {}, objectEmulatingUndefined()), [F, F, T, F]);
assertEqX4(SIMD.int32x4.bool(null, NaN, false, Infinity), [F, F, F, T]);
}
}
f();

View File

@ -0,0 +1,8 @@
function map_test(cases) {
for (var i = 0; i < cases.length; i++) {
var expected = cases[i].expected;
}
}
map_test([{ input: 8, expected: 1114369}, { input: -1, expected: 0}]);
map_test([{ expected: 16777215}, { expected: 4294967241 }]);

View File

@ -9461,7 +9461,8 @@ GetTemplateObjectForNative(JSContext* cx, HandleScript script, jsbytecode* pc,
ION_COMMONX4_SIMD_OP(ADD_INT32X4_SIMD_OP_NAME_)
COMP_COMMONX4_TO_INT32X4_SIMD_OP(ADD_INT32X4_SIMD_OP_NAME_)
COMP_COMMONX4_TO_INT32X4_SIMD_OP(ADD_FLOAT32X4_SIMD_OP_NAME_)
CONVERSION_INT32X4_SIMD_OP(ADD_INT32X4_SIMD_OP_NAME_))
CONVERSION_INT32X4_SIMD_OP(ADD_INT32X4_SIMD_OP_NAME_)
ION_ONLY_INT32X4_SIMD_OP(ADD_INT32X4_SIMD_OP_NAME_))
{
Rooted<SimdTypeDescr*> descr(cx, &cx->global()->int32x4TypeDescr().as<SimdTypeDescr>());
res.set(cx->compartment()->jitCompartment()->getSimdTemplateObjectFor(cx, descr));

View File

@ -3535,6 +3535,18 @@ CodeGenerator::generateArgumentsChecks(bool bailout)
Label success;
masm.jump(&success);
masm.bind(&miss);
// Check for cases where the type set guard might have missed due to
// changing object groups.
for (uint32_t i = info.startArgSlot(); i < info.endArgSlot(); i++) {
Label skip;
Address addr(StackPointer, ArgToStackOffset((i - info.startArgSlot()) * sizeof(Value)));
masm.branchTestObject(Assembler::NotEqual, addr, &skip);
Register obj = masm.extractObject(addr, temp);
masm.guardTypeSetMightBeIncomplete(obj, temp, &success);
masm.bind(&skip);
}
masm.assumeUnreachable("Argument check fail.");
masm.bind(&success);
}

View File

@ -2561,7 +2561,8 @@ TryOptimizeLoadObjectOrNull(MDefinition* def, MDefinitionVector* peliminateList)
return false;
break;
case MDefinition::Op_Unbox:
MOZ_ASSERT(ndef->type() == MIRType_Object);
if (ndef->type() != MIRType_Object)
return true;
break;
case MDefinition::Op_TypeBarrier:
// For now, only handle type barriers which are not consumed

View File

@ -9608,10 +9608,9 @@ IonBuilder::jsop_not()
{
MDefinition* value = current->pop();
MNot* ins = MNot::New(alloc(), value);
MNot* ins = MNot::New(alloc(), value, constraints());
current->add(ins);
current->push(ins);
ins->cacheOperandMightEmulateUndefined(constraints());
return true;
}

View File

@ -848,6 +848,8 @@ class IonBuilder
InliningStatus inlineSimdStore(CallInfo& callInfo, JSNative native, SimdTypeDescr::Type type,
unsigned numElems);
InliningStatus inlineSimdBool(CallInfo& callInfo, JSNative native, SimdTypeDescr::Type type);
// Utility intrinsics.
InliningStatus inlineIsCallable(CallInfo& callInfo);
InliningStatus inlineIsObject(CallInfo& callInfo);

View File

@ -3076,11 +3076,10 @@ GenerateSetUnboxed(JSContext* cx, MacroAssembler& masm, IonCache::StubAttacher&
MOZ_ASSERT(!UnboxedTypeNeedsPreBarrier(unboxedType));
}
// If the unboxed object's type has known properties, then instances have
// never been converted to native objects and the type set check performed
// above ensures the value being written can be stored in the unboxed
// object.
Label* storeFailure = obj->group()->unknownProperties() ? &failure : nullptr;
// If unboxed objects in this group have have never been converted to
// native objects then the type set check performed above ensures the value
// being written can be stored in the unboxed object.
Label* storeFailure = obj->group()->unboxedLayout().nativeGroup() ? &failure : nullptr;
masm.storeUnboxedProperty(address, unboxedType, value, storeFailure);

View File

@ -398,6 +398,9 @@ IonBuilder::inlineNativeCall(CallInfo& callInfo, JSFunction* target)
if (native == js::simd_float32x4_storeXYZ)
return inlineSimdStore(callInfo, native, SimdTypeDescr::Float32x4, 3);
if (native == js::simd_int32x4_bool)
return inlineSimdBool(callInfo, native, SimdTypeDescr::Int32x4);
// Reaching here means we tried to inline a native for which there is no
// Ion specialization.
trackOptimizationOutcome(TrackedOutcome::CantInlineNativeNoSpecialization);
@ -2203,11 +2206,9 @@ IonBuilder::inlineHasClass(CallInfo& callInfo,
}
// Convert to bool with the '!!' idiom
MNot* resultInverted = MNot::New(alloc(), last);
resultInverted->cacheOperandMightEmulateUndefined(constraints());
MNot* resultInverted = MNot::New(alloc(), last, constraints());
current->add(resultInverted);
MNot* result = MNot::New(alloc(), resultInverted);
result->cacheOperandMightEmulateUndefined(constraints());
MNot* result = MNot::New(alloc(), resultInverted, constraints());
current->add(result);
current->push(result);
}
@ -3368,5 +3369,33 @@ IonBuilder::inlineSimdStore(CallInfo& callInfo, JSNative native, SimdTypeDescr::
return InliningStatus_Inlined;
}
IonBuilder::InliningStatus
IonBuilder::inlineSimdBool(CallInfo& callInfo, JSNative native, SimdTypeDescr::Type type)
{
InlineTypedObject* templateObj = nullptr;
if (!checkInlineSimd(callInfo, native, type, 4, &templateObj))
return InliningStatus_NotInlined;
MOZ_ASSERT(type == SimdTypeDescr::Int32x4, "at the moment, only int32x4.bool is inlined");
MInstruction* operands[4];
for (unsigned i = 0; i < 4; i++) {
operands[i] = MNot::New(alloc(), callInfo.getArg(i), constraints());
current->add(operands[i]);
}
// Inline int32x4.bool(x, y, z, w) as int32x4(!x - 1, !y - 1, !z - 1, !w - 1);
MSimdValueX4* vector = MSimdValueX4::New(alloc(), MIRType_Int32x4, operands[0], operands[1],
operands[2], operands[3]);
current->add(vector);
MSimdConstant* one = MSimdConstant::New(alloc(), SimdConstant::SplatX4(1), MIRType_Int32x4);
current->add(one);
MSimdBinaryArith* result = MSimdBinaryArith::New(alloc(), vector, one, MSimdBinaryArith::Op_sub,
MIRType_Int32x4);
return boxSimd(callInfo, result, templateObj);
}
} // namespace jit
} // namespace js

View File

@ -8035,18 +8035,24 @@ class MNot
bool operandMightEmulateUndefined_;
bool operandIsNeverNaN_;
explicit MNot(MDefinition* input)
explicit MNot(MDefinition* input, CompilerConstraintList* constraints = nullptr)
: MUnaryInstruction(input),
operandMightEmulateUndefined_(true),
operandIsNeverNaN_(false)
{
setResultType(MIRType_Boolean);
setMovable();
if (constraints)
cacheOperandMightEmulateUndefined(constraints);
}
void cacheOperandMightEmulateUndefined(CompilerConstraintList *constraints);
public:
static MNot* New(TempAllocator& alloc, MDefinition* elements) {
return new(alloc) MNot(elements);
static MNot* New(TempAllocator& alloc, MDefinition* elements,
CompilerConstraintList* constraints = nullptr)
{
return new(alloc) MNot(elements, constraints);
}
static MNot* NewAsmJS(TempAllocator& alloc, MDefinition* elements) {
MNot* ins = new(alloc) MNot(elements);
@ -8056,7 +8062,6 @@ class MNot
INSTRUCTION_HEADER(Not)
void cacheOperandMightEmulateUndefined(CompilerConstraintList* constraints);
MDefinition* foldsTo(TempAllocator& alloc) override;
void markOperandCantEmulateUndefined() {

View File

@ -798,8 +798,16 @@ void
MacroAssembler::loadUnboxedProperty(T address, JSValueType type, TypedOrValueRegister output)
{
switch (type) {
case JSVAL_TYPE_INT32: {
// Handle loading an int32 into a double reg.
if (output.type() == MIRType_Double) {
convertInt32ToDouble(address, output.typedReg().fpu());
break;
}
// Fallthrough.
}
case JSVAL_TYPE_BOOLEAN:
case JSVAL_TYPE_INT32:
case JSVAL_TYPE_STRING: {
Register outReg;
if (output.hasValue()) {

View File

@ -61,6 +61,21 @@ MacroAssemblerARM::convertInt32ToDouble(const Address& src, FloatRegister dest)
as_vcvt(dest, VFPRegister(ScratchDoubleReg).sintOverlay());
}
void
MacroAssemblerARM::convertInt32ToDouble(const BaseIndex& src, FloatRegister dest)
{
Register base = src.base;
uint32_t scale = Imm32::ShiftOf(src.scale).value;
if (src.offset != 0) {
ma_mov(base, ScratchRegister);
base = ScratchRegister;
ma_add(Imm32(src.offset), base);
}
ma_ldr(DTRAddr(base, DtrRegImmShift(src.index, LSL, scale)), ScratchRegister);
convertInt32ToDouble(ScratchRegister, dest);
}
void
MacroAssemblerARM::convertUInt32ToDouble(Register src, FloatRegister dest_)
{

View File

@ -68,6 +68,7 @@ class MacroAssemblerARM : public Assembler
void convertBoolToInt32(Register source, Register dest);
void convertInt32ToDouble(Register src, FloatRegister dest);
void convertInt32ToDouble(const Address& src, FloatRegister dest);
void convertInt32ToDouble(const BaseIndex& src, FloatRegister dest);
void convertUInt32ToFloat32(Register src, FloatRegister dest);
void convertUInt32ToDouble(Register src, FloatRegister dest);
void convertDoubleToFloat32(FloatRegister src, FloatRegister dest,

View File

@ -683,6 +683,9 @@ class MacroAssemblerX86Shared : public Assembler
void convertInt32ToDouble(const Address& src, FloatRegister dest) {
convertInt32ToDouble(Operand(src), dest);
}
void convertInt32ToDouble(const BaseIndex& src, FloatRegister dest) {
convertInt32ToDouble(Operand(src), dest);
}
void convertInt32ToDouble(const Operand& src, FloatRegister dest) {
// Clear the output register first to break dependencies; see above;
zeroDouble(dest);

View File

@ -3208,27 +3208,6 @@ GCRuntime::expireChunksAndArenas(bool shouldShrink, AutoLockGC& lock)
decommitArenas(lock);
}
// In debug builds, set/unset the background sweeping flag on the zone.
struct AutoSetZoneBackgroundSweeping
{
#ifdef DEBUG
explicit AutoSetZoneBackgroundSweeping(Zone* zone)
: zone_(zone)
{
zone_->setGCBackgroundSweeping(true);
}
~AutoSetZoneBackgroundSweeping() {
zone_->setGCBackgroundSweeping(false);
}
private:
Zone* zone_;
#else
AutoSetZoneBackgroundSweeping(Zone* zone) {}
#endif
};
void
GCRuntime::sweepBackgroundThings(ZoneList& zones, LifoAlloc& freeBlocks, ThreadType threadType)
{
@ -3242,7 +3221,6 @@ GCRuntime::sweepBackgroundThings(ZoneList& zones, LifoAlloc& freeBlocks, ThreadT
FreeOp fop(rt, threadType);
for (unsigned phase = 0 ; phase < ArrayLength(BackgroundFinalizePhases) ; ++phase) {
for (Zone* zone = zones.front(); zone; zone = zone->nextZone()) {
AutoSetZoneBackgroundSweeping zbs(zone);
for (unsigned index = 0 ; index < BackgroundFinalizePhases[phase].length ; ++index) {
AllocKind kind = BackgroundFinalizePhases[phase].kinds[index];
ArenaHeader* arenas = zone->arenas.arenaListsToSweep[kind];
@ -3482,6 +3460,8 @@ GCHelperState::doSweep(AutoLockGC& lock)
do {
while (!rt->gc.backgroundSweepZones.isEmpty()) {
AutoSetThreadIsSweeping threadIsSweeping;
ZoneList zones;
zones.transferFrom(rt->gc.backgroundSweepZones);
LifoAlloc freeLifoAlloc(JSRuntime::TEMP_LIFO_ALLOC_PRIMARY_CHUNK_SIZE);
@ -4720,21 +4700,33 @@ GCRuntime::endMarkingZoneGroup()
marker.setMarkColorBlack();
}
#define MAKE_GC_PARALLEL_TASK(name) \
class name : public GCParallelTask {\
JSRuntime* runtime;\
virtual void run() override;\
public:\
explicit name (JSRuntime* rt) : runtime(rt) {}\
class GCSweepTask : public GCParallelTask
{
virtual void runFromHelperThread() override {
AutoSetThreadIsSweeping threadIsSweeping;
GCParallelTask::runFromHelperThread();
}
MAKE_GC_PARALLEL_TASK(SweepAtomsTask);
MAKE_GC_PARALLEL_TASK(SweepInnerViewsTask);
MAKE_GC_PARALLEL_TASK(SweepCCWrappersTask);
MAKE_GC_PARALLEL_TASK(SweepBaseShapesTask);
MAKE_GC_PARALLEL_TASK(SweepInitialShapesTask);
MAKE_GC_PARALLEL_TASK(SweepObjectGroupsTask);
MAKE_GC_PARALLEL_TASK(SweepRegExpsTask);
MAKE_GC_PARALLEL_TASK(SweepMiscTask);
protected:
JSRuntime* runtime;
public:
explicit GCSweepTask(JSRuntime* rt) : runtime(rt) {}
};
#define MAKE_GC_SWEEP_TASK(name) \
class name : public GCSweepTask { \
virtual void run() override; \
public: \
explicit name (JSRuntime* rt) : GCSweepTask(rt) {} \
}
MAKE_GC_SWEEP_TASK(SweepAtomsTask);
MAKE_GC_SWEEP_TASK(SweepInnerViewsTask);
MAKE_GC_SWEEP_TASK(SweepCCWrappersTask);
MAKE_GC_SWEEP_TASK(SweepBaseShapesTask);
MAKE_GC_SWEEP_TASK(SweepInitialShapesTask);
MAKE_GC_SWEEP_TASK(SweepObjectGroupsTask);
MAKE_GC_SWEEP_TASK(SweepRegExpsTask);
MAKE_GC_SWEEP_TASK(SweepMiscTask);
#undef MAKE_GC_SWEEP_TASK
/* virtual */ void
SweepAtomsTask::run()
@ -5028,6 +5020,8 @@ GCRuntime::beginSweepPhase(bool destroyingRuntime)
MOZ_ASSERT(!abortSweepAfterCurrentGroup);
AutoSetThreadIsSweeping threadIsSweeping;
releaseHeldRelocatedArenas();
computeNonIncrementalMarkingForValidation();
@ -5130,6 +5124,8 @@ SweepArenaList(ArenaHeader** arenasToSweep, SliceBudget& sliceBudget, Args... ar
GCRuntime::IncrementalProgress
GCRuntime::sweepPhase(SliceBudget& sliceBudget)
{
AutoSetThreadIsSweeping threadIsSweeping;
gcstats::AutoPhase ap(stats, gcstats::PHASE_SWEEP);
FreeOp fop(rt);
@ -5235,6 +5231,8 @@ GCRuntime::sweepPhase(SliceBudget& sliceBudget)
void
GCRuntime::endSweepPhase(bool destroyingRuntime)
{
AutoSetThreadIsSweeping threadIsSweeping;
gcstats::AutoPhase ap(stats, gcstats::PHASE_SWEEP);
FreeOp fop(rt);

View File

@ -1026,7 +1026,7 @@ class GCParallelTask
// This should be friended to HelperThread, but cannot be because it
// would introduce several circular dependencies.
public:
void runFromHelperThread();
virtual void runFromHelperThread();
};
struct GCChunkHasher {

View File

@ -310,32 +310,26 @@ Shape::fixupAfterMovingGC()
}
void
ShapeGetterSetterRef::mark(JSTracer* trc)
Shape::fixupGetterSetterForBarrier(JSTracer *trc)
{
// Update the current shape's entry in the parent KidsHash table if needed.
// This is necessary as the computed hash includes the getter/setter
// pointers.
JSObject* obj = *objp;
JSObject* prior = obj;
if (!prior)
return;
trc->setTracingLocation(&*prior);
TraceManuallyBarrieredEdge(trc, &obj, "AccessorShape getter or setter");
if (obj == *objp)
return;
Shape* parent = shape->parent;
if (shape->inDictionary() || !parent->kids.isHash()) {
*objp = obj;
return;
// Relocating the getterObj or setterObj will change our location in our
// parent's KidsHash, so remove ourself first if we're going to get moved.
if (parent && !parent->inDictionary() && parent->kids.isHash()) {
KidsHash* kh = parent->kids.toHash();
MOZ_ASSERT(kh->lookup(StackShape(this)));
kh->remove(StackShape(this));
}
KidsHash* kh = parent->kids.toHash();
kh->remove(StackShape(shape));
*objp = obj;
MOZ_ALWAYS_TRUE(kh->putNew(StackShape(shape), shape));
if (hasGetterObject())
TraceManuallyBarrieredEdge(trc, &asAccessorShape().getterObj, "getterObj");
if (hasSetterObject())
TraceManuallyBarrieredEdge(trc, &asAccessorShape().setterObj, "setterObj");
if (parent && !parent->inDictionary() && parent->kids.isHash()) {
KidsHash* kh = parent->kids.toHash();
MOZ_ASSERT(!kh->lookup(StackShape(this)));
MOZ_ALWAYS_TRUE(kh->putNew(StackShape(this), this));
}
}
#ifdef DEBUG

View File

@ -92,7 +92,7 @@ class WeakMapBase {
virtual void finish() = 0;
// Object that this weak map is part of, if any.
HeapPtrObject memberOf;
RelocatablePtrObject memberOf;
// Compartment that this weak map is part of.
JSCompartment* compartment;

View File

@ -53,12 +53,14 @@
#include "vm/ScopeObject-inl.h"
#include "vm/Stack-inl.h"
#if defined(XP_UNIX)
#if defined(XP_MACOSX)
#include <mach/mach.h>
#elif defined(XP_UNIX)
#include <sys/resource.h>
#elif defined(XP_WIN)
#include <processthreadsapi.h>
#include <windows.h>
#endif // defined(XP_UNIX) || defined(XP_WIN)
#endif // defined(XP_MACOSX) || defined(XP_UNIX) || defined(XP_WIN)
using namespace js;
using namespace js::gc;
@ -522,31 +524,52 @@ struct AutoStopwatch final
}
}
// Get the OS-reported time spent in userland/systemland,
// in microseconds.
bool getTimes(uint64_t *userTime, uint64_t *systemTime) const {
// Get the OS-reported time spent in userland/systemland, in
// microseconds. On most platforms, this data is per-thread,
// but on some platforms we need to fall back to per-process.
bool getTimes(uint64_t* userTime, uint64_t* systemTime) const {
MOZ_ASSERT(userTime);
MOZ_ASSERT(systemTime);
#if defined(XP_UNIX)
#if defined(XP_MACOSX)
// On MacOS X, to get we per-thread data, we need to
// reach into the kernel.
mach_msg_type_number_t count = THREAD_BASIC_INFO_COUNT;
thread_basic_info_data_t info;
mach_port_t port = mach_thread_self();
kern_return_t err =
thread_info(/* [in] targeted thread*/ port,
/* [in] nature of information*/ THREAD_BASIC_INFO,
/* [out] thread information */ (thread_info_t)&info,
/* [inout] number of items */ &count);
// We do not need ability to communicate with the thread, so
// let's release the port.
mach_port_deallocate(mach_task_self(), port);
if (err != KERN_SUCCESS)
return false;
*userTime = info.user_time.microseconds + info.user_time.seconds * 1000000;
*systemTime = info.system_time.microseconds + info.system_time.seconds * 1000000;
#elif defined(XP_UNIX)
struct rusage rusage;
#if defined(RUSAGE_THREAD)
// Under Linux, we can obtain per-thread statistics
int err = getrusage(RUSAGE_THREAD, &rusage);
#else
// Under other Unices, including MacOS X, we need to
// do with more noisy per-process statistics.
// Under other Unices, we need to do with more noisy
// per-process statistics.
int err = getrusage(RUSAGE_SELF, &rusage);
#endif // defined(RUSAGE_THREAD)
MOZ_ASSERT(!err);
if (err)
return false;
*userTime = rusage.ru_utime.tv_usec
+ rusage.ru_utime.tv_sec * 1000000;
*systemTime = rusage.ru_stime.tv_usec
+ rusage.ru_stime.tv_sec * 1000000;
*userTime = rusage.ru_utime.tv_usec + rusage.ru_utime.tv_sec * 1000000;
*systemTime = rusage.ru_stime.tv_usec + rusage.ru_stime.tv_sec * 1000000;
#elif defined(XP_WIN)
// Under Windows, we can obtain per-thread statistics,
@ -559,7 +582,7 @@ struct AutoStopwatch final
BOOL success = GetThreadTimes(GetCurrentThread(),
&creationFileTime, &exitFileTime,
&kernelFileTime, &userFileTime);
MOZ_ASSERT(success);
if (!success)
return false;
@ -575,7 +598,7 @@ struct AutoStopwatch final
// Convert 100 ns to 1 us, make sure that the result is monotonic
*userTime = runtime_-> stopwatch.userTimeFix.monotonize(userTimeInt.QuadPart / 10);
#endif // defined(XP_UNIX) || defined(XP_WIN)
#endif // defined(XP_MACOSX) || defined(XP_UNIX) || defined(XP_WIN)
return true;
}

View File

@ -81,6 +81,7 @@ PerThreadData::PerThreadData(JSRuntime* runtime)
suppressGC(0),
#ifdef DEBUG
ionCompiling(false),
gcSweeping(false),
#endif
activeCompilations(0)
{}

View File

@ -520,6 +520,9 @@ class PerThreadData : public PerThreadDataFriendFields
#ifdef DEBUG
// Whether this thread is actively Ion compiling.
bool ionCompiling;
// Whether this thread is currently sweeping GC things.
bool gcSweeping;
#endif
// Number of active bytecode compilation on this thread.

View File

@ -812,11 +812,8 @@ NativeObject::putProperty(ExclusiveContext* cx, HandleNativeObject obj, HandleId
if (shape->isAccessorShape()) {
AccessorShape& accShape = shape->asAccessorShape();
accShape.rawGetter = getter;
if (accShape.hasGetterObject())
GetterSetterWriteBarrierPost(&accShape, &accShape.getterObj);
accShape.rawSetter = setter;
if (accShape.hasSetterObject())
GetterSetterWriteBarrierPost(&accShape, &accShape.setterObj);
GetterSetterWriteBarrierPost(&accShape);
} else {
MOZ_ASSERT(!getter);
MOZ_ASSERT(!setter);

View File

@ -319,39 +319,6 @@ class Shape;
class UnownedBaseShape;
struct StackBaseShape;
// This class is used to add a post barrier on the AccessorShape's getter/setter
// objects. It updates the shape's entry in the parent's KidsHash table.
class ShapeGetterSetterRef : public gc::BufferableRef
{
AccessorShape* shape;
JSObject** objp;
public:
ShapeGetterSetterRef(AccessorShape* shape, JSObject** objp)
: shape(shape), objp(objp)
{}
void mark(JSTracer* trc);
};
static inline void
GetterSetterWriteBarrierPost(AccessorShape* shape, JSObject** objp)
{
MOZ_ASSERT(shape);
MOZ_ASSERT(objp);
MOZ_ASSERT(*objp);
gc::Cell** cellp = reinterpret_cast<gc::Cell**>(objp);
if (gc::StoreBuffer* sb = (*cellp)->storeBuffer())
sb->putGeneric(ShapeGetterSetterRef(shape, objp));
}
static inline void
GetterSetterWriteBarrierPostRemove(JSRuntime* rt, JSObject** objp)
{
JS::shadow::Runtime* shadowRuntime = JS::shadow::Runtime::asShadowRuntime(rt);
shadowRuntime->gcStoreBufferPtr()->removeRelocatableCellFromAnyThread(reinterpret_cast<gc::Cell**>(objp));
}
class BaseShape : public gc::TenuredCell
{
public:
@ -600,7 +567,6 @@ class Shape : public gc::TenuredCell
friend class NativeObject;
friend class PropertyTree;
friend class StaticBlockObject;
friend class ShapeGetterSetterRef;
friend struct StackShape;
friend struct StackBaseShape;
@ -1005,6 +971,7 @@ class Shape : public gc::TenuredCell
inline Shape* searchLinear(jsid id);
void fixupAfterMovingGC();
void fixupGetterSetterForBarrier(JSTracer *trc);
/* For JIT usage */
static inline size_t offsetOfBase() { return offsetof(Shape, base_); }
@ -1026,7 +993,6 @@ class Shape : public gc::TenuredCell
class AccessorShape : public Shape
{
friend class Shape;
friend class ShapeGetterSetterRef;
friend class NativeObject;
union {
@ -1270,6 +1236,38 @@ Shape::Shape(const StackShape& other, uint32_t nfixed)
kids.setNull();
}
// This class is used to add a post barrier on the AccessorShape's getter/setter
// objects. It updates the pointers and the shape's entry in the parent's
// KidsHash table.
class ShapeGetterSetterRef : public gc::BufferableRef
{
AccessorShape* shape_;
public:
explicit ShapeGetterSetterRef(AccessorShape* shape) : shape_(shape) {}
void mark(JSTracer* trc) { shape_->fixupGetterSetterForBarrier(trc); }
};
static inline void
GetterSetterWriteBarrierPost(AccessorShape* shape)
{
MOZ_ASSERT(shape);
if (shape->hasGetterObject()) {
gc::StoreBuffer *sb = reinterpret_cast<gc::Cell*>(shape->getterObject())->storeBuffer();
if (sb) {
sb->putGeneric(ShapeGetterSetterRef(shape));
return;
}
}
if (shape->hasSetterObject()) {
gc::StoreBuffer *sb = reinterpret_cast<gc::Cell*>(shape->setterObject())->storeBuffer();
if (sb) {
sb->putGeneric(ShapeGetterSetterRef(shape));
return;
}
}
}
inline
AccessorShape::AccessorShape(const StackShape& other, uint32_t nfixed)
: Shape(other, nfixed),
@ -1277,11 +1275,7 @@ AccessorShape::AccessorShape(const StackShape& other, uint32_t nfixed)
rawSetter(other.rawSetter)
{
MOZ_ASSERT(getAllocKind() == gc::AllocKind::ACCESSOR_SHAPE);
if ((attrs & JSPROP_GETTER) && rawGetter)
GetterSetterWriteBarrierPost(this, &this->getterObj);
if ((attrs & JSPROP_SETTER) && rawSetter)
GetterSetterWriteBarrierPost(this, &this->setterObj);
GetterSetterWriteBarrierPost(this);
}
inline

View File

@ -753,7 +753,7 @@ nsXPConnect::EvalInSandboxObject(const nsAString& source, const char* filename,
filenameStr = NS_LITERAL_CSTRING("x-bogus://XPConnect/Sandbox");
}
return EvalInSandbox(cx, sandbox, source, filenameStr, 1,
JSVERSION_DEFAULT, rval);
JSVERSION_LATEST, rval);
}
/* nsIXPConnectJSObjectHolder getWrappedNativePrototype (in JSContextPtr aJSContext, in JSObjectPtr aScope, in nsIClassInfo aClassInfo); */

View File

@ -5086,7 +5086,8 @@ nsBlockFrame::AddFrames(nsFrameList& aFrameList, nsIFrame* aPrevSibling)
if (overflowLines) {
prevSibLine = overflowLines->mLines.end();
prevSiblingIndex = -1;
found = nsLineBox::RFindLineContaining(aPrevSibling, lineList->begin(),
found = nsLineBox::RFindLineContaining(aPrevSibling,
overflowLines->mLines.begin(),
prevSibLine,
overflowLines->mFrames.LastChild(),
&prevSiblingIndex);
@ -5097,7 +5098,7 @@ nsBlockFrame::AddFrames(nsFrameList& aFrameList, nsIFrame* aPrevSibling)
} else {
// Note: defensive code! RFindLineContaining must not return
// false in this case, so if it does...
NS_NOTREACHED("prev sibling not in line list");
MOZ_ASSERT_UNREACHABLE("prev sibling not in line list");
aPrevSibling = nullptr;
prevSibLine = lineList->end();
}

View File

@ -8857,22 +8857,6 @@ nsIFrame::GetPseudoElement(nsCSSPseudoElements::Type aType)
return nullptr;
}
nsIFrame::ContentOffsets::ContentOffsets()
{
}
nsIFrame::ContentOffsets::ContentOffsets(const ContentOffsets& rhs)
: content(rhs.content),
offset(rhs.offset),
secondaryOffset(rhs.secondaryOffset),
associate(rhs.associate)
{
}
nsIFrame::ContentOffsets::~ContentOffsets()
{
}
nsIFrame::CaretPosition::CaretPosition()
: mContentOffset(0)
{

View File

@ -1279,18 +1279,20 @@ public:
// Note that the primary offset can be after the secondary offset; for places
// that need the beginning and end of the object, the StartOffset and
// EndOffset helpers can be used.
struct MOZ_STACK_CLASS ContentOffsets {
ContentOffsets();
ContentOffsets(const ContentOffsets&);
~ContentOffsets();
nsCOMPtr<nsIContent> content;
struct MOZ_STACK_CLASS ContentOffsets
{
ContentOffsets() : offset(0)
, secondaryOffset(0)
, associate(mozilla::CARET_ASSOCIATE_BEFORE) {}
bool IsNull() { return !content; }
int32_t offset;
int32_t secondaryOffset;
// Helpers for places that need the ends of the offsets and expect them in
// numerical order, as opposed to wanting the primary and secondary offsets
int32_t StartOffset() { return std::min(offset, secondaryOffset); }
int32_t EndOffset() { return std::max(offset, secondaryOffset); }
nsCOMPtr<nsIContent> content;
int32_t offset;
int32_t secondaryOffset;
// This value indicates whether the associated content is before or after
// the offset; the most visible use is to allow the caret to know which line
// to display on.

View File

@ -25,7 +25,7 @@ EXPORTS.mtransport += [
'../transportlayerprsock.h',
]
include('../objs.mozbuild')
include('../common.build')
# These files cannot be built in unified mode because of the redefinition of
# getLogModule, UNIMPLEMENTED, nr_socket_long_term_violation_time,
@ -34,67 +34,7 @@ SOURCES += mtransport_cppsrcs
FAIL_ON_WARNINGS = True
LOCAL_INCLUDES += [
'/media/mtransport/',
'/media/mtransport/third_party/',
'/media/mtransport/third_party/nICEr/src/crypto',
'/media/mtransport/third_party/nICEr/src/ice',
'/media/mtransport/third_party/nICEr/src/net',
'/media/mtransport/third_party/nICEr/src/stun',
'/media/mtransport/third_party/nICEr/src/util',
'/media/mtransport/third_party/nrappkit/src/event',
'/media/mtransport/third_party/nrappkit/src/log',
'/media/mtransport/third_party/nrappkit/src/plugin',
'/media/mtransport/third_party/nrappkit/src/port/generic/include',
'/media/mtransport/third_party/nrappkit/src/registry',
'/media/mtransport/third_party/nrappkit/src/share',
'/media/mtransport/third_party/nrappkit/src/stats',
'/media/mtransport/third_party/nrappkit/src/util/libekr',
]
if CONFIG['OS_TARGET'] in ['Darwin', 'DragonFly', 'FreeBSD', 'NetBSD', 'OpenBSD']:
if CONFIG['OS_TARGET'] == 'Darwin':
DEFINES['DARWIN'] = True
else:
DEFINES['BSD'] = True
LOCAL_INCLUDES += [
'/media/mtransport/third_party/nrappkit/src/port/darwin/include',
]
elif CONFIG['OS_TARGET'] == 'Linux':
DEFINES['LINUX'] = True
DEFINES['USE_INTERFACE_PRIORITIZER'] = True
LOCAL_INCLUDES += [
'/media/mtransport/third_party/nrappkit/src/port/linux/include',
]
elif CONFIG['OS_TARGET'] == 'Android':
DEFINES['LINUX'] = True
DEFINES['ANDROID'] = True
LOCAL_INCLUDES += [
'/media/mtransport/third_party/nrappkit/src/port/android/include',
]
elif CONFIG['OS_TARGET'] == 'WINNT':
DEFINES['WIN'] = True
# for stun.h
DEFINES['WIN32'] = True
DEFINES['NOMINMAX'] = True
LOCAL_INCLUDES += [
'/media/mtransport/third_party/nrappkit/src/port/win32/include',
]
if CONFIG['GKMEDIAS_SHARED_LIBRARY']:
NO_VISIBILITY_FLAGS = True
FINAL_LIBRARY = 'xul'
if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gonk':
DEFINES['USE_INTERFACE_PRIORITIZER'] = True
for var in ('HAVE_STRDUP', 'NR_SOCKET_IS_VOID_PTR'):
DEFINES[var] = True
DEFINES['R_DEFINED_INT2'] = 'int16_t'
DEFINES['R_DEFINED_UINT2'] = 'uint16_t'
DEFINES['R_DEFINED_INT4'] = 'int32_t'
DEFINES['R_DEFINED_UINT4'] = 'uint32_t'
DEFINES['R_DEFINED_INT8'] = 'int64_t'
DEFINES['R_DEFINED_UINT8'] = 'uint64_t'

View File

@ -0,0 +1,95 @@
# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
# vim: set filetype=python:
# 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/.
mtransport_lcppsrcs = [
'dtlsidentity.cpp',
'nr_socket_prsock.cpp',
'nr_timer.cpp',
'nricectx.cpp',
'nricemediastream.cpp',
'nriceresolver.cpp',
'nriceresolverfake.cpp',
'nrinterfaceprioritizer.cpp',
'rlogringbuffer.cpp',
'simpletokenbucket.cpp',
'stun_udp_socket_filter.cpp',
'transportflow.cpp',
'transportlayer.cpp',
'transportlayerdtls.cpp',
'transportlayerice.cpp',
'transportlayerlog.cpp',
'transportlayerloopback.cpp',
'transportlayerprsock.cpp',
]
if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gonk':
mtransport_lcppsrcs += [
'gonk_addrs.cpp',
]
mtransport_cppsrcs = [
'%s/media/mtransport/%s' % (TOPSRCDIR, s) for s in sorted(mtransport_lcppsrcs)
]
LOCAL_INCLUDES += [
'/media/mtransport/',
'/media/mtransport/third_party/',
'/media/mtransport/third_party/nICEr/src/crypto',
'/media/mtransport/third_party/nICEr/src/ice',
'/media/mtransport/third_party/nICEr/src/net',
'/media/mtransport/third_party/nICEr/src/stun',
'/media/mtransport/third_party/nICEr/src/util',
'/media/mtransport/third_party/nrappkit/src/event',
'/media/mtransport/third_party/nrappkit/src/log',
'/media/mtransport/third_party/nrappkit/src/plugin',
'/media/mtransport/third_party/nrappkit/src/port/generic/include',
'/media/mtransport/third_party/nrappkit/src/registry',
'/media/mtransport/third_party/nrappkit/src/share',
'/media/mtransport/third_party/nrappkit/src/stats',
'/media/mtransport/third_party/nrappkit/src/util/libekr',
]
if CONFIG['OS_TARGET'] in ['Darwin', 'DragonFly', 'FreeBSD', 'NetBSD', 'OpenBSD']:
if CONFIG['OS_TARGET'] == 'Darwin':
DEFINES['DARWIN'] = True
else:
DEFINES['BSD'] = True
LOCAL_INCLUDES += [
'/media/mtransport/third_party/nrappkit/src/port/darwin/include',
]
elif CONFIG['OS_TARGET'] == 'Linux':
DEFINES['LINUX'] = True
DEFINES['USE_INTERFACE_PRIORITIZER'] = True
LOCAL_INCLUDES += [
'/media/mtransport/third_party/nrappkit/src/port/linux/include',
]
elif CONFIG['OS_TARGET'] == 'Android':
DEFINES['LINUX'] = True
DEFINES['ANDROID'] = True
LOCAL_INCLUDES += [
'/media/mtransport/third_party/nrappkit/src/port/android/include',
]
elif CONFIG['OS_TARGET'] == 'WINNT':
DEFINES['WIN'] = True
# for stun.h
DEFINES['WIN32'] = True
DEFINES['NOMINMAX'] = True
LOCAL_INCLUDES += [
'/media/mtransport/third_party/nrappkit/src/port/win32/include',
]
if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gonk':
DEFINES['USE_INTERFACE_PRIORITIZER'] = True
for var in ('HAVE_STRDUP', 'NR_SOCKET_IS_VOID_PTR'):
DEFINES[var] = True
DEFINES['R_DEFINED_INT2'] = 'int16_t'
DEFINES['R_DEFINED_UINT2'] = 'uint16_t'
DEFINES['R_DEFINED_INT4'] = 'int32_t'
DEFINES['R_DEFINED_UINT4'] = 'uint32_t'
DEFINES['R_DEFINED_INT8'] = 'int64_t'
DEFINES['R_DEFINED_UINT8'] = 'uint64_t'

View File

@ -0,0 +1,17 @@
# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
# vim: set filetype=python:
# 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/.
DIRS += [
'/media/mtransport/third_party',
'/media/mtransport/build',
'/media/mtransport/testlib',
]
if CONFIG['OS_TARGET'] != 'WINNT' and CONFIG['MOZ_WIDGET_TOOLKIT'] != 'gonk':
DIRS += [
'/media/mtransport/standalone',
]

View File

@ -1,35 +0,0 @@
# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
# vim: set filetype=python:
# 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/.
mtransport_lcppsrcs = [
'dtlsidentity.cpp',
'nr_socket_prsock.cpp',
'nr_timer.cpp',
'nricectx.cpp',
'nricemediastream.cpp',
'nriceresolver.cpp',
'nriceresolverfake.cpp',
'nrinterfaceprioritizer.cpp',
'rlogringbuffer.cpp',
'simpletokenbucket.cpp',
'stun_udp_socket_filter.cpp',
'transportflow.cpp',
'transportlayer.cpp',
'transportlayerdtls.cpp',
'transportlayerice.cpp',
'transportlayerlog.cpp',
'transportlayerloopback.cpp',
'transportlayerprsock.cpp',
]
if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gonk':
mtransport_lcppsrcs += [
'gonk_addrs.cpp',
]
mtransport_cppsrcs = [
'%s/media/mtransport/%s' % (TOPSRCDIR, s) for s in sorted(mtransport_lcppsrcs)
]

View File

@ -4,73 +4,17 @@
# 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/.
include('../objs.mozbuild')
Library('mtransport_standalone')
include('../common.build')
# These files cannot be built in unified mode because of the redefinition of
# getLogModule, UNIMPLEMENTED, nr_socket_long_term_violation_time,
# nr_socket_short_term_violation_time.
SOURCES += mtransport_cppsrcs
Library('mtransport_s')
LOCAL_INCLUDES += [
'/media/mtransport/',
'/media/mtransport/third_party/',
'/media/mtransport/third_party/nICEr/src/crypto',
'/media/mtransport/third_party/nICEr/src/ice',
'/media/mtransport/third_party/nICEr/src/net',
'/media/mtransport/third_party/nICEr/src/stun',
'/media/mtransport/third_party/nICEr/src/util',
'/media/mtransport/third_party/nrappkit/src/event',
'/media/mtransport/third_party/nrappkit/src/log',
'/media/mtransport/third_party/nrappkit/src/plugin',
'/media/mtransport/third_party/nrappkit/src/port/generic/include',
'/media/mtransport/third_party/nrappkit/src/registry',
'/media/mtransport/third_party/nrappkit/src/share',
'/media/mtransport/third_party/nrappkit/src/stats',
'/media/mtransport/third_party/nrappkit/src/util/libekr',
]
if CONFIG['OS_TARGET'] in ['Darwin', 'DragonFly', 'FreeBSD', 'NetBSD', 'OpenBSD']:
if CONFIG['OS_TARGET'] == 'Darwin':
DEFINES['DARWIN'] = True
else:
DEFINES['BSD'] = True
LOCAL_INCLUDES += [
'/media/mtransport/third_party/nrappkit/src/port/darwin/include',
]
elif CONFIG['OS_TARGET'] == 'Linux':
DEFINES['LINUX'] = True
DEFINES['USE_INTERFACE_PRIORITIZER'] = True
LOCAL_INCLUDES += [
'/media/mtransport/third_party/nrappkit/src/port/linux/include',
]
elif CONFIG['OS_TARGET'] == 'Android':
DEFINES['LINUX'] = True
DEFINES['ANDROID'] = True
LOCAL_INCLUDES += [
'/media/mtransport/third_party/nrappkit/src/port/android/include',
]
elif CONFIG['OS_TARGET'] == 'WINNT':
DEFINES['WIN'] = True
# for stun.h
DEFINES['WIN32'] = True
DEFINES['NOMINMAX'] = True
LOCAL_INCLUDES += [
'/media/mtransport/third_party/nrappkit/src/port/win32/include',
]
FORCE_STATIC_LIB = True
if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gonk':
DEFINES['USE_INTERFACE_PRIORITIZER'] = True
for var in ('HAVE_STRDUP', 'NR_SOCKET_IS_VOID_PTR'):
for var in ('MOZILLA_INTERNAL_API', 'MOZILLA_XPCOMRT_API', 'MOZILLA_EXTERNAL_LINKAGE'):
DEFINES[var] = True
DEFINES['R_DEFINED_INT2'] = 'int16_t'
DEFINES['R_DEFINED_UINT2'] = 'uint16_t'
DEFINES['R_DEFINED_INT4'] = 'int32_t'
DEFINES['R_DEFINED_UINT4'] = 'uint32_t'
DEFINES['R_DEFINED_INT8'] = 'int64_t'
DEFINES['R_DEFINED_UINT8'] = 'uint64_t'

View File

@ -14,6 +14,10 @@ extern "C" {
#include "mozilla/net/DNS.h"
#include "stun_udp_socket_filter.h"
#include "nr_socket_prsock.h"
#if defined(MOZILLA_XPCOMRT_API)
#include "mozilla/Module.h"
#include "mozilla/ModuleUtils.h"
#endif
namespace {
@ -206,3 +210,26 @@ NS_IMETHODIMP nsStunUDPSocketFilterHandler::NewFilter(nsIUDPSocketFilter **resul
NS_ADDREF(*result = ret);
return NS_OK;
}
#if defined(MOZILLA_XPCOMRT_API)
NS_DEFINE_NAMED_CID(NS_STUN_UDP_SOCKET_FILTER_HANDLER_CID)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsStunUDPSocketFilterHandler)
static const mozilla::Module::CIDEntry kCIDs[] = {
{ &kNS_STUN_UDP_SOCKET_FILTER_HANDLER_CID, false, nullptr, nsStunUDPSocketFilterHandlerConstructor },
{ nullptr }
};
static const mozilla::Module::ContractIDEntry kContracts[] = {
{ NS_STUN_UDP_SOCKET_FILTER_HANDLER_CONTRACTID, &kNS_STUN_UDP_SOCKET_FILTER_HANDLER_CID },
{ nullptr }
};
extern const mozilla::Module kStunUDPSocketFilterHandlerModule;
const mozilla::Module kStunUDPSocketFilterHandlerModule = {
mozilla::Module::kVersion,
kCIDs,
kContracts
};
#endif

View File

@ -5,7 +5,7 @@
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
if CONFIG['OS_TARGET'] != 'WINNT' and CONFIG['MOZ_WIDGET_TOOLKIT'] != 'gonk':
GeckoCppUnitTests([
CppUnitTests([
'buffered_stun_socket_unittest',
'ice_unittest',
'nrappkit_unittest',
@ -20,13 +20,13 @@ if CONFIG['OS_TARGET'] != 'WINNT' and CONFIG['MOZ_WIDGET_TOOLKIT'] != 'gonk':
])
if CONFIG['MOZ_SCTP']:
GeckoCppUnitTests([
CppUnitTests([
'sctp_unittest',
])
FAIL_ON_WARNINGS = True
for var in ('HAVE_STRDUP', 'NR_SOCKET_IS_VOID_PTR', 'SCTP_DEBUG', 'INET'):
for var in ('MOZILLA_INTERNAL_API', 'MOZILLA_XPCOMRT_API', 'MOZILLA_EXTERNAL_LINKAGE', 'HAVE_STRDUP', 'NR_SOCKET_IS_VOID_PTR', 'SCTP_DEBUG', 'INET'):
DEFINES[var] = True
if CONFIG['OS_TARGET'] == 'Android':
@ -40,6 +40,12 @@ if CONFIG['OS_TARGET'] == 'Linux':
LOCAL_INCLUDES += [
'/media/mtransport/third_party/nrappkit/src/port/linux/include',
]
USE_LIBS += [
'static:/nsprpub/lib/libc/src/plc4',
]
OS_LIBS += [
'-lrt',
]
if CONFIG['OS_TARGET'] == 'Darwin':
LOCAL_INCLUDES += [
@ -80,14 +86,22 @@ LOCAL_INCLUDES += [
'/media/mtransport/third_party/nrappkit/src/util/libekr',
'/media/webrtc/trunk/testing/gtest/include/',
'/netwerk/sctp/src/',
'/xpcom/libxpcomrt',
]
USE_LIBS += [
'/media/webrtc/trunk/testing/gtest_gtest/gtest',
'mtransport_s',
'fallible',
'mfbt',
'mozglue',
'mtransport_standalone',
'necko_standalone',
'nicer',
'nrappkit',
'nspr',
'nss',
'unicharutil_standalone',
'xpcomrt',
]
if not CONFIG['MOZ_NATIVE_NSS'] and not CONFIG['MOZ_FOLD_LIBS']:
@ -100,3 +114,5 @@ if CONFIG['MOZ_SCTP']:
USE_LIBS += [
'nksctp_s',
]
USE_LIBS += ['mozglue']

View File

@ -19,7 +19,7 @@
#include "nsIComponentManager.h"
#include "nsIComponentRegistrar.h"
#include "nsNetUtil.h"
#include "nsIEventTarget.h"
#include "nsIIOService.h"
#include "nsIServiceManager.h"
#include "nsISocketTransportService.h"
@ -30,7 +30,22 @@
#endif
#include "nsPISocketTransportService.h"
#include "nsServiceManagerUtils.h"
#if !defined(MOZILLA_XPCOMRT_API)
#include "TestHarness.h"
#else
#include "XPCOMRTInit.h"
class ScopedXPCOM {
public:
explicit ScopedXPCOM(const char*)
{
NS_InitXPCOMRT();
}
~ScopedXPCOM()
{
NS_ShutdownXPCOMRT();
}
};
#endif
class MtransportTestUtils {
public:
@ -46,8 +61,6 @@ class MtransportTestUtils {
void InitServices() {
nsresult rv;
ioservice_ = do_GetIOService(&rv);
MOZ_ASSERT(NS_SUCCEEDED(rv));
sts_target_ = do_GetService(NS_SOCKETTRANSPORTSERVICE_CONTRACTID, &rv);
MOZ_ASSERT(NS_SUCCEEDED(rv));
sts_ = do_GetService(NS_SOCKETTRANSPORTSERVICE_CONTRACTID, &rv);
@ -80,7 +93,6 @@ class MtransportTestUtils {
private:
ScopedXPCOM xpcom_;
nsCOMPtr<nsIIOService> ioservice_;
nsCOMPtr<nsIEventTarget> sts_target_;
nsCOMPtr<nsPISocketTransportService> sts_;
#ifdef MOZ_CRASHREPORTER

View File

@ -0,0 +1,16 @@
# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
# vim: set filetype=python:
# 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/.
include('../common.build')
# These files cannot be built in unified mode because of the redefinition of
# getLogModule, UNIMPLEMENTED, nr_socket_long_term_violation_time,
# nr_socket_short_term_violation_time.
SOURCES += mtransport_cppsrcs
Library('mtransport_s')
FORCE_STATIC_LIB = True

View File

@ -1,22 +0,0 @@
# Copyright 2012 Mozilla Foundation and Mozilla contributors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
include $(topsrcdir)/config/rules.mk
ifeq ($(MOZ_WIDGET_TOOLKIT),gonk)
EXTRA_DSO_LDOPTS += \
-lutils -lstagefright -lmedia -lstagefright_omx -lbinder -lui \
-lhardware -lcutils \
$(NULL)
endif

View File

@ -47,6 +47,16 @@ if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gonk':
'hardware/libhardware/include',
]
]
EXTRA_DSO_LDOPTS += [
'-lutils',
'-lstagefright',
'-lmedia',
'-lstagefright_omx',
'-lbinder',
'-lui',
'-lhardware',
'-lcutils',
]
else:
USE_LIBS += [
'/media/omx-plugin/lib/ics/libstagefright/stagefright',

View File

@ -48,7 +48,8 @@ if CONFIG['MOZ_WEBRTC_SIGNALING']:
GYP_DIRS['signaling'].input = 'signaling/signaling.gyp'
GYP_DIRS['signaling'].variables = gyp_vars.copy()
GYP_DIRS['signaling'].variables.update(
build_for_test=0
build_for_test=0,
build_for_standalone=0
)
GYP_DIRS['signaling'].sandbox_vars['FINAL_LIBRARY'] = 'xul'
# Excluded for various symbol conflicts
@ -92,7 +93,16 @@ if CONFIG['MOZ_WIDGET_TOOLKIT'] != 'gonk':
GYP_DIRS['signalingtest'].input = 'signaling/signaling.gyp'
GYP_DIRS['signalingtest'].variables = gyp_vars.copy()
GYP_DIRS['signalingtest'].variables.update(
build_for_test=1
build_for_test=1,
build_for_standalone=0
)
GYP_DIRS['signalingtest'].non_unified_sources += signaling_non_unified_sources
GYP_DIRS += ['signalingstandalone']
GYP_DIRS['signalingstandalone'].input = 'signaling/signaling.gyp'
GYP_DIRS['signalingstandalone'].variables = gyp_vars.copy()
GYP_DIRS['signalingstandalone'].variables.update(
build_for_test=0,
build_for_standalone=1
)
GYP_DIRS['signalingstandalone'].non_unified_sources += signaling_non_unified_sources

View File

@ -77,8 +77,6 @@
'./src/media-conduit/CodecStatistics.h',
'./src/media-conduit/CodecStatistics.cpp',
'./src/media-conduit/RunningStat.h',
'./src/media-conduit/GmpVideoCodec.cpp',
'./src/media-conduit/WebrtcGmpVideoCodec.cpp',
# Common
'./src/common/CommonTypes.h',
'./src/common/csf_common.h',
@ -98,8 +96,6 @@
# PeerConnection
'./src/peerconnection/MediaPipelineFactory.cpp',
'./src/peerconnection/MediaPipelineFactory.h',
'./src/peerconnection/MediaStreamList.cpp',
'./src/peerconnection/MediaStreamList.h',
'./src/peerconnection/PeerConnectionCtx.cpp',
'./src/peerconnection/PeerConnectionCtx.h',
'./src/peerconnection/PeerConnectionImpl.cpp',
@ -220,11 +216,13 @@
'MOZ_WEBRTC_OMX'
],
}],
['build_for_test==0', {
['(build_for_test==0) and (build_for_standalone==0)', {
'defines' : [
'MOZILLA_INTERNAL_API'
'MOZILLA_INTERNAL_API',
],
'sources': [
'./src/peerconnection/MediaStreamList.cpp',
'./src/peerconnection/MediaStreamList.h',
'./src/peerconnection/WebrtcGlobalInformation.cpp',
'./src/peerconnection/WebrtcGlobalInformation.h',
],
@ -236,7 +234,27 @@
'defines' : [
'NO_CHROMIUM_LOGGING',
'USE_FAKE_MEDIA_STREAMS',
'USE_FAKE_PCOBSERVER'
'USE_FAKE_PCOBSERVER',
'MOZILLA_EXTERNAL_LINKAGE',
],
}],
['build_for_standalone==0', {
'sources': [
'./src/media-conduit/GmpVideoCodec.cpp',
'./src/media-conduit/WebrtcGmpVideoCodec.cpp',
],
}],
['build_for_standalone!=0', {
'include_dirs': [
'./test'
],
'defines' : [
'MOZILLA_INTERNAL_API',
'MOZILLA_XPCOMRT_API',
'MOZILLA_EXTERNAL_LINKAGE',
'NO_CHROMIUM_LOGGING',
'USE_FAKE_MEDIA_STREAMS',
'USE_FAKE_PCOBSERVER',
],
}],
['(OS=="linux") or (OS=="android")', {

View File

@ -11,7 +11,9 @@
#include "nscore.h"
#ifdef MOZILLA_INTERNAL_API
#include "nsString.h"
#if !defined(MOZILLA_XPCOMRT_API)
#include "mozilla/Preferences.h"
#endif // !defined(MOZILLA_XPCOMRT_API)
#else
#include "nsStringAPI.h"
#endif
@ -57,11 +59,13 @@ static WebRtcTraceCallback gWebRtcCallback;
#ifdef MOZILLA_INTERNAL_API
void GetWebRtcLogPrefs(uint32_t *aTraceMask, nsACString* aLogFile, nsACString *aAECLogDir, bool *aMultiLog)
{
#if !defined(MOZILLA_XPCOMRT_API)
*aMultiLog = mozilla::Preferences::GetBool("media.webrtc.debug.multi_log");
*aTraceMask = mozilla::Preferences::GetUint("media.webrtc.debug.trace_mask");
mozilla::Preferences::GetCString("media.webrtc.debug.log_file", aLogFile);
mozilla::Preferences::GetCString("media.webrtc.debug.aec_log_dir", aAECLogDir);
webrtc::Trace::set_aec_debug_size(mozilla::Preferences::GetUint("media.webrtc.debug.aec_dump_max_size"));
#endif // !defined(MOZILLA_XPCOMRT_API)
}
#endif
@ -141,7 +145,7 @@ void ConfigWebRtcLog(uint32_t trace_mask, nsCString &aLogFile, nsCString &aAECLo
webrtc::Trace::SetTraceFile(aLogFile.get(), multi_log);
}
}
#ifdef MOZILLA_INTERNAL_API
#if !defined(MOZILLA_EXTERNAL_LINKAGE)
// Capture the final choices for the trace settings.
mozilla::Preferences::SetCString("media.webrtc.debug.log_file", aLogFile);
mozilla::Preferences::SetUint("media.webrtc.debug.trace_mask", trace_mask);

View File

@ -18,7 +18,7 @@
#include "nsIPrefService.h"
#include "nsIPrefBranch.h"
#include "nsThreadUtils.h"
#ifdef MOZILLA_INTERNAL_API
#if !defined(MOZILLA_EXTERNAL_LINKAGE)
#include "Latency.h"
#include "mozilla/Telemetry.h"
#endif
@ -369,7 +369,7 @@ WebrtcAudioConduit::ConfigureSendMediaCodec(const AudioCodecConfig* codecConfig)
return kMediaConduitUnknownError;
}
#ifdef MOZILLA_INTERNAL_API
#if !defined(MOZILLA_EXTERNAL_LINKAGE)
// TEMPORARY - see bug 694814 comment 2
nsresult rv;
nsCOMPtr<nsIPrefService> prefs = do_GetService("@mozilla.org/preferences-service;1", &rv);
@ -530,7 +530,7 @@ WebrtcAudioConduit::SendAudioFrame(const int16_t audio_data[],
return kMediaConduitSessionNotInited;
}
#ifdef MOZILLA_INTERNAL_API
#if !defined(MOZILLA_EXTERNAL_LINKAGE)
if (PR_LOG_TEST(GetLatencyLog(), PR_LOG_DEBUG)) {
struct Processing insert = { TimeStamp::Now(), 0 };
mProcessing.AppendElement(insert);
@ -624,7 +624,7 @@ WebrtcAudioConduit::GetAudioFrame(int16_t speechData[],
if (GetAVStats(&jitter_buffer_delay_ms,
&playout_buffer_delay_ms,
&avsync_offset_ms)) {
#ifdef MOZILLA_INTERNAL_API
#if !defined(MOZILLA_EXTERNAL_LINKAGE)
if (avsync_offset_ms < 0) {
Telemetry::Accumulate(Telemetry::WEBRTC_AVSYNC_WHEN_VIDEO_LAGS_AUDIO_MS,
-avsync_offset_ms);
@ -642,7 +642,7 @@ WebrtcAudioConduit::GetAudioFrame(int16_t speechData[],
mLastSyncLog = mSamples;
}
#ifdef MOZILLA_INTERNAL_API
#if !defined(MOZILLA_EXTERNAL_LINKAGE)
if (PR_LOG_TEST(GetLatencyLog(), PR_LOG_DEBUG)) {
if (mProcessing.Length() > 0) {
unsigned int now;
@ -679,7 +679,7 @@ WebrtcAudioConduit::ReceivedRTPPacket(const void *data, int len)
if(mEngineReceiving)
{
#ifdef MOZILLA_INTERNAL_API
#if !defined(MOZILLA_EXTERNAL_LINKAGE)
if (PR_LOG_TEST(GetLatencyLog(), PR_LOG_DEBUG)) {
// timestamp is at 32 bits in ([1])
struct Processing insert = { TimeStamp::Now(),
@ -817,7 +817,7 @@ int WebrtcAudioConduit::SendPacket(int channel, const void* data, int len)
{
CSFLogDebug(logTag, "%s : channel %d", __FUNCTION__, channel);
#ifdef MOZILLA_INTERNAL_API
#if !defined(MOZILLA_EXTERNAL_LINKAGE)
if (PR_LOG_TEST(GetLatencyLog(), PR_LOG_DEBUG)) {
if (mProcessing.Length() > 0) {
TimeStamp started = mProcessing[0].mTimeStamp;

View File

@ -171,7 +171,7 @@ public:
mChannel(-1),
mCurSendCodecConfig(nullptr),
mCaptureDelay(150),
#ifdef MOZILLA_INTERNAL_API
#if !defined(MOZILLA_EXTERNAL_LINKAGE)
mLastTimestamp(0),
#endif // MOZILLA_INTERNAL_API
mSamples(0),
@ -282,7 +282,7 @@ private:
// Current "capture" delay (really output plus input delay)
int32_t mCaptureDelay;
#ifdef MOZILLA_INTERNAL_API
#if !defined(MOZILLA_EXTERNAL_LINKAGE)
uint32_t mLastTimestamp;
#endif // MOZILLA_INTERNAL_API

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