merge mozilla-inbound to mozilla-central a=merge

This commit is contained in:
Carsten "Tomcat" Book 2016-09-27 11:21:25 +02:00
commit 5bdd2876ae
331 changed files with 6820 additions and 7551 deletions

View File

@ -265,7 +265,8 @@ mai_util_add_key_event_listener(AtkKeySnoopFunc listener, gpointer data)
}
AtkKeySnoopFuncPointer atkKeySnoop;
atkKeySnoop.func_ptr = listener;
g_hash_table_insert(sKey_listener_list, GUINT_TO_POINTER(key++),
key++;
g_hash_table_insert(sKey_listener_list, GUINT_TO_POINTER(key),
atkKeySnoop.data);
return key;
}

View File

@ -29,14 +29,14 @@
#include "nsIScriptError.h"
#include "nsIWindowMediator.h"
#include "nsIPrefService.h"
#include "mozilla/StyleSheetHandle.h"
#include "mozilla/StyleSheetHandleInlines.h"
#include "mozilla/StyleSheet.h"
#include "mozilla/StyleSheetInlines.h"
nsChromeRegistry* nsChromeRegistry::gChromeRegistry;
// DO NOT use namespace mozilla; it'll break due to a naming conflict between
// mozilla::TextRange and a TextRange in OSX headers.
using mozilla::StyleSheetHandle;
using mozilla::StyleSheet;
using mozilla::dom::IsChromeURI;
////////////////////////////////////////////////////////////////////////////////
@ -402,17 +402,17 @@ nsresult nsChromeRegistry::RefreshWindow(nsPIDOMWindowOuter* aWindow)
nsCOMPtr<nsIPresShell> shell = document->GetShell();
if (shell) {
// Reload only the chrome URL agent style sheets.
nsTArray<StyleSheetHandle::RefPtr> agentSheets;
nsTArray<RefPtr<StyleSheet>> agentSheets;
rv = shell->GetAgentStyleSheets(agentSheets);
NS_ENSURE_SUCCESS(rv, rv);
nsTArray<StyleSheetHandle::RefPtr> newAgentSheets;
for (StyleSheetHandle sheet : agentSheets) {
nsTArray<RefPtr<StyleSheet>> newAgentSheets;
for (StyleSheet* sheet : agentSheets) {
nsIURI* uri = sheet->GetSheetURI();
if (IsChromeURI(uri)) {
// Reload the sheet.
StyleSheetHandle::RefPtr newSheet;
RefPtr<StyleSheet> newSheet;
rv = document->LoadChromeSheetSync(uri, true, &newSheet);
if (NS_FAILED(rv)) return rv;
if (newSheet) {
@ -433,26 +433,26 @@ nsresult nsChromeRegistry::RefreshWindow(nsPIDOMWindowOuter* aWindow)
int32_t count = document->GetNumberOfStyleSheets();
// Build an array of style sheets we need to reload.
nsTArray<StyleSheetHandle::RefPtr> oldSheets(count);
nsTArray<StyleSheetHandle::RefPtr> newSheets(count);
nsTArray<RefPtr<StyleSheet>> oldSheets(count);
nsTArray<RefPtr<StyleSheet>> newSheets(count);
// Iterate over the style sheets.
for (int32_t i = 0; i < count; i++) {
// Get the style sheet
StyleSheetHandle styleSheet = document->GetStyleSheetAt(i);
StyleSheet* styleSheet = document->GetStyleSheetAt(i);
oldSheets.AppendElement(styleSheet);
}
// Iterate over our old sheets and kick off a sync load of the new
// sheet if and only if it's a non-inline sheet with a chrome URL.
for (StyleSheetHandle sheet : oldSheets) {
for (StyleSheet* sheet : oldSheets) {
MOZ_ASSERT(sheet, "GetStyleSheetAt shouldn't return nullptr for "
"in-range sheet indexes");
nsIURI* uri = sheet->GetSheetURI();
if (!sheet->IsInline() && IsChromeURI(uri)) {
// Reload the sheet.
StyleSheetHandle::RefPtr newSheet;
RefPtr<StyleSheet> newSheet;
// XXX what about chrome sheets that have a title or are disabled? This
// only works by sheer dumb luck.
document->LoadChromeSheetSync(uri, false, &newSheet);

View File

@ -673,6 +673,7 @@ SSL_HandshakeCallback
SSL_HandshakeNegotiatedExtension
SSL_ImplementedCiphers @DATA@
SSL_ImportFD
SSL_NamedGroupConfig
SSL_NumImplementedCiphers @DATA@
SSL_OptionSet
SSL_OptionSetDefault
@ -680,6 +681,7 @@ SSL_PeerCertificate
SSL_PeerCertificateChain
SSL_PeerStapledOCSPResponses
SSL_ResetHandshake
SSL_SendAdditionalKeyShares
SSL_SetCanFalseStartCallback
SSL_SetDowngradeCheckVersion
SSL_SetNextProtoNego

View File

@ -17,8 +17,8 @@
#include "mozilla/dom/HTMLContentElement.h"
#include "mozilla/dom/HTMLShadowElement.h"
#include "nsXBLPrototypeBinding.h"
#include "mozilla/StyleSheetHandle.h"
#include "mozilla/StyleSheetHandleInlines.h"
#include "mozilla/StyleSheet.h"
#include "mozilla/StyleSheetInlines.h"
using namespace mozilla;
using namespace mozilla::dom;
@ -132,7 +132,7 @@ ShadowRoot::StyleSheetChanged()
}
void
ShadowRoot::InsertSheet(StyleSheetHandle aSheet,
ShadowRoot::InsertSheet(StyleSheet* aSheet,
nsIContent* aLinkingContent)
{
nsCOMPtr<nsIStyleSheetLinkingElement>
@ -163,7 +163,7 @@ ShadowRoot::InsertSheet(StyleSheetHandle aSheet,
}
void
ShadowRoot::RemoveSheet(StyleSheetHandle aSheet)
ShadowRoot::RemoveSheet(StyleSheet* aSheet)
{
mProtoBinding->RemoveStyleSheet(aSheet);
@ -756,7 +756,7 @@ ShadowRootStyleSheetList::IndexedGetter(uint32_t aIndex, bool& aFound)
// XXXheycam Return null until ServoStyleSheet implements the right
// DOM interfaces.
StyleSheetHandle sheet = mShadowRoot->mProtoBinding->StyleSheetAt(aIndex);
StyleSheet* sheet = mShadowRoot->mProtoBinding->StyleSheetAt(aIndex);
if (sheet->IsServo()) {
NS_ERROR("stylo: can't return ServoStyleSheets to script yet");
return nullptr;

View File

@ -9,7 +9,7 @@
#include "mozilla/dom/DocumentFragment.h"
#include "mozilla/dom/StyleSheetList.h"
#include "mozilla/StyleSheetHandle.h"
#include "mozilla/StyleSheet.h"
#include "nsCOMPtr.h"
#include "nsCycleCollectionParticipant.h"
#include "nsIContentInlines.h"
@ -47,8 +47,8 @@ public:
void AddToIdTable(Element* aElement, nsIAtom* aId);
void RemoveFromIdTable(Element* aElement, nsIAtom* aId);
void InsertSheet(StyleSheetHandle aSheet, nsIContent* aLinkingContent);
void RemoveSheet(StyleSheetHandle aSheet);
void InsertSheet(StyleSheet* aSheet, nsIContent* aLinkingContent);
void RemoveSheet(StyleSheet* aSheet);
bool ApplyAuthorStyles();
void SetApplyAuthorStyles(bool aApplyAuthorStyles);
StyleSheetList* StyleSheets();

View File

@ -207,7 +207,7 @@ nsContentSink::Init(nsIDocument* aDoc,
}
NS_IMETHODIMP
nsContentSink::StyleSheetLoaded(StyleSheetHandle aSheet,
nsContentSink::StyleSheetLoaded(StyleSheet* aSheet,
bool aWasAlternate,
nsresult aStatus)
{

View File

@ -85,7 +85,7 @@ class nsContentSink : public nsICSSLoaderObserver,
NS_DECL_NSITIMERCALLBACK
// nsICSSLoaderObserver
NS_IMETHOD StyleSheetLoaded(mozilla::StyleSheetHandle aSheet,
NS_IMETHOD StyleSheetLoaded(mozilla::StyleSheet* aSheet,
bool aWasAlternate,
nsresult aStatus) override;

View File

@ -109,7 +109,7 @@
#include "mozilla/css/ImageLoader.h"
#include "mozilla/layers/APZCTreeManager.h" // for layers::ZoomToRectBehavior
#include "mozilla/dom/Promise.h"
#include "mozilla/CSSStyleSheet.h"
#include "mozilla/StyleSheetInlines.h"
#ifdef XP_WIN
#undef GetClassName

View File

@ -250,8 +250,8 @@
#include "nsISupportsPrimitives.h"
#include "mozilla/StyleSetHandle.h"
#include "mozilla/StyleSetHandleInlines.h"
#include "mozilla/StyleSheetHandle.h"
#include "mozilla/StyleSheetHandleInlines.h"
#include "mozilla/StyleSheet.h"
#include "mozilla/StyleSheetInlines.h"
#include "mozilla/DocLoadingTimelineMarker.h"
@ -600,7 +600,7 @@ nsDOMStyleSheetList::IndexedGetter(uint32_t aIndex, bool& aFound)
}
aFound = true;
StyleSheetHandle sheet = mDocument->GetStyleSheetAt(aIndex);
StyleSheet* sheet = mDocument->GetStyleSheetAt(aIndex);
NS_ASSERTION(sheet, "Must have a sheet");
// XXXheycam Return null until ServoStyleSheet implements the right DOM
@ -619,7 +619,7 @@ nsDOMStyleSheetList::NodeWillBeDestroyed(const nsINode *aNode)
}
void
nsDOMStyleSheetList::StyleSheetAdded(StyleSheetHandle aStyleSheet,
nsDOMStyleSheetList::StyleSheetAdded(StyleSheet* aStyleSheet,
bool aDocumentSheet)
{
if (aDocumentSheet && -1 != mLength) {
@ -628,7 +628,7 @@ nsDOMStyleSheetList::StyleSheetAdded(StyleSheetHandle aStyleSheet,
}
void
nsDOMStyleSheetList::StyleSheetRemoved(StyleSheetHandle aStyleSheet,
nsDOMStyleSheetList::StyleSheetRemoved(StyleSheet* aStyleSheet,
bool aDocumentSheet)
{
if (aDocumentSheet && -1 != mLength) {
@ -1196,7 +1196,7 @@ nsDOMStyleSheetSetList::EnsureFresh()
int32_t count = mDocument->GetNumberOfStyleSheets();
nsAutoString title;
for (int32_t index = 0; index < count; index++) {
StyleSheetHandle sheet = mDocument->GetStyleSheetAt(index);
StyleSheet* sheet = mDocument->GetStyleSheetAt(index);
NS_ASSERTION(sheet, "Null sheet in sheet list!");
// XXXheycam ServoStyleSheets don't expose their title yet.
if (sheet->IsServo()) {
@ -1497,7 +1497,7 @@ nsDocument::~nsDocument()
mCachedRootElement = nullptr;
// Let the stylesheets know we're going away
for (StyleSheetHandle sheet : mStyleSheets) {
for (StyleSheet* sheet : mStyleSheets) {
sheet->SetOwningDocument(nullptr);
}
if (mAttrStyleSheet) {
@ -2153,7 +2153,7 @@ void
nsDocument::RemoveDocStyleSheetsFromStyleSets()
{
// The stylesheets should forget us
for (StyleSheetHandle sheet : Reversed(mStyleSheets)) {
for (StyleSheet* sheet : Reversed(mStyleSheets)) {
sheet->SetOwningDocument(nullptr);
if (sheet->IsApplicable()) {
@ -2168,11 +2168,11 @@ nsDocument::RemoveDocStyleSheetsFromStyleSets()
void
nsDocument::RemoveStyleSheetsFromStyleSets(
const nsTArray<StyleSheetHandle::RefPtr>& aSheets,
const nsTArray<RefPtr<StyleSheet>>& aSheets,
SheetType aType)
{
// The stylesheets should forget us
for (StyleSheetHandle sheet : Reversed(aSheets)) {
for (StyleSheet* sheet : Reversed(aSheets)) {
sheet->SetOwningDocument(nullptr);
if (sheet->IsApplicable()) {
@ -2250,10 +2250,10 @@ nsDocument::ResetStylesheetsToURI(nsIURI* aURI)
static void
AppendSheetsToStyleSet(StyleSetHandle aStyleSet,
const nsTArray<StyleSheetHandle::RefPtr>& aSheets,
const nsTArray<RefPtr<StyleSheet>>& aSheets,
SheetType aType)
{
for (StyleSheetHandle sheet : Reversed(aSheets)) {
for (StyleSheet* sheet : Reversed(aSheets)) {
aStyleSet->AppendStyleSheet(aType, sheet);
}
}
@ -2268,7 +2268,7 @@ nsDocument::FillStyleSet(StyleSetHandle aStyleSet)
MOZ_ASSERT(!mStyleSetFilled);
for (StyleSheetHandle sheet : Reversed(mStyleSheets)) {
for (StyleSheet* sheet : Reversed(mStyleSheets)) {
if (sheet->IsApplicable()) {
aStyleSet->AddDocStyleSheet(sheet, this);
}
@ -2277,13 +2277,13 @@ nsDocument::FillStyleSet(StyleSetHandle aStyleSet)
if (aStyleSet->IsGecko()) {
nsStyleSheetService *sheetService = nsStyleSheetService::GetInstance();
if (sheetService) {
for (StyleSheetHandle sheet : *sheetService->AuthorStyleSheets()) {
for (StyleSheet* sheet : *sheetService->AuthorStyleSheets()) {
aStyleSet->AppendStyleSheet(SheetType::Doc, sheet);
}
}
// Iterate backwards to maintain order
for (StyleSheetHandle sheet : Reversed(mOnDemandBuiltInUASheets)) {
for (StyleSheet* sheet : Reversed(mOnDemandBuiltInUASheets)) {
if (sheet->IsApplicable()) {
aStyleSet->PrependStyleSheet(SheetType::Agent, sheet);
}
@ -3939,7 +3939,7 @@ nsDocument::RemoveChildAt(uint32_t aIndex, bool aNotify)
}
void
nsDocument::EnsureOnDemandBuiltInUASheet(StyleSheetHandle aSheet)
nsDocument::EnsureOnDemandBuiltInUASheet(StyleSheet* aSheet)
{
if (mOnDemandBuiltInUASheets.Contains(aSheet)) {
return;
@ -3950,7 +3950,7 @@ nsDocument::EnsureOnDemandBuiltInUASheet(StyleSheetHandle aSheet)
}
void
nsDocument::AddOnDemandBuiltInUASheet(StyleSheetHandle aSheet)
nsDocument::AddOnDemandBuiltInUASheet(StyleSheet* aSheet)
{
MOZ_ASSERT(!mOnDemandBuiltInUASheets.Contains(aSheet));
@ -3979,20 +3979,20 @@ nsDocument::GetNumberOfStyleSheets() const
return mStyleSheets.Length();
}
StyleSheetHandle
StyleSheet*
nsDocument::GetStyleSheetAt(int32_t aIndex) const
{
return mStyleSheets.SafeElementAt(aIndex, StyleSheetHandle());
return mStyleSheets.SafeElementAt(aIndex, nullptr);
}
int32_t
nsDocument::GetIndexOfStyleSheet(const StyleSheetHandle aSheet) const
nsDocument::GetIndexOfStyleSheet(const StyleSheet* aSheet) const
{
return mStyleSheets.IndexOf(aSheet);
}
void
nsDocument::AddStyleSheetToStyleSets(StyleSheetHandle aSheet)
nsDocument::AddStyleSheetToStyleSets(StyleSheet* aSheet)
{
nsCOMPtr<nsIPresShell> shell = GetShell();
if (shell) {
@ -4023,7 +4023,7 @@ nsDocument::AddStyleSheetToStyleSets(StyleSheetHandle aSheet)
} while (0);
void
nsDocument::NotifyStyleSheetAdded(StyleSheetHandle aSheet, bool aDocumentSheet)
nsDocument::NotifyStyleSheetAdded(StyleSheet* aSheet, bool aDocumentSheet)
{
NS_DOCUMENT_NOTIFY_OBSERVERS(StyleSheetAdded, (aSheet, aDocumentSheet));
@ -4036,7 +4036,7 @@ nsDocument::NotifyStyleSheetAdded(StyleSheetHandle aSheet, bool aDocumentSheet)
}
void
nsDocument::NotifyStyleSheetRemoved(StyleSheetHandle aSheet, bool aDocumentSheet)
nsDocument::NotifyStyleSheetRemoved(StyleSheet* aSheet, bool aDocumentSheet)
{
NS_DOCUMENT_NOTIFY_OBSERVERS(StyleSheetRemoved, (aSheet, aDocumentSheet));
@ -4049,7 +4049,7 @@ nsDocument::NotifyStyleSheetRemoved(StyleSheetHandle aSheet, bool aDocumentSheet
}
void
nsDocument::AddStyleSheet(StyleSheetHandle aSheet)
nsDocument::AddStyleSheet(StyleSheet* aSheet)
{
NS_PRECONDITION(aSheet, "null arg");
mStyleSheets.AppendElement(aSheet);
@ -4063,7 +4063,7 @@ nsDocument::AddStyleSheet(StyleSheetHandle aSheet)
}
void
nsDocument::RemoveStyleSheetFromStyleSets(StyleSheetHandle aSheet)
nsDocument::RemoveStyleSheetFromStyleSets(StyleSheet* aSheet)
{
nsCOMPtr<nsIPresShell> shell = GetShell();
if (shell) {
@ -4072,10 +4072,10 @@ nsDocument::RemoveStyleSheetFromStyleSets(StyleSheetHandle aSheet)
}
void
nsDocument::RemoveStyleSheet(StyleSheetHandle aSheet)
nsDocument::RemoveStyleSheet(StyleSheet* aSheet)
{
NS_PRECONDITION(aSheet, "null arg");
StyleSheetHandle::RefPtr sheet = aSheet; // hold ref so it won't die too soon
RefPtr<StyleSheet> sheet = aSheet; // hold ref so it won't die too soon
if (!mStyleSheets.RemoveElement(aSheet)) {
NS_ASSERTION(mInUnlinkOrDeletion, "stylesheet not found");
@ -4094,8 +4094,8 @@ nsDocument::RemoveStyleSheet(StyleSheetHandle aSheet)
}
void
nsDocument::UpdateStyleSheets(nsTArray<StyleSheetHandle::RefPtr>& aOldSheets,
nsTArray<StyleSheetHandle::RefPtr>& aNewSheets)
nsDocument::UpdateStyleSheets(nsTArray<RefPtr<StyleSheet>>& aOldSheets,
nsTArray<RefPtr<StyleSheet>>& aNewSheets)
{
BeginUpdate(UPDATE_STYLE);
@ -4104,7 +4104,7 @@ nsDocument::UpdateStyleSheets(nsTArray<StyleSheetHandle::RefPtr>& aOldSheets,
"The lists must be the same length!");
int32_t count = aOldSheets.Length();
StyleSheetHandle::RefPtr oldSheet;
RefPtr<StyleSheet> oldSheet;
int32_t i;
for (i = 0; i < count; ++i) {
oldSheet = aOldSheets[i];
@ -4115,7 +4115,7 @@ nsDocument::UpdateStyleSheets(nsTArray<StyleSheetHandle::RefPtr>& aOldSheets,
RemoveStyleSheet(oldSheet); // This does the right notifications
// Now put the new one in its place. If it's null, just ignore it.
StyleSheetHandle newSheet = aNewSheets[i];
StyleSheet* newSheet = aNewSheets[i];
if (newSheet) {
mStyleSheets.InsertElementAt(oldIndex, newSheet);
newSheet->SetOwningDocument(this);
@ -4131,7 +4131,7 @@ nsDocument::UpdateStyleSheets(nsTArray<StyleSheetHandle::RefPtr>& aOldSheets,
}
void
nsDocument::InsertStyleSheetAt(StyleSheetHandle aSheet, int32_t aIndex)
nsDocument::InsertStyleSheetAt(StyleSheet* aSheet, int32_t aIndex)
{
NS_PRECONDITION(aSheet, "null ptr");
@ -4148,7 +4148,7 @@ nsDocument::InsertStyleSheetAt(StyleSheetHandle aSheet, int32_t aIndex)
void
nsDocument::SetStyleSheetApplicableState(StyleSheetHandle aSheet,
nsDocument::SetStyleSheetApplicableState(StyleSheet* aSheet,
bool aApplicable)
{
NS_PRECONDITION(aSheet, "null arg");
@ -4214,7 +4214,7 @@ ConvertAdditionalSheetType(nsIDocument::additionalSheetType aType)
}
static int32_t
FindSheet(const nsTArray<StyleSheetHandle::RefPtr>& aSheets, nsIURI* aSheetURI)
FindSheet(const nsTArray<RefPtr<StyleSheet>>& aSheets, nsIURI* aSheetURI)
{
for (int32_t i = aSheets.Length() - 1; i >= 0; i-- ) {
bool bEqual;
@ -4258,7 +4258,7 @@ nsDocument::LoadAdditionalStyleSheet(additionalSheetType aType,
MOZ_CRASH("impossible value for aType");
}
StyleSheetHandle::RefPtr sheet;
RefPtr<StyleSheet> sheet;
nsresult rv = loader->LoadSheetSync(aSheetURI, parsingMode, true, &sheet);
NS_ENSURE_SUCCESS(rv, rv);
@ -4269,7 +4269,7 @@ nsDocument::LoadAdditionalStyleSheet(additionalSheetType aType,
}
nsresult
nsDocument::AddAdditionalStyleSheet(additionalSheetType aType, StyleSheetHandle aSheet)
nsDocument::AddAdditionalStyleSheet(additionalSheetType aType, StyleSheet* aSheet)
{
if (mAdditionalSheets[aType].Contains(aSheet))
return NS_ERROR_INVALID_ARG;
@ -4298,11 +4298,11 @@ nsDocument::RemoveAdditionalStyleSheet(additionalSheetType aType, nsIURI* aSheet
{
MOZ_ASSERT(aSheetURI);
nsTArray<StyleSheetHandle::RefPtr>& sheets = mAdditionalSheets[aType];
nsTArray<RefPtr<StyleSheet>>& sheets = mAdditionalSheets[aType];
int32_t i = FindSheet(mAdditionalSheets[aType], aSheetURI);
if (i >= 0) {
StyleSheetHandle::RefPtr sheetRef = sheets[i];
RefPtr<StyleSheet> sheetRef = sheets[i];
sheets.RemoveElementAt(i);
BeginUpdate(UPDATE_STYLE);
@ -4324,10 +4324,10 @@ nsDocument::RemoveAdditionalStyleSheet(additionalSheetType aType, nsIURI* aSheet
}
}
StyleSheetHandle
StyleSheet*
nsDocument::GetFirstAdditionalAuthorSheet()
{
return mAdditionalSheets[eAuthorSheet].SafeElementAt(0, StyleSheetHandle());
return mAdditionalSheets[eAuthorSheet].SafeElementAt(0);
}
nsIGlobalObject*
@ -5132,7 +5132,7 @@ nsDocument::DocumentStatesChanged(EventStates aStateMask)
}
void
nsDocument::StyleRuleChanged(StyleSheetHandle aSheet,
nsDocument::StyleRuleChanged(StyleSheet* aSheet,
css::Rule* aStyleRule)
{
NS_DOCUMENT_NOTIFY_OBSERVERS(StyleRuleChanged, (aSheet));
@ -5146,7 +5146,7 @@ nsDocument::StyleRuleChanged(StyleSheetHandle aSheet,
}
void
nsDocument::StyleRuleAdded(StyleSheetHandle aSheet,
nsDocument::StyleRuleAdded(StyleSheet* aSheet,
css::Rule* aStyleRule)
{
NS_DOCUMENT_NOTIFY_OBSERVERS(StyleRuleAdded, (aSheet));
@ -5161,7 +5161,7 @@ nsDocument::StyleRuleAdded(StyleSheetHandle aSheet,
}
void
nsDocument::StyleRuleRemoved(StyleSheetHandle aSheet,
nsDocument::StyleRuleRemoved(StyleSheet* aSheet,
css::Rule* aStyleRule)
{
NS_DOCUMENT_NOTIFY_OBSERVERS(StyleRuleRemoved, (aSheet));
@ -6029,7 +6029,7 @@ nsIDocument::GetSelectedStyleSheetSet(nsAString& aSheetSet)
int32_t count = GetNumberOfStyleSheets();
nsAutoString title;
for (int32_t index = 0; index < count; index++) {
StyleSheetHandle sheet = GetStyleSheetAt(index);
StyleSheet* sheet = GetStyleSheetAt(index);
NS_ASSERTION(sheet, "Null sheet in sheet list!");
// XXXheycam Make this work with ServoStyleSheets.
@ -6149,7 +6149,7 @@ nsDocument::EnableStyleSheetsForSetInternal(const nsAString& aSheetSet,
int32_t count = GetNumberOfStyleSheets();
nsAutoString title;
for (int32_t index = 0; index < count; index++) {
StyleSheetHandle sheet = GetStyleSheetAt(index);
StyleSheet* sheet = GetStyleSheetAt(index);
NS_ASSERTION(sheet, "Null sheet in sheet list!");
// XXXheycam Make this work with ServoStyleSheets.
@ -9432,7 +9432,7 @@ class StubCSSLoaderObserver final : public nsICSSLoaderObserver {
~StubCSSLoaderObserver() {}
public:
NS_IMETHOD
StyleSheetLoaded(StyleSheetHandle, bool, nsresult) override
StyleSheetLoaded(StyleSheet*, bool, nsresult) override
{
return NS_OK;
}
@ -9461,7 +9461,7 @@ nsDocument::PreloadStyle(nsIURI* uri, const nsAString& charset,
nsresult
nsDocument::LoadChromeSheetSync(nsIURI* uri, bool isAgentSheet,
mozilla::StyleSheetHandle::RefPtr* aSheet)
RefPtr<mozilla::StyleSheet>* aSheet)
{
css::SheetParsingMode mode =
isAgentSheet ? css::eAgentSheetFeatures
@ -9797,7 +9797,7 @@ nsIDocument::CreateStaticClone(nsIDocShell* aCloneContainer)
int32_t sheetsCount = GetNumberOfStyleSheets();
for (int32_t i = 0; i < sheetsCount; ++i) {
StyleSheetHandle::RefPtr sheet = GetStyleSheetAt(i);
RefPtr<StyleSheet> sheet = GetStyleSheetAt(i);
if (sheet) {
if (sheet->IsApplicable()) {
// XXXheycam Need to make ServoStyleSheet cloning work.
@ -9817,7 +9817,7 @@ nsIDocument::CreateStaticClone(nsIDocShell* aCloneContainer)
}
// Iterate backwards to maintain order
for (StyleSheetHandle sheet : Reversed(thisAsDoc->mOnDemandBuiltInUASheets)) {
for (StyleSheet* sheet : Reversed(thisAsDoc->mOnDemandBuiltInUASheets)) {
if (sheet) {
if (sheet->IsApplicable()) {
// XXXheycam Need to make ServoStyleSheet cloning work.
@ -12009,7 +12009,7 @@ nsDocument::OnAppThemeChanged()
}
for (int32_t i = 0; i < GetNumberOfStyleSheets(); i++) {
StyleSheetHandle::RefPtr sheet = GetStyleSheetAt(i);
RefPtr<StyleSheet> sheet = GetStyleSheetAt(i);
if (!sheet) {
continue;
}
@ -12164,12 +12164,12 @@ nsIDocument::DocAddSizeOfIncludingThis(nsWindowSizes* aWindowSizes) const
}
static size_t
SizeOfOwnedSheetArrayExcludingThis(const nsTArray<StyleSheetHandle::RefPtr>& aSheets,
SizeOfOwnedSheetArrayExcludingThis(const nsTArray<RefPtr<StyleSheet>>& aSheets,
MallocSizeOf aMallocSizeOf)
{
size_t n = 0;
n += aSheets.ShallowSizeOfExcludingThis(aMallocSizeOf);
for (StyleSheetHandle sheet : aSheets) {
for (StyleSheet* sheet : aSheets) {
if (!sheet->GetOwningDocument()) {
// Avoid over-reporting shared sheets.
continue;

View File

@ -621,37 +621,37 @@ public:
virtual Element* FindContentForSubDocument(nsIDocument *aDocument) const override;
virtual Element* GetRootElementInternal() const override;
virtual void EnsureOnDemandBuiltInUASheet(mozilla::StyleSheetHandle aSheet) override;
virtual void EnsureOnDemandBuiltInUASheet(mozilla::StyleSheet* aSheet) override;
/**
* Get the (document) style sheets owned by this document.
* These are ordered, highest priority last
*/
virtual int32_t GetNumberOfStyleSheets() const override;
virtual mozilla::StyleSheetHandle GetStyleSheetAt(int32_t aIndex) const override;
virtual mozilla::StyleSheet* GetStyleSheetAt(int32_t aIndex) const override;
virtual int32_t GetIndexOfStyleSheet(
const mozilla::StyleSheetHandle aSheet) const override;
virtual void AddStyleSheet(mozilla::StyleSheetHandle aSheet) override;
virtual void RemoveStyleSheet(mozilla::StyleSheetHandle aSheet) override;
const mozilla::StyleSheet* aSheet) const override;
virtual void AddStyleSheet(mozilla::StyleSheet* aSheet) override;
virtual void RemoveStyleSheet(mozilla::StyleSheet* aSheet) override;
virtual void UpdateStyleSheets(
nsTArray<mozilla::StyleSheetHandle::RefPtr>& aOldSheets,
nsTArray<mozilla::StyleSheetHandle::RefPtr>& aNewSheets) override;
virtual void AddStyleSheetToStyleSets(mozilla::StyleSheetHandle aSheet);
virtual void RemoveStyleSheetFromStyleSets(mozilla::StyleSheetHandle aSheet);
nsTArray<RefPtr<mozilla::StyleSheet>>& aOldSheets,
nsTArray<RefPtr<mozilla::StyleSheet>>& aNewSheets) override;
virtual void AddStyleSheetToStyleSets(mozilla::StyleSheet* aSheet);
virtual void RemoveStyleSheetFromStyleSets(mozilla::StyleSheet* aSheet);
virtual void InsertStyleSheetAt(mozilla::StyleSheetHandle aSheet,
virtual void InsertStyleSheetAt(mozilla::StyleSheet* aSheet,
int32_t aIndex) override;
virtual void SetStyleSheetApplicableState(mozilla::StyleSheetHandle aSheet,
virtual void SetStyleSheetApplicableState(mozilla::StyleSheet* aSheet,
bool aApplicable) override;
virtual nsresult LoadAdditionalStyleSheet(additionalSheetType aType,
nsIURI* aSheetURI) override;
virtual nsresult AddAdditionalStyleSheet(additionalSheetType aType,
mozilla::StyleSheetHandle aSheet) override;
mozilla::StyleSheet* aSheet) override;
virtual void RemoveAdditionalStyleSheet(additionalSheetType aType,
nsIURI* sheetURI) override;
virtual mozilla::StyleSheetHandle GetFirstAdditionalAuthorSheet() override;
virtual mozilla::StyleSheet* GetFirstAdditionalAuthorSheet() override;
virtual nsIChannel* GetChannel() const override {
return mChannel;
@ -711,11 +711,11 @@ public:
virtual void DocumentStatesChanged(
mozilla::EventStates aStateMask) override;
virtual void StyleRuleChanged(mozilla::StyleSheetHandle aStyleSheet,
virtual void StyleRuleChanged(mozilla::StyleSheet* aStyleSheet,
mozilla::css::Rule* aStyleRule) override;
virtual void StyleRuleAdded(mozilla::StyleSheetHandle aStyleSheet,
virtual void StyleRuleAdded(mozilla::StyleSheet* aStyleSheet,
mozilla::css::Rule* aStyleRule) override;
virtual void StyleRuleRemoved(mozilla::StyleSheetHandle aStyleSheet,
virtual void StyleRuleRemoved(mozilla::StyleSheet* aStyleSheet,
mozilla::css::Rule* aStyleRule) override;
virtual void FlushPendingNotifications(mozFlushType aType) override;
@ -787,7 +787,7 @@ public:
void ReportUseCounters();
private:
void AddOnDemandBuiltInUASheet(mozilla::StyleSheetHandle aSheet);
void AddOnDemandBuiltInUASheet(mozilla::StyleSheet* aSheet);
nsRadioGroupStruct* GetRadioGroupInternal(const nsAString& aName) const;
void SendToConsole(nsCOMArray<nsISecurityConsoleMessage>& aMessages);
@ -970,7 +970,7 @@ public:
const nsAString& aIntegrity) override;
virtual nsresult LoadChromeSheetSync(nsIURI* uri, bool isAgentSheet,
mozilla::StyleSheetHandle::RefPtr* aSheet) override;
RefPtr<mozilla::StyleSheet>* aSheet) override;
virtual nsISupports* GetCurrentContentSink() override;
@ -1288,7 +1288,7 @@ protected:
void RemoveDocStyleSheetsFromStyleSets();
void RemoveStyleSheetsFromStyleSets(
const nsTArray<mozilla::StyleSheetHandle::RefPtr>& aSheets,
const nsTArray<RefPtr<mozilla::StyleSheet>>& aSheets,
mozilla::SheetType aType);
void ResetStylesheetsToURI(nsIURI* aURI);
void FillStyleSet(mozilla::StyleSetHandle aStyleSet);
@ -1342,9 +1342,9 @@ protected:
// EndLoad() has already happened.
nsWeakPtr mWeakSink;
nsTArray<mozilla::StyleSheetHandle::RefPtr> mStyleSheets;
nsTArray<mozilla::StyleSheetHandle::RefPtr> mOnDemandBuiltInUASheets;
nsTArray<mozilla::StyleSheetHandle::RefPtr> mAdditionalSheets[AdditionalSheetTypeCount];
nsTArray<RefPtr<mozilla::StyleSheet>> mStyleSheets;
nsTArray<RefPtr<mozilla::StyleSheet>> mOnDemandBuiltInUASheets;
nsTArray<RefPtr<mozilla::StyleSheet>> mAdditionalSheets[AdditionalSheetTypeCount];
// Array of observers
nsTObserverArray<nsIDocumentObserver*> mObservers;
@ -1498,8 +1498,8 @@ private:
friend class nsUnblockOnloadEvent;
// Recomputes the visibility state but doesn't set the new value.
mozilla::dom::VisibilityState GetVisibilityState() const;
void NotifyStyleSheetAdded(mozilla::StyleSheetHandle aSheet, bool aDocumentSheet);
void NotifyStyleSheetRemoved(mozilla::StyleSheetHandle aSheet, bool aDocumentSheet);
void NotifyStyleSheetAdded(mozilla::StyleSheet* aSheet, bool aDocumentSheet);
void NotifyStyleSheetRemoved(mozilla::StyleSheet* aSheet, bool aDocumentSheet);
void PostUnblockOnloadEvent();
void DoUnblockOnload();

View File

@ -34,7 +34,7 @@
#include "mozilla/UniquePtr.h"
#include "mozilla/CORSMode.h"
#include "mozilla/StyleBackendType.h"
#include "mozilla/StyleSheetHandle.h"
#include "mozilla/StyleSheet.h"
#include <bitset> // for member
#ifdef MOZILLA_INTERNAL_API
@ -997,7 +997,7 @@ public:
* TODO We can get rid of the whole concept of delayed loading if we fix
* bug 77999.
*/
virtual void EnsureOnDemandBuiltInUASheet(mozilla::StyleSheetHandle aSheet) = 0;
virtual void EnsureOnDemandBuiltInUASheet(mozilla::StyleSheet* aSheet) = 0;
/**
* Get the number of (document) stylesheets
@ -1013,7 +1013,7 @@ public:
* @return the stylesheet at aIndex. Null if aIndex is out of range.
* @throws no exceptions
*/
virtual mozilla::StyleSheetHandle GetStyleSheetAt(int32_t aIndex) const = 0;
virtual mozilla::StyleSheet* GetStyleSheetAt(int32_t aIndex) const = 0;
/**
* Insert a sheet at a particular spot in the stylesheet list (zero-based)
@ -1022,7 +1022,7 @@ public:
* adjusted for the "special" sheets.
* @throws no exceptions
*/
virtual void InsertStyleSheetAt(mozilla::StyleSheetHandle aSheet,
virtual void InsertStyleSheetAt(mozilla::StyleSheet* aSheet,
int32_t aIndex) = 0;
/**
@ -1032,7 +1032,7 @@ public:
* @return aIndex the index of the sheet in the full list
*/
virtual int32_t GetIndexOfStyleSheet(
const mozilla::StyleSheetHandle aSheet) const = 0;
const mozilla::StyleSheet* aSheet) const = 0;
/**
* Replace the stylesheets in aOldSheets with the stylesheets in
@ -1043,24 +1043,24 @@ public:
* will simply be removed.
*/
virtual void UpdateStyleSheets(
nsTArray<mozilla::StyleSheetHandle::RefPtr>& aOldSheets,
nsTArray<mozilla::StyleSheetHandle::RefPtr>& aNewSheets) = 0;
nsTArray<RefPtr<mozilla::StyleSheet>>& aOldSheets,
nsTArray<RefPtr<mozilla::StyleSheet>>& aNewSheets) = 0;
/**
* Add a stylesheet to the document
*/
virtual void AddStyleSheet(mozilla::StyleSheetHandle aSheet) = 0;
virtual void AddStyleSheet(mozilla::StyleSheet* aSheet) = 0;
/**
* Remove a stylesheet from the document
*/
virtual void RemoveStyleSheet(mozilla::StyleSheetHandle aSheet) = 0;
virtual void RemoveStyleSheet(mozilla::StyleSheet* aSheet) = 0;
/**
* Notify the document that the applicable state of the sheet changed
* and that observers should be notified and style sets updated
*/
virtual void SetStyleSheetApplicableState(mozilla::StyleSheetHandle aSheet,
virtual void SetStyleSheetApplicableState(mozilla::StyleSheet* aSheet,
bool aApplicable) = 0;
enum additionalSheetType {
@ -1073,10 +1073,10 @@ public:
virtual nsresult LoadAdditionalStyleSheet(additionalSheetType aType,
nsIURI* aSheetURI) = 0;
virtual nsresult AddAdditionalStyleSheet(additionalSheetType aType,
mozilla::StyleSheetHandle aSheet) = 0;
mozilla::StyleSheet* aSheet) = 0;
virtual void RemoveAdditionalStyleSheet(additionalSheetType aType,
nsIURI* sheetURI) = 0;
virtual mozilla::StyleSheetHandle GetFirstAdditionalAuthorSheet() = 0;
virtual mozilla::StyleSheet* GetFirstAdditionalAuthorSheet() = 0;
/**
* Assuming that aDocSheets is an array of document-level style
@ -1397,11 +1397,11 @@ public:
// Observation hooks for style data to propagate notifications
// to document observers
virtual void StyleRuleChanged(mozilla::StyleSheetHandle aStyleSheet,
virtual void StyleRuleChanged(mozilla::StyleSheet* aStyleSheet,
mozilla::css::Rule* aStyleRule) = 0;
virtual void StyleRuleAdded(mozilla::StyleSheetHandle aStyleSheet,
virtual void StyleRuleAdded(mozilla::StyleSheet* aStyleSheet,
mozilla::css::Rule* aStyleRule) = 0;
virtual void StyleRuleRemoved(mozilla::StyleSheetHandle aStyleSheet,
virtual void StyleRuleRemoved(mozilla::StyleSheet* aStyleSheet,
mozilla::css::Rule* aStyleRule) = 0;
/**
@ -2209,7 +2209,7 @@ public:
* DO NOT USE FOR UNTRUSTED CONTENT.
*/
virtual nsresult LoadChromeSheetSync(nsIURI* aURI, bool aIsAgentSheet,
mozilla::StyleSheetHandle::RefPtr* aSheet) = 0;
RefPtr<mozilla::StyleSheet>* aSheet) = 0;
/**
* Returns true if the locale used for the document specifies a direction of

View File

@ -35,7 +35,7 @@ nsIDocument::FindDocStyleSheetInsertionPoint(
if (sheetDocIndex > newDocIndex)
break;
mozilla::StyleSheetHandle sheetHandle = sheet;
mozilla::StyleSheet* sheetHandle = sheet;
// If the sheet is not owned by the document it can be an author
// sheet registered at nsStyleSheetService or an additional author

View File

@ -7,7 +7,7 @@
#define nsIDocumentObserver_h___
#include "mozilla/EventStates.h"
#include "mozilla/StyleSheetHandle.h"
#include "mozilla/StyleSheet.h"
#include "nsISupports.h"
#include "nsIMutationObserver.h"
@ -100,7 +100,7 @@ public:
* @param aDocumentSheet True if sheet is in document's style sheet list,
* false if sheet is not (i.e., UA or user sheet)
*/
virtual void StyleSheetAdded(mozilla::StyleSheetHandle aStyleSheet,
virtual void StyleSheetAdded(mozilla::StyleSheet* aStyleSheet,
bool aDocumentSheet) = 0;
/**
@ -113,7 +113,7 @@ public:
* @param aDocumentSheet True if sheet is in document's style sheet list,
* false if sheet is not (i.e., UA or user sheet)
*/
virtual void StyleSheetRemoved(mozilla::StyleSheetHandle aStyleSheet,
virtual void StyleSheetRemoved(mozilla::StyleSheet* aStyleSheet,
bool aDocumentSheet) = 0;
/**
@ -125,7 +125,7 @@ public:
*
* @param aStyleSheet the StyleSheet that has changed state
*/
virtual void StyleSheetApplicableStateChanged(mozilla::StyleSheetHandle aStyleSheet) = 0;
virtual void StyleSheetApplicableStateChanged(mozilla::StyleSheet* aStyleSheet) = 0;
/**
* A StyleRule has just been modified within a style sheet.
@ -136,7 +136,7 @@ public:
*
* @param aStyleSheet the StyleSheet that contians the rule
*/
virtual void StyleRuleChanged(mozilla::StyleSheetHandle aStyleSheet) = 0;
virtual void StyleRuleChanged(mozilla::StyleSheet* aStyleSheet) = 0;
/**
* A StyleRule has just been added to a style sheet.
@ -147,7 +147,7 @@ public:
*
* @param aStyleSheet the StyleSheet that has been modified
*/
virtual void StyleRuleAdded(mozilla::StyleSheetHandle aStyleSheet) = 0;
virtual void StyleRuleAdded(mozilla::StyleSheet* aStyleSheet) = 0;
/**
* A StyleRule has just been removed from a style sheet.
@ -158,7 +158,7 @@ public:
*
* @param aStyleSheet the StyleSheet that has been modified
*/
virtual void StyleRuleRemoved(mozilla::StyleSheetHandle aStyleSheet) = 0;
virtual void StyleRuleRemoved(mozilla::StyleSheet* aStyleSheet) = 0;
};
NS_DEFINE_STATIC_IID_ACCESSOR(nsIDocumentObserver, NS_IDOCUMENT_OBSERVER_IID)
@ -186,25 +186,25 @@ NS_DEFINE_STATIC_IID_ACCESSOR(nsIDocumentObserver, NS_IDOCUMENT_OBSERVER_IID)
mozilla::EventStates aStateMask) override;
#define NS_DECL_NSIDOCUMENTOBSERVER_STYLESHEETADDED \
virtual void StyleSheetAdded(mozilla::StyleSheetHandle aStyleSheet, \
virtual void StyleSheetAdded(mozilla::StyleSheet* aStyleSheet, \
bool aDocumentSheet) override;
#define NS_DECL_NSIDOCUMENTOBSERVER_STYLESHEETREMOVED \
virtual void StyleSheetRemoved(mozilla::StyleSheetHandle aStyleSheet, \
virtual void StyleSheetRemoved(mozilla::StyleSheet* aStyleSheet, \
bool aDocumentSheet) override;
#define NS_DECL_NSIDOCUMENTOBSERVER_STYLESHEETAPPLICABLESTATECHANGED \
virtual void StyleSheetApplicableStateChanged( \
mozilla::StyleSheetHandle aStyleSheet) override;
mozilla::StyleSheet* aStyleSheet) override;
#define NS_DECL_NSIDOCUMENTOBSERVER_STYLERULECHANGED \
virtual void StyleRuleChanged(mozilla::StyleSheetHandle aStyleSheet) override;
virtual void StyleRuleChanged(mozilla::StyleSheet* aStyleSheet) override;
#define NS_DECL_NSIDOCUMENTOBSERVER_STYLERULEADDED \
virtual void StyleRuleAdded(mozilla::StyleSheetHandle aStyleSheet) override;
virtual void StyleRuleAdded(mozilla::StyleSheet* aStyleSheet) override;
#define NS_DECL_NSIDOCUMENTOBSERVER_STYLERULEREMOVED \
virtual void StyleRuleRemoved(mozilla::StyleSheetHandle aStyleSheet) override;
virtual void StyleRuleRemoved(mozilla::StyleSheet* aStyleSheet) override;
#define NS_DECL_NSIDOCUMENTOBSERVER \
NS_DECL_NSIDOCUMENTOBSERVER_BEGINUPDATE \
@ -262,29 +262,29 @@ NS_IMPL_NSIMUTATIONOBSERVER_CONTENT(_class)
#define NS_IMPL_NSIDOCUMENTOBSERVER_STYLE_STUB(_class) \
void \
_class::StyleSheetAdded(mozilla::StyleSheetHandle aStyleSheet, \
_class::StyleSheetAdded(mozilla::StyleSheet* aStyleSheet, \
bool aDocumentSheet) \
{ \
} \
void \
_class::StyleSheetRemoved(mozilla::StyleSheetHandle aStyleSheet, \
_class::StyleSheetRemoved(mozilla::StyleSheet* aStyleSheet, \
bool aDocumentSheet) \
{ \
} \
void \
_class::StyleSheetApplicableStateChanged(mozilla::StyleSheetHandle aStyleSheet) \
_class::StyleSheetApplicableStateChanged(mozilla::StyleSheet* aStyleSheet)\
{ \
} \
void \
_class::StyleRuleChanged(mozilla::StyleSheetHandle aStyleSheet) \
_class::StyleRuleChanged(mozilla::StyleSheet* aStyleSheet) \
{ \
} \
void \
_class::StyleRuleAdded(mozilla::StyleSheetHandle aStyleSheet) \
_class::StyleRuleAdded(mozilla::StyleSheet* aStyleSheet) \
{ \
} \
void \
_class::StyleRuleRemoved(mozilla::StyleSheetHandle aStyleSheet) \
_class::StyleRuleRemoved(mozilla::StyleSheet* aStyleSheet) \
{ \
}

View File

@ -8,7 +8,7 @@
#include "nsISupports.h"
#include "mozilla/StyleSheetHandle.h"
#include "mozilla/StyleSheet.h"
class nsICSSLoaderObserver;
class nsIURI;
@ -28,14 +28,14 @@ public:
* @param aStyleSheet the style sheet associated with this
* element.
*/
NS_IMETHOD SetStyleSheet(mozilla::StyleSheetHandle aStyleSheet) = 0;
NS_IMETHOD SetStyleSheet(mozilla::StyleSheet* aStyleSheet) = 0;
/**
* Used to obtain the style sheet linked in by this element.
*
* @return the style sheet associated with this element.
*/
NS_IMETHOD_(mozilla::StyleSheetHandle) GetStyleSheet() = 0;
NS_IMETHOD_(mozilla::StyleSheet*) GetStyleSheet() = 0;
/**
* Initialize the stylesheet linking element. If aDontLoadStyle is

View File

@ -12,8 +12,8 @@
#include "nsStyleLinkElement.h"
#include "mozilla/StyleSheetHandle.h"
#include "mozilla/StyleSheetHandleInlines.h"
#include "mozilla/StyleSheet.h"
#include "mozilla/StyleSheetInlines.h"
#include "mozilla/css/Loader.h"
#include "mozilla/dom/Element.h"
#include "mozilla/dom/FragmentOrElement.h"
@ -63,7 +63,7 @@ nsStyleLinkElement::Traverse(nsCycleCollectionTraversalCallback &cb)
}
NS_IMETHODIMP
nsStyleLinkElement::SetStyleSheet(StyleSheetHandle aStyleSheet)
nsStyleLinkElement::SetStyleSheet(StyleSheet* aStyleSheet)
{
if (mStyleSheet) {
mStyleSheet->SetOwningNode(nullptr);
@ -80,7 +80,7 @@ nsStyleLinkElement::SetStyleSheet(StyleSheetHandle aStyleSheet)
return NS_OK;
}
NS_IMETHODIMP_(StyleSheetHandle)
NS_IMETHODIMP_(StyleSheet*)
nsStyleLinkElement::GetStyleSheet()
{
return mStyleSheet;

View File

@ -15,7 +15,7 @@
#include "mozilla/Attributes.h"
#include "mozilla/CORSMode.h"
#include "mozilla/CSSStyleSheet.h"
#include "mozilla/StyleSheetInlines.h"
#include "mozilla/net/ReferrerPolicy.h"
#include "nsCOMPtr.h"
#include "nsIStyleSheetLinkingElement.h"
@ -50,8 +50,8 @@ public:
}
// nsIStyleSheetLinkingElement
NS_IMETHOD SetStyleSheet(mozilla::StyleSheetHandle aStyleSheet) override;
NS_IMETHOD_(mozilla::StyleSheetHandle) GetStyleSheet() override;
NS_IMETHOD SetStyleSheet(mozilla::StyleSheet* aStyleSheet) override;
NS_IMETHOD_(mozilla::StyleSheet*) GetStyleSheet() override;
NS_IMETHOD InitStyleLinkElement(bool aDontLoadStyle) override;
NS_IMETHOD UpdateStyleSheet(nsICSSLoaderObserver* aObserver,
bool* aWillNotify,
@ -143,7 +143,7 @@ private:
bool* aIsAlternate,
bool aForceUpdate);
mozilla::StyleSheetHandle::RefPtr mStyleSheet;
RefPtr<mozilla::StyleSheet> mStyleSheet;
protected:
bool mDontLoadStyle;
bool mUpdatesEnabled;

View File

@ -7,7 +7,7 @@
#include "nsTreeSanitizer.h"
#include "mozilla/ArrayUtils.h"
#include "mozilla/CSSStyleSheet.h"
#include "mozilla/StyleSheetInlines.h"
#include "mozilla/css/Declaration.h"
#include "mozilla/css/StyleRule.h"
#include "mozilla/css/Rule.h"

View File

@ -12,7 +12,7 @@
#include "nsIStreamListener.h"
#include "nsIThreadRetargetableStreamListener.h"
#include "mozilla/ConsoleReportCollector.h"
#include "mozilla/dom/SRICheck.h"
#include "mozilla/dom/SRIMetadata.h"
#include "mozilla/RefPtr.h"
#include "mozilla/DebugOnly.h"

View File

@ -114,8 +114,8 @@
#include "nsIFrame.h"
#include "nsIContent.h"
#include "nsLayoutStylesheetCache.h"
#include "mozilla/StyleSheetHandle.h"
#include "mozilla/StyleSheetHandleInlines.h"
#include "mozilla/StyleSheet.h"
#include "mozilla/StyleSheetInlines.h"
using namespace mozilla;
using namespace mozilla::dom;
@ -2550,7 +2550,7 @@ nsHTMLDocument::TearingDownEditor(nsIEditor *aEditor)
if (!presShell)
return;
nsTArray<StyleSheetHandle::RefPtr> agentSheets;
nsTArray<RefPtr<StyleSheet>> agentSheets;
presShell->GetAgentStyleSheets(agentSheets);
auto cache = nsLayoutStylesheetCache::For(GetStyleBackendType());
@ -2693,13 +2693,13 @@ nsHTMLDocument::EditingStateChanged()
// Before making this window editable, we need to modify UA style sheet
// because new style may change whether focused element will be focusable
// or not.
nsTArray<StyleSheetHandle::RefPtr> agentSheets;
nsTArray<RefPtr<StyleSheet>> agentSheets;
rv = presShell->GetAgentStyleSheets(agentSheets);
NS_ENSURE_SUCCESS(rv, rv);
auto cache = nsLayoutStylesheetCache::For(GetStyleBackendType());
StyleSheetHandle contentEditableSheet = cache->ContentEditableSheet();
StyleSheet* contentEditableSheet = cache->ContentEditableSheet();
if (!agentSheets.Contains(contentEditableSheet)) {
agentSheets.AppendElement(contentEditableSheet);
@ -2710,7 +2710,7 @@ nsHTMLDocument::EditingStateChanged()
// specific states on the elements.
if (designMode) {
// designMode is being turned on (overrides contentEditable).
StyleSheetHandle designModeSheet = cache->DesignModeSheet();
StyleSheet* designModeSheet = cache->DesignModeSheet();
if (!agentSheets.Contains(designModeSheet)) {
agentSheets.AppendElement(designModeSheet);
}

View File

@ -35,7 +35,7 @@
#include "imgIContainer.h"
#include "mozIApplication.h"
#include "mozilla/ClearOnShutdown.h"
#include "mozilla/CSSStyleSheet.h"
#include "mozilla/StyleSheetInlines.h"
#include "mozilla/DataStorage.h"
#include "mozilla/devtools/HeapSnapshotTempFileHelperParent.h"
#include "mozilla/docshell/OfflineCacheUpdateParent.h"
@ -187,8 +187,8 @@
#include "nsPluginHost.h"
#include "nsPluginTags.h"
#include "nsIBlocklistService.h"
#include "mozilla/StyleSheetHandle.h"
#include "mozilla/StyleSheetHandleInlines.h"
#include "mozilla/StyleSheet.h"
#include "mozilla/StyleSheetInlines.h"
#include "nsHostObjectProtocolHandler.h"
#include "nsIBidiKeyboard.h"
@ -2267,19 +2267,19 @@ ContentParent::InitInternal(ProcessPriority aInitialPriority,
// This looks like a lot of work, but in a normal browser session we just
// send two loads.
for (StyleSheetHandle sheet : *sheetService->AgentStyleSheets()) {
for (StyleSheet* sheet : *sheetService->AgentStyleSheets()) {
URIParams uri;
SerializeURI(sheet->GetSheetURI(), uri);
Unused << SendLoadAndRegisterSheet(uri, nsIStyleSheetService::AGENT_SHEET);
}
for (StyleSheetHandle sheet : *sheetService->UserStyleSheets()) {
for (StyleSheet* sheet : *sheetService->UserStyleSheets()) {
URIParams uri;
SerializeURI(sheet->GetSheetURI(), uri);
Unused << SendLoadAndRegisterSheet(uri, nsIStyleSheetService::USER_SHEET);
}
for (StyleSheetHandle sheet : *sheetService->AuthorStyleSheets()) {
for (StyleSheet* sheet : *sheetService->AuthorStyleSheets()) {
URIParams uri;
SerializeURI(sheet->GetSheetURI(), uri);
Unused << SendLoadAndRegisterSheet(uri, nsIStyleSheetService::AUTHOR_SHEET);

View File

@ -52,9 +52,9 @@ VideoDecoderManagerChild::Initialize()
return;
}
// TODO: The above message should return an empty endpoint if there wasn't a GPU
// process. Unfortunately IPDL will assert in this case, so it can't actually
// happen. Bug 1302009 is filed for fixing this.
if (!endpoint.IsValid()) {
return;
}
sDecoderManager = new VideoDecoderManagerChild();

View File

@ -11,6 +11,7 @@
#include "mozilla/Logging.h"
#include "mozilla/Preferences.h"
#include "mozilla/dom/SRILogHelper.h"
#include "mozilla/dom/SRIMetadata.h"
#include "nsContentUtils.h"
#include "nsIChannel.h"
#include "nsIConsoleReportCollector.h"

View File

@ -9,7 +9,6 @@
#include "nsCOMPtr.h"
#include "nsICryptoHash.h"
#include "SRIMetadata.h"
class nsIChannel;
class nsIUnicharStreamLoader;
@ -18,6 +17,8 @@ class nsIConsoleReportCollector;
namespace mozilla {
namespace dom {
class SRIMetadata;
class SRICheck final
{
public:

View File

@ -20,8 +20,8 @@
#include "mozilla/dom/Element.h"
#include "nsSVGElement.h"
#include "mozilla/dom/SVGDocumentBinding.h"
#include "mozilla/StyleSheetHandle.h"
#include "mozilla/StyleSheetHandleInlines.h"
#include "mozilla/StyleSheet.h"
#include "mozilla/StyleSheetInlines.h"
using namespace mozilla::css;
using namespace mozilla::dom;
@ -157,7 +157,7 @@ SVGDocument::EnsureNonSVGUserAgentStyleSheetsLoaded()
nsCOMPtr<nsIURI> uri;
NS_NewURI(getter_AddRefs(uri), spec);
if (uri) {
StyleSheetHandle::RefPtr sheet;
RefPtr<StyleSheet> sheet;
cssLoader->LoadSheetSync(uri,
mozilla::css::eAgentSheetFeatures,
true, &sheet);
@ -173,7 +173,7 @@ SVGDocument::EnsureNonSVGUserAgentStyleSheetsLoaded()
auto cache = nsLayoutStylesheetCache::For(GetStyleBackendType());
StyleSheetHandle sheet = cache->NumberControlSheet();
StyleSheet* sheet = cache->NumberControlSheet();
if (sheet) {
// number-control.css can be behind a pref
EnsureOnDemandBuiltInUASheet(sheet);

View File

@ -770,7 +770,7 @@ nsBindingManager::MediumFeaturesChanged(nsPresContext* aPresContext,
}
void
nsBindingManager::AppendAllSheets(nsTArray<StyleSheetHandle>& aArray)
nsBindingManager::AppendAllSheets(nsTArray<StyleSheet*>& aArray)
{
if (!mBoundContentSet) {
return;

View File

@ -18,7 +18,7 @@
#include "nsXBLBinding.h"
#include "nsTArray.h"
#include "nsThreadUtils.h"
#include "mozilla/StyleSheetHandle.h"
#include "mozilla/StyleSheet.h"
struct ElementDependentRuleProcessorData;
class nsIXPConnectWrappedJS;
@ -138,7 +138,7 @@ public:
nsresult MediumFeaturesChanged(nsPresContext* aPresContext,
bool* aRulesChanged);
void AppendAllSheets(nsTArray<mozilla::StyleSheetHandle>& aArray);
void AppendAllSheets(nsTArray<mozilla::StyleSheet*>& aArray);
void Traverse(nsIContent *aContent,
nsCycleCollectionTraversalCallback &cb);

View File

@ -44,8 +44,8 @@
#include "mozilla/dom/CDATASection.h"
#include "mozilla/dom/Comment.h"
#include "mozilla/dom/Element.h"
#include "mozilla/StyleSheetHandle.h"
#include "mozilla/StyleSheetHandleInlines.h"
#include "mozilla/StyleSheet.h"
#include "mozilla/StyleSheetInlines.h"
#ifdef MOZ_XUL
#include "nsXULElement.h"
@ -1644,14 +1644,14 @@ nsXBLPrototypeBinding::EnsureResources()
}
void
nsXBLPrototypeBinding::AppendStyleSheet(StyleSheetHandle aSheet)
nsXBLPrototypeBinding::AppendStyleSheet(StyleSheet* aSheet)
{
EnsureResources();
mResources->AppendStyleSheet(aSheet);
}
void
nsXBLPrototypeBinding::RemoveStyleSheet(StyleSheetHandle aSheet)
nsXBLPrototypeBinding::RemoveStyleSheet(StyleSheet* aSheet)
{
if (!mResources) {
MOZ_ASSERT(false, "Trying to remove a sheet that does not exist.");
@ -1661,13 +1661,13 @@ nsXBLPrototypeBinding::RemoveStyleSheet(StyleSheetHandle aSheet)
mResources->RemoveStyleSheet(aSheet);
}
void
nsXBLPrototypeBinding::InsertStyleSheetAt(size_t aIndex, StyleSheetHandle aSheet)
nsXBLPrototypeBinding::InsertStyleSheetAt(size_t aIndex, StyleSheet* aSheet)
{
EnsureResources();
mResources->InsertStyleSheetAt(aIndex, aSheet);
}
StyleSheetHandle
StyleSheet*
nsXBLPrototypeBinding::StyleSheetAt(size_t aIndex) const
{
MOZ_ASSERT(mResources);
@ -1688,7 +1688,7 @@ nsXBLPrototypeBinding::HasStyleSheets() const
void
nsXBLPrototypeBinding::AppendStyleSheetsTo(
nsTArray<StyleSheetHandle>& aResult) const
nsTArray<StyleSheet*>& aResult) const
{
if (mResources) {
mResources->AppendStyleSheetsTo(aResult);

View File

@ -20,7 +20,7 @@
#include "nsXBLPrototypeHandler.h"
#include "nsXBLPrototypeResources.h"
#include "mozilla/WeakPtr.h"
#include "mozilla/StyleSheetHandle.h"
#include "mozilla/StyleSheet.h"
class nsIAtom;
class nsIContent;
@ -120,13 +120,13 @@ public:
void SetInitialAttributes(nsIContent* aBoundElement, nsIContent* aAnonymousContent);
void AppendStyleSheet(mozilla::StyleSheetHandle aSheet);
void RemoveStyleSheet(mozilla::StyleSheetHandle aSheet);
void InsertStyleSheetAt(size_t aIndex, mozilla::StyleSheetHandle aSheet);
mozilla::StyleSheetHandle StyleSheetAt(size_t aIndex) const;
void AppendStyleSheet(mozilla::StyleSheet* aSheet);
void RemoveStyleSheet(mozilla::StyleSheet* aSheet);
void InsertStyleSheetAt(size_t aIndex, mozilla::StyleSheet* aSheet);
mozilla::StyleSheet* StyleSheetAt(size_t aIndex) const;
size_t SheetCount() const;
bool HasStyleSheets() const;
void AppendStyleSheetsTo(nsTArray<mozilla::StyleSheetHandle>& aResult) const;
void AppendStyleSheetsTo(nsTArray<mozilla::StyleSheet*>& aResult) const;
nsIStyleRuleProcessor* GetRuleProcessor();

View File

@ -19,8 +19,8 @@
#include "nsStyleSet.h"
#include "mozilla/dom/URL.h"
#include "mozilla/DebugOnly.h"
#include "mozilla/StyleSheetHandle.h"
#include "mozilla/StyleSheetHandleInlines.h"
#include "mozilla/StyleSheet.h"
#include "mozilla/StyleSheetInlines.h"
using namespace mozilla;
using mozilla::dom::IsChromeURI;
@ -84,18 +84,18 @@ nsXBLPrototypeResources::FlushSkinSheets()
// skin sheets can't be, and which in any case don't have a usable
// URL to reload.)
nsTArray<StyleSheetHandle::RefPtr> oldSheets;
nsTArray<RefPtr<StyleSheet>> oldSheets;
oldSheets.SwapElements(mStyleSheetList);
mozilla::css::Loader* cssLoader = doc->CSSLoader();
for (size_t i = 0, count = oldSheets.Length(); i < count; ++i) {
StyleSheetHandle oldSheet = oldSheets[i];
StyleSheet* oldSheet = oldSheets[i];
nsIURI* uri = oldSheet->GetSheetURI();
StyleSheetHandle::RefPtr newSheet;
RefPtr<StyleSheet> newSheet;
if (!oldSheet->IsInline() && IsChromeURI(uri)) {
if (NS_FAILED(cssLoader->LoadSheetSync(uri, &newSheet)))
continue;
@ -147,7 +147,7 @@ void
nsXBLPrototypeResources::GatherRuleProcessor()
{
nsTArray<RefPtr<CSSStyleSheet>> sheets(mStyleSheetList.Length());
for (StyleSheetHandle sheet : mStyleSheetList) {
for (StyleSheet* sheet : mStyleSheetList) {
MOZ_ASSERT(sheet->IsGecko(),
"GatherRuleProcessor must only be called for "
"nsXBLPrototypeResources objects with Gecko-flavored style "
@ -161,24 +161,24 @@ nsXBLPrototypeResources::GatherRuleProcessor()
}
void
nsXBLPrototypeResources::AppendStyleSheet(StyleSheetHandle aSheet)
nsXBLPrototypeResources::AppendStyleSheet(StyleSheet* aSheet)
{
mStyleSheetList.AppendElement(aSheet);
}
void
nsXBLPrototypeResources::RemoveStyleSheet(StyleSheetHandle aSheet)
nsXBLPrototypeResources::RemoveStyleSheet(StyleSheet* aSheet)
{
mStyleSheetList.RemoveElement(aSheet);
}
void
nsXBLPrototypeResources::InsertStyleSheetAt(size_t aIndex, StyleSheetHandle aSheet)
nsXBLPrototypeResources::InsertStyleSheetAt(size_t aIndex, StyleSheet* aSheet)
{
mStyleSheetList.InsertElementAt(aIndex, aSheet);
}
StyleSheetHandle
StyleSheet*
nsXBLPrototypeResources::StyleSheetAt(size_t aIndex) const
{
return mStyleSheetList[aIndex];
@ -198,7 +198,7 @@ nsXBLPrototypeResources::HasStyleSheets() const
void
nsXBLPrototypeResources::AppendStyleSheetsTo(
nsTArray<StyleSheetHandle>& aResult) const
nsTArray<StyleSheet*>& aResult) const
{
aResult.AppendElements(mStyleSheetList);
}

View File

@ -7,7 +7,7 @@
#ifndef nsXBLPrototypeResources_h__
#define nsXBLPrototypeResources_h__
#include "mozilla/StyleSheetHandle.h"
#include "mozilla/StyleSheet.h"
#include "nsICSSLoaderObserver.h"
class nsCSSRuleProcessor;
@ -41,13 +41,13 @@ public:
void ClearLoader();
void AppendStyleSheet(mozilla::StyleSheetHandle aSheet);
void RemoveStyleSheet(mozilla::StyleSheetHandle aSheet);
void InsertStyleSheetAt(size_t aIndex, mozilla::StyleSheetHandle aSheet);
mozilla::StyleSheetHandle StyleSheetAt(size_t aIndex) const;
void AppendStyleSheet(mozilla::StyleSheet* aSheet);
void RemoveStyleSheet(mozilla::StyleSheet* aSheet);
void InsertStyleSheetAt(size_t aIndex, mozilla::StyleSheet* aSheet);
mozilla::StyleSheet* StyleSheetAt(size_t aIndex) const;
size_t SheetCount() const;
bool HasStyleSheets() const;
void AppendStyleSheetsTo(nsTArray<mozilla::StyleSheetHandle>& aResult) const;
void AppendStyleSheetsTo(nsTArray<mozilla::StyleSheet*>& aResult) const;
/**
* Recreates mRuleProcessor to represent the current list of style sheets
@ -63,7 +63,7 @@ private:
RefPtr<nsXBLResourceLoader> mLoader;
// A list of loaded stylesheets for this binding.
nsTArray<mozilla::StyleSheetHandle::RefPtr> mStyleSheetList;
nsTArray<RefPtr<mozilla::StyleSheet>> mStyleSheetList;
// The list of stylesheets converted to a rule processor.
RefPtr<nsCSSRuleProcessor> mRuleProcessor;

View File

@ -17,8 +17,8 @@
#include "nsIDocumentObserver.h"
#include "imgILoader.h"
#include "imgRequestProxy.h"
#include "mozilla/StyleSheetHandle.h"
#include "mozilla/StyleSheetHandleInlines.h"
#include "mozilla/StyleSheet.h"
#include "mozilla/StyleSheetInlines.h"
#include "mozilla/css/Loader.h"
#include "nsIURI.h"
#include "nsNetUtil.h"
@ -135,7 +135,7 @@ nsXBLResourceLoader::LoadResources(bool* aResult)
CheckLoadURIWithPrincipal(docPrincipal, url,
nsIScriptSecurityManager::ALLOW_CHROME);
if (NS_SUCCEEDED(rv)) {
StyleSheetHandle::RefPtr sheet;
RefPtr<StyleSheet> sheet;
rv = cssLoader->LoadSheetSync(url, &sheet);
NS_ASSERTION(NS_SUCCEEDED(rv), "Load failed!!!");
if (NS_SUCCEEDED(rv))
@ -164,7 +164,7 @@ nsXBLResourceLoader::LoadResources(bool* aResult)
// nsICSSLoaderObserver
NS_IMETHODIMP
nsXBLResourceLoader::StyleSheetLoaded(StyleSheetHandle aSheet,
nsXBLResourceLoader::StyleSheetLoaded(StyleSheet* aSheet,
bool aWasAlternate,
nsresult aStatus)
{

View File

@ -30,7 +30,7 @@ public:
NS_DECL_CYCLE_COLLECTION_CLASS(nsXBLResourceLoader)
// nsICSSLoaderObserver
NS_IMETHOD StyleSheetLoaded(mozilla::StyleSheetHandle aSheet,
NS_IMETHOD StyleSheetLoaded(mozilla::StyleSheet* aSheet,
bool aWasAlternate,
nsresult aStatus) override;

View File

@ -20,7 +20,7 @@
#include "DocumentType.h"
#include "nsHTMLParts.h"
#include "nsCRT.h"
#include "mozilla/CSSStyleSheet.h"
#include "mozilla/StyleSheetInlines.h"
#include "mozilla/css/Loader.h"
#include "nsGkAtoms.h"
#include "nsContentUtils.h"
@ -411,7 +411,7 @@ nsXMLContentSink::OnTransformDone(nsresult aResult,
}
NS_IMETHODIMP
nsXMLContentSink::StyleSheetLoaded(StyleSheetHandle aSheet,
nsXMLContentSink::StyleSheetLoaded(StyleSheet* aSheet,
bool aWasAlternate,
nsresult aStatus)
{

View File

@ -82,7 +82,7 @@ public:
NS_IMETHOD OnTransformDone(nsresult aResult, nsIDocument *aResultDocument) override;
// nsICSSLoaderObserver
NS_IMETHOD StyleSheetLoaded(mozilla::StyleSheetHandle aSheet,
NS_IMETHOD StyleSheetLoaded(mozilla::StyleSheet* aSheet,
bool aWasAlternate,
nsresult aStatus) override;
static bool ParsePIData(const nsString &aData, nsString &aHref,

View File

@ -27,7 +27,7 @@
#include "nsIHTMLDocument.h"
#include "nsIStyleSheetLinkingElement.h"
#include "nsIDocumentTransformer.h"
#include "mozilla/CSSStyleSheet.h"
#include "mozilla/StyleSheetInlines.h"
#include "mozilla/css/Loader.h"
#include "mozilla/dom/Element.h"
#include "mozilla/dom/EncodingUtils.h"
@ -976,7 +976,7 @@ txTransformNotifier::ScriptEvaluated(nsresult aResult,
}
NS_IMETHODIMP
txTransformNotifier::StyleSheetLoaded(StyleSheetHandle aSheet,
txTransformNotifier::StyleSheetLoaded(StyleSheet* aSheet,
bool aWasAlternate,
nsresult aStatus)
{

View File

@ -35,7 +35,7 @@ public:
NS_DECL_NSISCRIPTLOADEROBSERVER
// nsICSSLoaderObserver
NS_IMETHOD StyleSheetLoaded(mozilla::StyleSheetHandle aSheet,
NS_IMETHOD StyleSheetLoaded(mozilla::StyleSheet* aSheet,
bool aWasAlternate,
nsresult aStatus) override;

View File

@ -67,7 +67,7 @@
#include "nsIParser.h"
#include "nsCharsetSource.h"
#include "nsIParserService.h"
#include "mozilla/CSSStyleSheet.h"
#include "mozilla/StyleSheetInlines.h"
#include "mozilla/css/Loader.h"
#include "nsIScriptError.h"
#include "nsIStyleSheetLinkingElement.h"
@ -94,8 +94,8 @@
#include "nsIContentPolicy.h"
#include "mozAutoDocUpdate.h"
#include "xpcpublic.h"
#include "mozilla/StyleSheetHandle.h"
#include "mozilla/StyleSheetHandleInlines.h"
#include "mozilla/StyleSheet.h"
#include "mozilla/StyleSheetInlines.h"
using namespace mozilla;
using namespace mozilla::dom;
@ -3106,7 +3106,7 @@ XULDocument::DoneWalking()
}
NS_IMETHODIMP
XULDocument::StyleSheetLoaded(StyleSheetHandle aSheet,
XULDocument::StyleSheetLoaded(StyleSheet* aSheet,
bool aWasAlternate,
nsresult aStatus)
{
@ -3730,7 +3730,7 @@ XULDocument::AddPrototypeSheets()
for (int32_t i = 0; i < sheets.Count(); i++) {
nsCOMPtr<nsIURI> uri = sheets[i];
StyleSheetHandle::RefPtr incompleteSheet;
RefPtr<StyleSheet> incompleteSheet;
rv = CSSLoader()->LoadSheet(uri,
mCurrentPrototype->DocumentPrincipal(),
EmptyCString(), this,

View File

@ -13,7 +13,7 @@
#include "nsTArray.h"
#include "mozilla/dom/XMLDocument.h"
#include "mozilla/StyleSheetHandle.h"
#include "mozilla/StyleSheet.h"
#include "nsForwardReference.h"
#include "nsIContent.h"
#include "nsIDOMXULCommandDispatcher.h"
@ -163,7 +163,7 @@ public:
NS_DECL_NSIDOMXULDOCUMENT
// nsICSSLoaderObserver
NS_IMETHOD StyleSheetLoaded(mozilla::StyleSheetHandle aSheet,
NS_IMETHOD StyleSheetLoaded(mozilla::StyleSheet* aSheet,
bool aWasAlternate,
nsresult aStatus) override;
@ -344,7 +344,7 @@ protected:
* An array of style sheets, that will be added (preserving order) to the
* document after all of them are loaded (in DoneWalking).
*/
nsTArray<StyleSheetHandle::RefPtr> mOverlaySheets;
nsTArray<RefPtr<StyleSheet>> mOverlaySheets;
nsCOMPtr<nsIDOMXULCommandDispatcher> mCommandDispatcher; // [OWNER] of the focus tracker

View File

@ -23,7 +23,7 @@
#include "js/TracingAPI.h"
#include "mozilla/CSSStyleSheet.h"
#include "mozilla/StyleSheetInlines.h"
#include "mozilla/Preferences.h"
#include "mozilla/scache/StartupCache.h"
#include "mozilla/scache/StartupCacheUtils.h"

View File

@ -4237,7 +4237,7 @@ EditorBase::CreateTxnForComposition(const nsAString& aStringToInsert)
}
NS_IMETHODIMP
EditorBase::CreateTxnForAddStyleSheet(StyleSheetHandle aSheet,
EditorBase::CreateTxnForAddStyleSheet(StyleSheet* aSheet,
AddStyleSheetTransaction** aTransaction)
{
RefPtr<AddStyleSheetTransaction> transaction = new AddStyleSheetTransaction();
@ -4252,7 +4252,7 @@ EditorBase::CreateTxnForAddStyleSheet(StyleSheetHandle aSheet,
NS_IMETHODIMP
EditorBase::CreateTxnForRemoveStyleSheet(
StyleSheetHandle aSheet,
StyleSheet* aSheet,
RemoveStyleSheetTransaction** aTransaction)
{
RefPtr<RemoveStyleSheetTransaction> transaction =

View File

@ -9,7 +9,7 @@
#include "mozilla/Assertions.h" // for MOZ_ASSERT, etc.
#include "mozilla/OwningNonNull.h" // for OwningNonNull
#include "mozilla/SelectionState.h" // for RangeUpdater, etc.
#include "mozilla/StyleSheetHandle.h" // for StyleSheetHandle
#include "mozilla/StyleSheet.h" // for StyleSheet
#include "mozilla/dom/Text.h"
#include "nsCOMPtr.h" // for already_AddRefed, nsCOMPtr
#include "nsCycleCollectionParticipant.h"
@ -328,14 +328,14 @@ protected:
* Create a transaction for adding a style sheet.
*/
NS_IMETHOD CreateTxnForAddStyleSheet(
StyleSheetHandle aSheet,
StyleSheet* aSheet,
AddStyleSheetTransaction** aTransaction);
/**
* Create a transaction for removing a style sheet.
*/
NS_IMETHOD CreateTxnForRemoveStyleSheet(
StyleSheetHandle aSheet,
StyleSheet* aSheet,
RemoveStyleSheetTransaction** aTransaction);
nsresult DeleteText(nsGenericDOMDataNode& aElement,

View File

@ -72,8 +72,8 @@
#include "mozilla/dom/HTMLBodyElement.h"
#include "nsTextFragment.h"
#include "nsContentList.h"
#include "mozilla/StyleSheetHandle.h"
#include "mozilla/StyleSheetHandleInlines.h"
#include "mozilla/StyleSheet.h"
#include "mozilla/StyleSheetInlines.h"
namespace mozilla {
@ -2854,7 +2854,7 @@ HTMLEditor::ReplaceStyleSheet(const nsAString& aURL)
NS_IMETHODIMP
HTMLEditor::RemoveStyleSheet(const nsAString& aURL)
{
StyleSheetHandle::RefPtr sheet = GetStyleSheetForURL(aURL);
RefPtr<StyleSheet> sheet = GetStyleSheetForURL(aURL);
NS_ENSURE_TRUE(sheet, NS_ERROR_UNEXPECTED);
RefPtr<RemoveStyleSheetTransaction> transaction;
@ -2894,7 +2894,7 @@ HTMLEditor::AddOverrideStyleSheet(const nsAString& aURL)
// We MUST ONLY load synchronous local files (no @import)
// XXXbz Except this will actually try to load remote files
// synchronously, of course..
StyleSheetHandle::RefPtr sheet;
RefPtr<StyleSheet> sheet;
// Editor override style sheets may want to style Gecko anonymous boxes
rv = ps->GetDocument()->CSSLoader()->
LoadSheetSync(uaURI, mozilla::css::eAgentSheetFeatures, true,
@ -2939,7 +2939,7 @@ HTMLEditor::ReplaceOverrideStyleSheet(const nsAString& aURL)
NS_IMETHODIMP
HTMLEditor::RemoveOverrideStyleSheet(const nsAString& aURL)
{
StyleSheetHandle::RefPtr sheet = GetStyleSheetForURL(aURL);
RefPtr<StyleSheet> sheet = GetStyleSheetForURL(aURL);
// Make sure we remove the stylesheet from our internal list in all
// cases.
@ -2962,7 +2962,7 @@ NS_IMETHODIMP
HTMLEditor::EnableStyleSheet(const nsAString& aURL,
bool aEnable)
{
StyleSheetHandle::RefPtr sheet = GetStyleSheetForURL(aURL);
RefPtr<StyleSheet> sheet = GetStyleSheetForURL(aURL);
NS_ENSURE_TRUE(sheet, NS_OK); // Don't fail if sheet not found
// Ensure the style sheet is owned by our document.
@ -2980,7 +2980,7 @@ HTMLEditor::EnableStyleSheet(const nsAString& aURL,
bool
HTMLEditor::EnableExistingStyleSheet(const nsAString& aURL)
{
StyleSheetHandle::RefPtr sheet = GetStyleSheetForURL(aURL);
RefPtr<StyleSheet> sheet = GetStyleSheetForURL(aURL);
// Enable sheet if already loaded.
if (sheet)
@ -3002,7 +3002,7 @@ HTMLEditor::EnableExistingStyleSheet(const nsAString& aURL)
nsresult
HTMLEditor::AddNewStyleSheetToList(const nsAString& aURL,
StyleSheetHandle aStyleSheet)
StyleSheet* aStyleSheet)
{
uint32_t countSS = mStyleSheets.Length();
uint32_t countU = mStyleSheetURLs.Length();
@ -3032,7 +3032,7 @@ HTMLEditor::RemoveStyleSheetFromList(const nsAString& aURL)
return NS_OK;
}
StyleSheetHandle
StyleSheet*
HTMLEditor::GetStyleSheetForURL(const nsAString& aURL)
{
// is it already in the list?
@ -3047,7 +3047,7 @@ HTMLEditor::GetStyleSheetForURL(const nsAString& aURL)
}
void
HTMLEditor::GetURLForStyleSheet(StyleSheetHandle aStyleSheet,
HTMLEditor::GetURLForStyleSheet(StyleSheet* aStyleSheet,
nsAString& aURL)
{
// is it already in the list?
@ -3426,7 +3426,7 @@ HTMLEditor::DebugUnitTests(int32_t* outNumTests,
}
NS_IMETHODIMP
HTMLEditor::StyleSheetLoaded(StyleSheetHandle aSheet,
HTMLEditor::StyleSheetLoaded(StyleSheet* aSheet,
bool aWasAlternate,
nsresult aStatus)
{

View File

@ -8,7 +8,7 @@
#include "mozilla/Attributes.h"
#include "mozilla/CSSEditUtils.h"
#include "mozilla/StyleSheetHandle.h"
#include "mozilla/StyleSheet.h"
#include "mozilla/TextEditor.h"
#include "mozilla/dom/Element.h"
#include "mozilla/dom/File.h"
@ -365,7 +365,7 @@ public:
NS_IMETHOD GetRootElement(nsIDOMElement** aRootElement) override;
// nsICSSLoaderObserver
NS_IMETHOD StyleSheetLoaded(StyleSheetHandle aSheet,
NS_IMETHOD StyleSheetLoaded(StyleSheet* aSheet,
bool aWasAlternate, nsresult aStatus) override;
// Utility Routines, not part of public API
@ -417,15 +417,15 @@ public:
/**
* Dealing with the internal style sheet lists.
*/
StyleSheetHandle GetStyleSheetForURL(const nsAString& aURL);
void GetURLForStyleSheet(StyleSheetHandle aStyleSheet,
StyleSheet* GetStyleSheetForURL(const nsAString& aURL);
void GetURLForStyleSheet(StyleSheet* aStyleSheet,
nsAString& aURL);
/**
* Add a url + known style sheet to the internal lists.
*/
nsresult AddNewStyleSheetToList(const nsAString &aURL,
StyleSheetHandle aStyleSheet);
StyleSheet* aStyleSheet);
nsresult RemoveStyleSheetFromList(const nsAString &aURL);
bool IsCSSEnabled()
@ -907,7 +907,7 @@ protected:
// Maintain a list of associated style sheets and their urls.
nsTArray<nsString> mStyleSheetURLs;
nsTArray<StyleSheetHandle::RefPtr> mStyleSheets;
nsTArray<RefPtr<StyleSheet>> mStyleSheets;
// an array for holding default style settings
nsTArray<PropItem*> mDefaultStyles;

View File

@ -9,8 +9,8 @@
#include "nsAString.h"
#include "nsCOMPtr.h" // for nsCOMPtr, do_QueryInterface, etc.
#include "mozilla/StyleSheetHandle.h" // for mozilla::StyleSheetHandle
#include "mozilla/StyleSheetHandleInlines.h"
#include "mozilla/StyleSheet.h" // for mozilla::StyleSheet
#include "mozilla/StyleSheetInlines.h"
#include "nsDebug.h" // for NS_ENSURE_TRUE
#include "nsError.h" // for NS_OK, etc.
#include "nsIDOMDocument.h" // for nsIDOMDocument
@ -21,7 +21,7 @@
namespace mozilla {
static void
AddStyleSheet(nsIEditor* aEditor, StyleSheetHandle aSheet)
AddStyleSheet(nsIEditor* aEditor, StyleSheet* aSheet)
{
nsCOMPtr<nsIDOMDocument> domDoc;
aEditor->GetDocument(getter_AddRefs(domDoc));
@ -34,7 +34,7 @@ AddStyleSheet(nsIEditor* aEditor, StyleSheetHandle aSheet)
}
static void
RemoveStyleSheet(nsIEditor* aEditor, StyleSheetHandle aSheet)
RemoveStyleSheet(nsIEditor* aEditor, StyleSheet* aSheet)
{
nsCOMPtr<nsIDOMDocument> domDoc;
aEditor->GetDocument(getter_AddRefs(domDoc));
@ -64,7 +64,7 @@ NS_INTERFACE_MAP_END_INHERITING(EditTransactionBase)
NS_IMETHODIMP
AddStyleSheetTransaction::Init(nsIEditor* aEditor,
StyleSheetHandle aSheet)
StyleSheet* aSheet)
{
NS_ENSURE_TRUE(aEditor && aSheet, NS_ERROR_INVALID_ARG);
@ -118,7 +118,7 @@ NS_INTERFACE_MAP_END_INHERITING(EditTransactionBase)
NS_IMETHODIMP
RemoveStyleSheetTransaction::Init(nsIEditor* aEditor,
StyleSheetHandle aSheet)
StyleSheet* aSheet)
{
NS_ENSURE_TRUE(aEditor && aSheet, NS_ERROR_INVALID_ARG);

View File

@ -7,7 +7,7 @@
#define StylesheetTransactions_h
#include "mozilla/EditTransactionBase.h" // for EditTransactionBase, etc.
#include "mozilla/StyleSheetHandle.h" // for mozilla::StyleSheetHandle
#include "mozilla/StyleSheet.h" // for mozilla::StyleSheet
#include "nsCycleCollectionParticipant.h"
#include "nsID.h" // for REFNSIID
#include "nscore.h" // for NS_IMETHOD
@ -24,7 +24,7 @@ public:
* @param aEditor The object providing core editing operations
* @param aSheet The stylesheet to add
*/
NS_IMETHOD Init(nsIEditor* aEditor, StyleSheetHandle aSheet);
NS_IMETHOD Init(nsIEditor* aEditor, StyleSheet* aSheet);
AddStyleSheetTransaction();
@ -38,7 +38,7 @@ protected:
// The editor that created this transaction.
nsIEditor* mEditor;
// The style sheet to add.
mozilla::StyleSheetHandle::RefPtr mSheet;
RefPtr<mozilla::StyleSheet> mSheet;
};
@ -50,7 +50,7 @@ public:
* @param aEditor The object providing core editing operations.
* @param aSheet The stylesheet to remove.
*/
NS_IMETHOD Init(nsIEditor* aEditor, StyleSheetHandle aSheet);
NS_IMETHOD Init(nsIEditor* aEditor, StyleSheet* aSheet);
RemoveStyleSheetTransaction();
@ -64,7 +64,7 @@ protected:
// The editor that created this transaction.
nsIEditor* mEditor;
// The style sheet to remove.
StyleSheetHandle::RefPtr mSheet;
RefPtr<StyleSheet> mSheet;
};

View File

@ -15,7 +15,7 @@
#include "ScopedGLHelpers.h"
#include "gfx2DGlue.h"
#include "../layers/ipc/ShadowLayers.h"
#include "mozilla/layers/CompositableForwarder.h"
#include "mozilla/layers/TextureForwarder.h"
#include "mozilla/layers/TextureClientSharedSurface.h"
#ifdef XP_WIN
@ -69,16 +69,17 @@ GLScreenBuffer::Create(GLContext* gl,
/* static */ UniquePtr<SurfaceFactory>
GLScreenBuffer::CreateFactory(GLContext* gl,
const SurfaceCaps& caps,
const RefPtr<layers::CompositableForwarder>& forwarder,
KnowsCompositor* compositorConnection,
const layers::TextureFlags& flags)
{
return CreateFactory(gl, caps, forwarder, forwarder->GetCompositorBackendType(), flags);
return CreateFactory(gl, caps, compositorConnection->GetTextureForwarder(),
compositorConnection->GetCompositorBackendType(), flags);
}
/* static */ UniquePtr<SurfaceFactory>
GLScreenBuffer::CreateFactory(GLContext* gl,
const SurfaceCaps& caps,
const RefPtr<layers::ClientIPCAllocator>& allocator,
LayersIPCChannel* ipcChannel,
const mozilla::layers::LayersBackend backend,
const layers::TextureFlags& flags)
{
@ -87,18 +88,18 @@ GLScreenBuffer::CreateFactory(GLContext* gl,
switch (backend) {
case mozilla::layers::LayersBackend::LAYERS_OPENGL: {
#if defined(XP_MACOSX)
factory = SurfaceFactory_IOSurface::Create(gl, caps, allocator, flags);
factory = SurfaceFactory_IOSurface::Create(gl, caps, ipcChannel, flags);
#elif defined(MOZ_WIDGET_GONK)
factory = MakeUnique<SurfaceFactory_Gralloc>(gl, caps, allocator, flags);
factory = MakeUnique<SurfaceFactory_Gralloc>(gl, caps, ipcChannel, flags);
#elif defined(GL_PROVIDER_GLX)
if (sGLXLibrary.UseTextureFromPixmap())
factory = SurfaceFactory_GLXDrawable::Create(gl, caps, allocator, flags);
factory = SurfaceFactory_GLXDrawable::Create(gl, caps, ipcChannel, flags);
#elif defined(MOZ_WIDGET_UIKIT)
factory = MakeUnique<SurfaceFactory_GLTexture>(mGLContext, caps, allocator, mFlags);
factory = MakeUnique<SurfaceFactory_GLTexture>(mGLContext, caps, ipcChannel, mFlags);
#else
if (gl->GetContextType() == GLContextType::EGL) {
if (XRE_IsParentProcess()) {
factory = SurfaceFactory_EGLImage::Create(gl, caps, allocator, flags);
factory = SurfaceFactory_EGLImage::Create(gl, caps, ipcChannel, flags);
}
}
#endif
@ -113,11 +114,11 @@ GLScreenBuffer::CreateFactory(GLContext* gl,
(gl->IsWARP() == dm->IsWARP()) &&
dm->TextureSharingWorks())
{
factory = SurfaceFactory_ANGLEShareHandle::Create(gl, caps, allocator, flags);
factory = SurfaceFactory_ANGLEShareHandle::Create(gl, caps, ipcChannel, flags);
}
if (!factory && gfxPrefs::WebGLDXGLEnabled()) {
factory = SurfaceFactory_D3D11Interop::Create(gl, caps, allocator, flags);
factory = SurfaceFactory_D3D11Interop::Create(gl, caps, ipcChannel, flags);
}
#endif
break;
@ -128,7 +129,7 @@ GLScreenBuffer::CreateFactory(GLContext* gl,
#ifdef GL_PROVIDER_GLX
if (!factory && sGLXLibrary.UseTextureFromPixmap()) {
factory = SurfaceFactory_GLXDrawable::Create(gl, caps, allocator, flags);
factory = SurfaceFactory_GLXDrawable::Create(gl, caps, ipcChannel, flags);
}
#endif
}

View File

@ -25,7 +25,8 @@
namespace mozilla {
namespace layers {
class CompositableForwarder;
class KnowsCompositor;
class LayersIPCChannel;
class SharedSurfaceTextureClient;
} // namespace layers
@ -137,12 +138,12 @@ public:
static UniquePtr<SurfaceFactory>
CreateFactory(GLContext* gl,
const SurfaceCaps& caps,
const RefPtr<layers::CompositableForwarder>& forwarder,
layers::KnowsCompositor* compositorConnection,
const layers::TextureFlags& flags);
static UniquePtr<SurfaceFactory>
CreateFactory(GLContext* gl,
const SurfaceCaps& caps,
const RefPtr<layers::ClientIPCAllocator>& allocator,
layers::LayersIPCChannel* ipcChannel,
const mozilla::layers::LayersBackend backend,
const layers::TextureFlags& flags);

View File

@ -15,6 +15,7 @@
#include "SharedSurfaceGL.h"
#include "mozilla/layers/CompositorTypes.h"
#include "mozilla/layers/TextureClientSharedSurface.h"
#include "mozilla/layers/TextureForwarder.h"
#include "mozilla/Unused.h"
namespace mozilla {
@ -287,7 +288,7 @@ ChooseBufferBits(const SurfaceCaps& caps,
SurfaceFactory::SurfaceFactory(SharedSurfaceType type, GLContext* gl,
const SurfaceCaps& caps,
const RefPtr<layers::ClientIPCAllocator>& allocator,
const RefPtr<layers::LayersIPCChannel>& allocator,
const layers::TextureFlags& flags)
: mType(type)
, mGL(gl)

View File

@ -39,7 +39,7 @@ class DrawTarget;
} // namespace gfx
namespace layers {
class ClientIPCAllocator;
class LayersIPCChannel;
class SharedSurfaceTextureClient;
enum class TextureFlags : uint32_t;
class SurfaceDescriptor;
@ -267,7 +267,7 @@ public:
const SharedSurfaceType mType;
GLContext* const mGL;
const SurfaceCaps mCaps;
const RefPtr<layers::ClientIPCAllocator> mAllocator;
const RefPtr<layers::LayersIPCChannel> mAllocator;
const layers::TextureFlags mFlags;
const GLFormats mFormats;
Mutex mMutex;
@ -278,7 +278,7 @@ protected:
RefSet<layers::SharedSurfaceTextureClient> mRecycleTotalPool;
SurfaceFactory(SharedSurfaceType type, GLContext* gl, const SurfaceCaps& caps,
const RefPtr<layers::ClientIPCAllocator>& allocator,
const RefPtr<layers::LayersIPCChannel>& allocator,
const layers::TextureFlags& flags);
public:

View File

@ -320,7 +320,7 @@ SharedSurface_ANGLEShareHandle::ReadbackBySharedHandle(gfx::DataSourceSurface* o
/*static*/ UniquePtr<SurfaceFactory_ANGLEShareHandle>
SurfaceFactory_ANGLEShareHandle::Create(GLContext* gl, const SurfaceCaps& caps,
const RefPtr<layers::ClientIPCAllocator>& allocator,
const RefPtr<layers::LayersIPCChannel>& allocator,
const layers::TextureFlags& flags)
{
GLLibraryEGL* egl = &sEGLLibrary;
@ -340,7 +340,7 @@ SurfaceFactory_ANGLEShareHandle::Create(GLContext* gl, const SurfaceCaps& caps,
SurfaceFactory_ANGLEShareHandle::SurfaceFactory_ANGLEShareHandle(GLContext* gl,
const SurfaceCaps& caps,
const RefPtr<layers::ClientIPCAllocator>& allocator,
const RefPtr<layers::LayersIPCChannel>& allocator,
const layers::TextureFlags& flags,
GLLibraryEGL* egl,
EGLConfig config)

View File

@ -80,12 +80,12 @@ protected:
public:
static UniquePtr<SurfaceFactory_ANGLEShareHandle> Create(GLContext* gl,
const SurfaceCaps& caps,
const RefPtr<layers::ClientIPCAllocator>& allocator,
const RefPtr<layers::LayersIPCChannel>& allocator,
const layers::TextureFlags& flags);
protected:
SurfaceFactory_ANGLEShareHandle(GLContext* gl, const SurfaceCaps& caps,
const RefPtr<layers::ClientIPCAllocator>& allocator,
const RefPtr<layers::LayersIPCChannel>& allocator,
const layers::TextureFlags& flags, GLLibraryEGL* egl,
EGLConfig config);

View File

@ -391,7 +391,7 @@ SharedSurface_D3D11Interop::ToSurfaceDescriptor(layers::SurfaceDescriptor* const
/*static*/ UniquePtr<SurfaceFactory_D3D11Interop>
SurfaceFactory_D3D11Interop::Create(GLContext* gl, const SurfaceCaps& caps,
layers::ClientIPCAllocator* allocator,
layers::LayersIPCChannel* allocator,
const layers::TextureFlags& flags)
{
WGLLibrary* wgl = &sWGLLib;
@ -411,7 +411,7 @@ SurfaceFactory_D3D11Interop::Create(GLContext* gl, const SurfaceCaps& caps,
SurfaceFactory_D3D11Interop::SurfaceFactory_D3D11Interop(GLContext* gl,
const SurfaceCaps& caps,
layers::ClientIPCAllocator* allocator,
layers::LayersIPCChannel* allocator,
const layers::TextureFlags& flags,
DXInterop2Device* interop)
: SurfaceFactory(SharedSurfaceType::DXGLInterop2, gl, caps, allocator, flags)

View File

@ -75,12 +75,12 @@ public:
static UniquePtr<SurfaceFactory_D3D11Interop> Create(GLContext* gl,
const SurfaceCaps& caps,
layers::ClientIPCAllocator* allocator,
layers::LayersIPCChannel* allocator,
const layers::TextureFlags& flags);
protected:
SurfaceFactory_D3D11Interop(GLContext* gl, const SurfaceCaps& caps,
layers::ClientIPCAllocator* allocator,
layers::LayersIPCChannel* allocator,
const layers::TextureFlags& flags,
DXInterop2Device* interop);

View File

@ -170,7 +170,7 @@ SharedSurface_EGLImage::ReadbackBySharedHandle(gfx::DataSourceSurface* out_surfa
/*static*/ UniquePtr<SurfaceFactory_EGLImage>
SurfaceFactory_EGLImage::Create(GLContext* prodGL, const SurfaceCaps& caps,
const RefPtr<layers::ClientIPCAllocator>& allocator,
const RefPtr<layers::LayersIPCChannel>& allocator,
const layers::TextureFlags& flags)
{
EGLContext context = GLContextEGL::Cast(prodGL)->mContext;

View File

@ -90,14 +90,14 @@ public:
// Fallible:
static UniquePtr<SurfaceFactory_EGLImage> Create(GLContext* prodGL,
const SurfaceCaps& caps,
const RefPtr<layers::ClientIPCAllocator>& allocator,
const RefPtr<layers::LayersIPCChannel>& allocator,
const layers::TextureFlags& flags);
protected:
const EGLContext mContext;
SurfaceFactory_EGLImage(GLContext* prodGL, const SurfaceCaps& caps,
const RefPtr<layers::ClientIPCAllocator>& allocator,
const RefPtr<layers::LayersIPCChannel>& allocator,
const layers::TextureFlags& flags,
EGLContext context)
: SurfaceFactory(SharedSurfaceType::EGLImageShare, prodGL, caps, allocator, flags)

View File

@ -148,7 +148,7 @@ class SurfaceFactory_GLTexture
public:
SurfaceFactory_GLTexture(GLContext* prodGL,
const SurfaceCaps& caps,
const RefPtr<layers::ClientIPCAllocator>& allocator,
const RefPtr<layers::LayersIPCChannel>& allocator,
const layers::TextureFlags& flags)
: SurfaceFactory(SharedSurfaceType::SharedGLTexture, prodGL, caps, allocator, flags)
{

View File

@ -13,6 +13,7 @@
#include "mozilla/layers/LayersSurfaces.h"
#include "mozilla/layers/ShadowLayerUtilsX11.h"
#include "mozilla/layers/ISurfaceAllocator.h"
#include "mozilla/layers/TextureForwarder.h"
#include "mozilla/X11Util.h"
namespace mozilla {
@ -120,7 +121,7 @@ SharedSurface_GLXDrawable::ReadbackBySharedHandle(gfx::DataSourceSurface* out_su
UniquePtr<SurfaceFactory_GLXDrawable>
SurfaceFactory_GLXDrawable::Create(GLContext* prodGL,
const SurfaceCaps& caps,
const RefPtr<layers::ClientIPCAllocator>& allocator,
const RefPtr<layers::LayersIPCChannel>& allocator,
const layers::TextureFlags& flags)
{
MOZ_ASSERT(caps.alpha, "GLX surfaces require an alpha channel!");

View File

@ -49,14 +49,14 @@ class SurfaceFactory_GLXDrawable
public:
static UniquePtr<SurfaceFactory_GLXDrawable> Create(GLContext* prodGL,
const SurfaceCaps& caps,
const RefPtr<layers::ClientIPCAllocator>& allocator,
const RefPtr<layers::LayersIPCChannel>& allocator,
const layers::TextureFlags& flags);
virtual UniquePtr<SharedSurface> CreateShared(const gfx::IntSize& size) override;
private:
SurfaceFactory_GLXDrawable(GLContext* prodGL, const SurfaceCaps& caps,
const RefPtr<layers::ClientIPCAllocator>& allocator,
const RefPtr<layers::LayersIPCChannel>& allocator,
const layers::TextureFlags& flags)
: SurfaceFactory(SharedSurfaceType::GLXDrawable, prodGL, caps, allocator, flags)
{ }

View File

@ -35,7 +35,7 @@ using namespace mozilla::layers;
using namespace android;
SurfaceFactory_Gralloc::SurfaceFactory_Gralloc(GLContext* prodGL, const SurfaceCaps& caps,
const RefPtr<layers::ClientIPCAllocator>& allocator,
const RefPtr<layers::LayersIPCChannel>& allocator,
const layers::TextureFlags& flags)
: SurfaceFactory(SharedSurfaceType::Gralloc, prodGL, caps, allocator, flags)
{
@ -48,7 +48,7 @@ SharedSurface_Gralloc::Create(GLContext* prodGL,
const gfx::IntSize& size,
bool hasAlpha,
layers::TextureFlags flags,
ClientIPCAllocator* allocator)
LayersIPCChannel* allocator)
{
GLLibraryEGL* egl = &sEGLLibrary;
MOZ_ASSERT(egl);
@ -118,7 +118,7 @@ SharedSurface_Gralloc::SharedSurface_Gralloc(GLContext* prodGL,
const gfx::IntSize& size,
bool hasAlpha,
GLLibraryEGL* egl,
layers::ClientIPCAllocator* allocator,
layers::LayersIPCChannel* allocator,
layers::TextureClient* textureClient,
GLuint prodTex)
: SharedSurface(SharedSurfaceType::Gralloc,

View File

@ -12,7 +12,7 @@
namespace mozilla {
namespace layers {
class ClientIPCAllocator;
class LayersIPCChannel;
class TextureClient;
}
@ -29,7 +29,7 @@ public:
const gfx::IntSize& size,
bool hasAlpha,
layers::TextureFlags flags,
layers::ClientIPCAllocator* allocator);
layers::LayersIPCChannel* allocator);
static SharedSurface_Gralloc* Cast(SharedSurface* surf) {
MOZ_ASSERT(surf->mType == SharedSurfaceType::Gralloc);
@ -40,7 +40,7 @@ public:
protected:
GLLibraryEGL* const mEGL;
EGLSync mSync;
RefPtr<layers::ClientIPCAllocator> mAllocator;
RefPtr<layers::LayersIPCChannel> mAllocator;
RefPtr<layers::TextureClient> mTextureClient;
const GLuint mProdTex;
@ -48,7 +48,7 @@ protected:
const gfx::IntSize& size,
bool hasAlpha,
GLLibraryEGL* egl,
layers::ClientIPCAllocator* allocator,
layers::LayersIPCChannel* allocator,
layers::TextureClient* textureClient,
GLuint prodTex);
@ -83,7 +83,7 @@ class SurfaceFactory_Gralloc
{
public:
SurfaceFactory_Gralloc(GLContext* prodGL, const SurfaceCaps& caps,
const RefPtr<layers::ClientIPCAllocator>& allocator,
const RefPtr<layers::LayersIPCChannel>& allocator,
const layers::TextureFlags& flags);
virtual UniquePtr<SharedSurface> CreateShared(const gfx::IntSize& size) override {

View File

@ -211,7 +211,7 @@ SharedSurface_IOSurface::ReadbackBySharedHandle(gfx::DataSourceSurface* out_surf
/*static*/ UniquePtr<SurfaceFactory_IOSurface>
SurfaceFactory_IOSurface::Create(GLContext* gl, const SurfaceCaps& caps,
const RefPtr<layers::ClientIPCAllocator>& allocator,
const RefPtr<layers::LayersIPCChannel>& allocator,
const layers::TextureFlags& flags)
{
auto maxDims = gfx::IntSize::Truncate(MacIOSurface::GetMaxWidth(),

View File

@ -77,13 +77,13 @@ public:
// Infallible.
static UniquePtr<SurfaceFactory_IOSurface> Create(GLContext* gl,
const SurfaceCaps& caps,
const RefPtr<layers::ClientIPCAllocator>& allocator,
const RefPtr<layers::LayersIPCChannel>& allocator,
const layers::TextureFlags& flags);
protected:
const gfx::IntSize mMaxDims;
SurfaceFactory_IOSurface(GLContext* gl, const SurfaceCaps& caps,
const RefPtr<layers::ClientIPCAllocator>& allocator,
const RefPtr<layers::LayersIPCChannel>& allocator,
const layers::TextureFlags& flags,
const gfx::IntSize& maxDims)
: SurfaceFactory(SharedSurfaceType::IOSurface, gl, caps, allocator, flags)

View File

@ -27,16 +27,17 @@ public:
LayersBackend aLayersBackend,
TextureFlags aFlags,
TextureAllocationFlags aAllocFlags,
ClientIPCAllocator* aAllocator);
LayersIPCChannel* aAllocator);
virtual TextureData*
CreateSimilar(ClientIPCAllocator* aAllocator,
CreateSimilar(LayersIPCChannel* aAllocator,
LayersBackend aLayersBackend,
TextureFlags aFlags = TextureFlags::DEFAULT,
TextureAllocationFlags aAllocFlags = ALLOC_DEFAULT) const override;
virtual bool Serialize(SurfaceDescriptor& aOutDescriptor) override;
virtual void Deallocate(ClientIPCAllocator*) override;
virtual void Deallocate(LayersIPCChannel*) override;
MemoryTextureData(const BufferDescriptor& aDesc,
gfx::BackendType aMoz2DBackend,
@ -66,16 +67,17 @@ public:
LayersBackend aLayersBackend,
TextureFlags aFlags,
TextureAllocationFlags aAllocFlags,
ClientIPCAllocator* aAllocator);
LayersIPCChannel* aAllocator);
virtual TextureData*
CreateSimilar(ClientIPCAllocator* aAllocator,
CreateSimilar(LayersIPCChannel* aAllocator,
LayersBackend aLayersBackend,
TextureFlags aFlags = TextureFlags::DEFAULT,
TextureAllocationFlags aAllocFlags = ALLOC_DEFAULT) const override;
virtual bool Serialize(SurfaceDescriptor& aOutDescriptor) override;
virtual void Deallocate(ClientIPCAllocator* aAllocator) override;
virtual void Deallocate(LayersIPCChannel* aAllocator) override;
ShmemTextureData(const BufferDescriptor& aDesc,
gfx::BackendType aMoz2DBackend, mozilla::ipc::Shmem aShmem)
@ -114,22 +116,21 @@ BufferTextureData::Create(gfx::IntSize aSize, gfx::SurfaceFormat aFormat,
gfx::BackendType aMoz2DBackend,
LayersBackend aLayersBackend, TextureFlags aFlags,
TextureAllocationFlags aAllocFlags,
ClientIPCAllocator* aAllocator)
LayersIPCChannel* aAllocator)
{
if (!aAllocator || aAllocator->IsSameProcess()) {
return MemoryTextureData::Create(aSize, aFormat, aMoz2DBackend,
aLayersBackend, aFlags,
aAllocFlags, aAllocator);
} else if (aAllocator->AsShmemAllocator()) {
} else {
return ShmemTextureData::Create(aSize, aFormat, aMoz2DBackend,
aLayersBackend, aFlags,
aAllocFlags, aAllocator);
}
return nullptr;
}
BufferTextureData*
BufferTextureData::CreateInternal(ClientIPCAllocator* aAllocator,
BufferTextureData::CreateInternal(LayersIPCChannel* aAllocator,
const BufferDescriptor& aDesc,
gfx::BackendType aMoz2DBackend,
int32_t aBufferSize,
@ -144,19 +145,18 @@ BufferTextureData::CreateInternal(ClientIPCAllocator* aAllocator,
GfxMemoryImageReporter::DidAlloc(buffer);
return new MemoryTextureData(aDesc, aMoz2DBackend, buffer, aBufferSize);
} else if (aAllocator->AsShmemAllocator()) {
} else {
ipc::Shmem shm;
if (!aAllocator->AsShmemAllocator()->AllocUnsafeShmem(aBufferSize, OptimalShmemType(), &shm)) {
if (!aAllocator->AllocUnsafeShmem(aBufferSize, OptimalShmemType(), &shm)) {
return nullptr;
}
return new ShmemTextureData(aDesc, aMoz2DBackend, shm);
}
return nullptr;
}
BufferTextureData*
BufferTextureData::CreateForYCbCrWithBufferSize(ClientIPCAllocator* aAllocator,
BufferTextureData::CreateForYCbCrWithBufferSize(KnowsCompositor* aAllocator,
int32_t aBufferSize,
TextureFlags aTextureFlags)
{
@ -164,10 +164,8 @@ BufferTextureData::CreateForYCbCrWithBufferSize(ClientIPCAllocator* aAllocator,
return nullptr;
}
auto fwd = aAllocator->AsCompositableForwarder();
bool hasIntermediateBuffer = fwd ? ComputeHasIntermediateBuffer(gfx::SurfaceFormat::YUV,
fwd->GetCompositorBackendType())
: true;
bool hasIntermediateBuffer = ComputeHasIntermediateBuffer(gfx::SurfaceFormat::YUV,
aAllocator->GetCompositorBackendType());
// Initialize the metadata with something, even if it will have to be rewritten
// afterwards since we don't know the dimensions of the texture at this point.
@ -175,12 +173,12 @@ BufferTextureData::CreateForYCbCrWithBufferSize(ClientIPCAllocator* aAllocator,
0, 0, 0, StereoMode::MONO,
hasIntermediateBuffer);
return CreateInternal(aAllocator, desc, gfx::BackendType::NONE, aBufferSize,
return CreateInternal(aAllocator->GetTextureForwarder(), desc, gfx::BackendType::NONE, aBufferSize,
aTextureFlags);
}
BufferTextureData*
BufferTextureData::CreateForYCbCr(ClientIPCAllocator* aAllocator,
BufferTextureData::CreateForYCbCr(KnowsCompositor* aAllocator,
gfx::IntSize aYSize,
gfx::IntSize aCbCrSize,
StereoMode aStereoMode,
@ -198,17 +196,16 @@ BufferTextureData::CreateForYCbCr(ClientIPCAllocator* aAllocator,
aCbCrSize.width, aCbCrSize.height,
yOffset, cbOffset, crOffset);
auto fwd = aAllocator ? aAllocator->AsCompositableForwarder() : nullptr;
bool hasIntermediateBuffer = fwd ? ComputeHasIntermediateBuffer(gfx::SurfaceFormat::YUV,
fwd->GetCompositorBackendType())
: true;
bool hasIntermediateBuffer = aAllocator ? ComputeHasIntermediateBuffer(gfx::SurfaceFormat::YUV,
aAllocator->GetCompositorBackendType())
: true;
YCbCrDescriptor descriptor = YCbCrDescriptor(aYSize, aCbCrSize, yOffset, cbOffset,
crOffset, aStereoMode,
hasIntermediateBuffer);
return CreateInternal(aAllocator, descriptor, gfx::BackendType::NONE, bufSize,
aTextureFlags);
return CreateInternal(aAllocator ? aAllocator->GetTextureForwarder() : nullptr, descriptor,
gfx::BackendType::NONE, bufSize, aTextureFlags);
}
void
@ -462,7 +459,7 @@ MemoryTextureData::Create(gfx::IntSize aSize, gfx::SurfaceFormat aFormat,
gfx::BackendType aMoz2DBackend,
LayersBackend aLayersBackend, TextureFlags aFlags,
TextureAllocationFlags aAllocFlags,
ClientIPCAllocator* aAllocator)
LayersIPCChannel* aAllocator)
{
// Should have used CreateForYCbCr.
MOZ_ASSERT(aFormat != gfx::SurfaceFormat::YUV);
@ -482,10 +479,6 @@ MemoryTextureData::Create(gfx::IntSize aSize, gfx::SurfaceFormat aFormat,
return nullptr;
}
// LAYERS_NONE must imply that we have no compositable forwarder
MOZ_ASSERT_IF(aLayersBackend == LayersBackend::LAYERS_NONE,
!aAllocator || !aAllocator->AsCompositableForwarder());
bool hasIntermediateBuffer = ComputeHasIntermediateBuffer(aFormat, aLayersBackend);
GfxMemoryImageReporter::DidAlloc(buf);
@ -496,7 +489,7 @@ MemoryTextureData::Create(gfx::IntSize aSize, gfx::SurfaceFormat aFormat,
}
void
MemoryTextureData::Deallocate(ClientIPCAllocator*)
MemoryTextureData::Deallocate(LayersIPCChannel*)
{
MOZ_ASSERT(mBuffer);
GfxMemoryImageReporter::WillFree(mBuffer);
@ -505,15 +498,13 @@ MemoryTextureData::Deallocate(ClientIPCAllocator*)
}
TextureData*
MemoryTextureData::CreateSimilar(ClientIPCAllocator* aAllocator,
MemoryTextureData::CreateSimilar(LayersIPCChannel* aAllocator,
LayersBackend aLayersBackend,
TextureFlags aFlags,
TextureAllocationFlags aAllocFlags) const
{
auto fwd = aAllocator ? aAllocator->AsCompositableForwarder() : nullptr;
auto backend = fwd ? fwd->GetCompositorBackendType() : LayersBackend::LAYERS_NONE;
return MemoryTextureData::Create(GetSize(), GetFormat(), mMoz2DBackend,
backend, aFlags, aAllocFlags, aAllocator);
aLayersBackend, aFlags, aAllocFlags, aAllocator);
}
bool
@ -534,13 +525,13 @@ ShmemTextureData::Create(gfx::IntSize aSize, gfx::SurfaceFormat aFormat,
gfx::BackendType aMoz2DBackend,
LayersBackend aLayersBackend, TextureFlags aFlags,
TextureAllocationFlags aAllocFlags,
ClientIPCAllocator* aAllocator)
LayersIPCChannel* aAllocator)
{
MOZ_ASSERT(aAllocator);
// Should have used CreateForYCbCr.
MOZ_ASSERT(aFormat != gfx::SurfaceFormat::YUV);
if (!aAllocator || !aAllocator->AsShmemAllocator()) {
if (!aAllocator) {
return nullptr;
}
@ -555,7 +546,7 @@ ShmemTextureData::Create(gfx::IntSize aSize, gfx::SurfaceFormat aFormat,
}
mozilla::ipc::Shmem shm;
if (!aAllocator->AsShmemAllocator()->AllocUnsafeShmem(bufSize, OptimalShmemType(), &shm)) {
if (!aAllocator->AllocUnsafeShmem(bufSize, OptimalShmemType(), &shm)) {
return nullptr;
}
@ -564,10 +555,6 @@ ShmemTextureData::Create(gfx::IntSize aSize, gfx::SurfaceFormat aFormat,
return nullptr;
}
// LAYERS_NONE must imply that we have no compositable forwarder
MOZ_ASSERT_IF(aLayersBackend == LayersBackend::LAYERS_NONE,
!aAllocator || !aAllocator->AsCompositableForwarder());
bool hasIntermediateBuffer = ComputeHasIntermediateBuffer(aFormat, aLayersBackend);
BufferDescriptor descriptor = RGBDescriptor(aSize, aFormat, hasIntermediateBuffer);
@ -578,21 +565,19 @@ ShmemTextureData::Create(gfx::IntSize aSize, gfx::SurfaceFormat aFormat,
}
TextureData*
ShmemTextureData::CreateSimilar(ClientIPCAllocator* aAllocator,
ShmemTextureData::CreateSimilar(LayersIPCChannel* aAllocator,
LayersBackend aLayersBackend,
TextureFlags aFlags,
TextureAllocationFlags aAllocFlags) const
{
auto fwd = aAllocator ? aAllocator->AsCompositableForwarder() : nullptr;
auto backend = fwd ? fwd->GetCompositorBackendType() : LayersBackend::LAYERS_NONE;
return ShmemTextureData::Create(GetSize(), GetFormat(), mMoz2DBackend,
backend, aFlags, aAllocFlags, aAllocator);
aLayersBackend, aFlags, aAllocFlags, aAllocator);
}
void
ShmemTextureData::Deallocate(ClientIPCAllocator* aAllocator)
ShmemTextureData::Deallocate(LayersIPCChannel* aAllocator)
{
aAllocator->AsShmemAllocator()->DeallocShmem(mShmem);
aAllocator->DeallocShmem(mShmem);
}
} // namespace

View File

@ -26,9 +26,9 @@ public:
LayersBackend aLayersBackend,
TextureFlags aFlags,
TextureAllocationFlags aAllocFlags,
ClientIPCAllocator* aAllocator);
LayersIPCChannel* aAllocator);
static BufferTextureData* CreateForYCbCr(ClientIPCAllocator* aAllocator,
static BufferTextureData* CreateForYCbCr(KnowsCompositor* aAllocator,
gfx::IntSize aYSize,
gfx::IntSize aCbCrSize,
StereoMode aStereoMode,
@ -37,7 +37,7 @@ public:
// It is generally better to use CreateForYCbCr instead.
// This creates a half-initialized texture since we don't know the sizes and
// offsets in the buffer.
static BufferTextureData* CreateForYCbCrWithBufferSize(ClientIPCAllocator* aAllocator,
static BufferTextureData* CreateForYCbCrWithBufferSize(KnowsCompositor* aAllocator,
int32_t aSize,
TextureFlags aTextureFlags);
@ -70,7 +70,7 @@ protected:
gfx::SurfaceFormat GetFormat() const;
static BufferTextureData* CreateInternal(ClientIPCAllocator* aAllocator,
static BufferTextureData* CreateInternal(LayersIPCChannel* aAllocator,
const BufferDescriptor& aDesc,
gfx::BackendType aMoz2DBackend,
int32_t aBufferSize,

View File

@ -53,7 +53,7 @@ D3D11ShareHandleImage::GetSize()
}
TextureClient*
D3D11ShareHandleImage::GetTextureClient(TextureForwarder* aForwarder)
D3D11ShareHandleImage::GetTextureClient(KnowsCompositor* aForwarder)
{
return mTextureClient;
}
@ -142,7 +142,7 @@ D3D11RecycleAllocator::Allocate(gfx::SurfaceFormat aFormat,
{
return CreateD3D11TextureClientWithDevice(aSize, aFormat,
aTextureFlags, aAllocFlags,
mDevice, mSurfaceAllocator);
mDevice, mSurfaceAllocator->GetTextureForwarder());
}
already_AddRefed<TextureClient>

View File

@ -19,7 +19,7 @@ namespace layers {
class D3D11RecycleAllocator : public TextureClientRecycleAllocator
{
public:
explicit D3D11RecycleAllocator(TextureForwarder* aAllocator,
explicit D3D11RecycleAllocator(KnowsCompositor* aAllocator,
ID3D11Device* aDevice)
: TextureClientRecycleAllocator(aAllocator)
, mDevice(aDevice)
@ -54,7 +54,7 @@ public:
gfx::IntSize GetSize() override;
virtual already_AddRefed<gfx::SourceSurface> GetAsSourceSurface() override;
virtual TextureClient* GetTextureClient(TextureForwarder* aForwarder) override;
virtual TextureClient* GetTextureClient(KnowsCompositor* aForwarder) override;
virtual gfx::IntRect GetPictureRect() override { return mPictureRect; }
ID3D11Texture2D* GetTexture() const;

View File

@ -128,10 +128,10 @@ D3D9SurfaceImage::GetSize()
}
TextureClient*
D3D9SurfaceImage::GetTextureClient(TextureForwarder* aForwarder)
D3D9SurfaceImage::GetTextureClient(KnowsCompositor* aForwarder)
{
MOZ_ASSERT(mTextureClient);
MOZ_ASSERT(mTextureClient->GetAllocator() == aForwarder);
MOZ_ASSERT(mTextureClient->GetAllocator() == aForwarder->GetTextureForwarder());
return mTextureClient;
}
@ -207,7 +207,8 @@ D3D9RecycleAllocator::Allocate(gfx::SurfaceFormat aFormat,
return nullptr;
}
return MakeAndAddRef<TextureClient>(data, aTextureFlags, mSurfaceAllocator);
return MakeAndAddRef<TextureClient>(data, aTextureFlags,
mSurfaceAllocator->GetTextureForwarder());
}
already_AddRefed<TextureClient>

View File

@ -19,7 +19,7 @@ class TextureClient;
class D3D9RecycleAllocator : public TextureClientRecycleAllocator
{
public:
explicit D3D9RecycleAllocator(TextureForwarder* aAllocator,
explicit D3D9RecycleAllocator(KnowsCompositor* aAllocator,
IDirect3DDevice9* aDevice)
: TextureClientRecycleAllocator(aAllocator)
, mDevice(aDevice)
@ -60,7 +60,7 @@ public:
virtual already_AddRefed<gfx::SourceSurface> GetAsSourceSurface() override;
virtual TextureClient* GetTextureClient(TextureForwarder* aForwarder) override;
virtual TextureClient* GetTextureClient(KnowsCompositor* aForwarder) override;
already_AddRefed<IDirect3DSurface9> GetD3D9Surface();

View File

@ -40,7 +40,7 @@ public:
// in the other process and send it across.
virtual already_AddRefed<gfx::SourceSurface> GetAsSourceSurface() override { return nullptr; }
virtual TextureClient* GetTextureClient(TextureForwarder* aForwarder) override
virtual TextureClient* GetTextureClient(KnowsCompositor* aForwarder) override
{
MOZ_ASSERT(aForwarder == ImageBridgeChild::GetSingleton(), "Must only use GPUVideo on ImageBridge");
return mTextureClient;

View File

@ -155,7 +155,7 @@ static bool UploadData(IDirect3DDevice9* aDevice,
}
TextureClient*
IMFYCbCrImage::GetD3D9TextureClient(TextureForwarder* aForwarder)
IMFYCbCrImage::GetD3D9TextureClient(KnowsCompositor* aForwarder)
{
RefPtr<IDirect3DDevice9> device = DeviceManagerD3D9::GetDevice();
if (!device) {
@ -207,20 +207,19 @@ IMFYCbCrImage::GetD3D9TextureClient(TextureForwarder* aForwarder)
}
mTextureClient = TextureClient::CreateWithData(
DXGIYCbCrTextureData::Create(aForwarder,
TextureFlags::DEFAULT,
DXGIYCbCrTextureData::Create(TextureFlags::DEFAULT,
textureY, textureCb, textureCr,
shareHandleY, shareHandleCb, shareHandleCr,
GetSize(), mData.mYSize, mData.mCbCrSize),
TextureFlags::DEFAULT,
aForwarder
aForwarder->GetTextureForwarder()
);
return mTextureClient;
}
TextureClient*
IMFYCbCrImage::GetTextureClient(TextureForwarder* aForwarder)
IMFYCbCrImage::GetTextureClient(KnowsCompositor* aForwarder)
{
if (mTextureClient) {
return mTextureClient;
@ -275,12 +274,11 @@ IMFYCbCrImage::GetTextureClient(TextureForwarder* aForwarder)
}
mTextureClient = TextureClient::CreateWithData(
DXGIYCbCrTextureData::Create(aForwarder,
TextureFlags::DEFAULT,
DXGIYCbCrTextureData::Create(TextureFlags::DEFAULT,
textureY, textureCb, textureCr,
GetSize(), mData.mYSize, mData.mCbCrSize),
TextureFlags::DEFAULT,
aForwarder
aForwarder->GetTextureForwarder()
);
return mTextureClient;

View File

@ -20,11 +20,11 @@ public:
virtual bool IsValid() { return true; }
virtual TextureClient* GetTextureClient(TextureForwarder* aForwarder) override;
virtual TextureClient* GetTextureClient(KnowsCompositor* aForwarder) override;
protected:
TextureClient* GetD3D9TextureClient(TextureForwarder* aForwarder);
TextureClient* GetD3D9TextureClient(KnowsCompositor* aForwarder);
~IMFYCbCrImage();

View File

@ -739,7 +739,7 @@ SourceSurfaceImage::~SourceSurfaceImage()
}
TextureClient*
SourceSurfaceImage::GetTextureClient(TextureForwarder* aForwarder)
SourceSurfaceImage::GetTextureClient(KnowsCompositor* aForwarder)
{
if (!aForwarder) {
return nullptr;
@ -760,7 +760,6 @@ SourceSurfaceImage::GetTextureClient(TextureForwarder* aForwarder)
// gfx::BackendType::NONE means default to content backend
textureClient = TextureClient::CreateFromSurface(aForwarder,
surface,
aForwarder->GetCompositorBackendType(),
BackendSelector::Content,
mTextureFlags,
ALLOC_DEFAULT);

View File

@ -151,7 +151,7 @@ class PImageContainerChild;
class SharedPlanarYCbCrImage;
class PlanarYCbCrImage;
class TextureClient;
class TextureForwarder;
class KnowsCompositor;
class GrallocImage;
class NVImage;
@ -228,7 +228,7 @@ public:
* For use with the TextureForwarder only (so that the later can
* synchronize the TextureClient with the TextureHost).
*/
virtual TextureClient* GetTextureClient(TextureForwarder* aForwarder) { return nullptr; }
virtual TextureClient* GetTextureClient(KnowsCompositor* aForwarder) { return nullptr; }
/* Access to derived classes. */
virtual EGLImageImage* AsEGLImageImage() { return nullptr; }
@ -890,7 +890,7 @@ public:
}
void SetTextureFlags(TextureFlags aTextureFlags) { mTextureFlags = aTextureFlags; }
virtual TextureClient* GetTextureClient(TextureForwarder* aForwarder) override;
virtual TextureClient* GetTextureClient(KnowsCompositor* aForwarder) override;
virtual gfx::IntSize GetSize() override { return mSize; }

View File

@ -16,14 +16,14 @@ using namespace mozilla::layers;
using namespace mozilla::gfx;
TextureClient*
MacIOSurfaceImage::GetTextureClient(TextureForwarder* aForwarder)
MacIOSurfaceImage::GetTextureClient(KnowsCompositor* aForwarder)
{
if (!mTextureClient) {
BackendType backend = BackendType::NONE;
mTextureClient = TextureClient::CreateWithData(
MacIOSurfaceTextureData::Create(mSurface, backend),
TextureFlags::DEFAULT,
aForwarder
aForwarder->GetTextureForwarder()
);
}
return mTextureClient;

View File

@ -31,7 +31,7 @@ public:
virtual already_AddRefed<gfx::SourceSurface> GetAsSourceSurface() override;
virtual TextureClient* GetTextureClient(TextureForwarder* aForwarder) override;
virtual TextureClient* GetTextureClient(KnowsCompositor* aForwarder) override;
virtual MacIOSurfaceImage* AsMacIOSurfaceImage() override {
return this;

View File

@ -86,9 +86,9 @@ PersistentBufferProviderBasic::Create(gfx::IntSize aSize, gfx::SurfaceFormat aFo
already_AddRefed<PersistentBufferProviderShared>
PersistentBufferProviderShared::Create(gfx::IntSize aSize,
gfx::SurfaceFormat aFormat,
CompositableForwarder* aFwd)
KnowsCompositor* aFwd)
{
if (!aFwd || !aFwd->IPCOpen()) {
if (!aFwd || !aFwd->GetTextureForwarder()->IPCOpen()) {
return nullptr;
}
@ -110,7 +110,7 @@ PersistentBufferProviderShared::Create(gfx::IntSize aSize,
PersistentBufferProviderShared::PersistentBufferProviderShared(gfx::IntSize aSize,
gfx::SurfaceFormat aFormat,
CompositableForwarder* aFwd,
KnowsCompositor* aFwd,
RefPtr<TextureClient>& aTexture)
: mSize(aSize)
@ -136,7 +136,7 @@ PersistentBufferProviderShared::~PersistentBufferProviderShared()
}
bool
PersistentBufferProviderShared::SetForwarder(CompositableForwarder* aFwd)
PersistentBufferProviderShared::SetForwarder(KnowsCompositor* aFwd)
{
MOZ_ASSERT(aFwd);
if (!aFwd) {
@ -152,7 +152,7 @@ PersistentBufferProviderShared::SetForwarder(CompositableForwarder* aFwd)
mFwd->GetActiveResourceTracker().RemoveObject(this);
}
if (mFwd->AsTextureForwarder() != aFwd->AsTextureForwarder() ||
if (mFwd->GetTextureForwarder() != aFwd->GetTextureForwarder() ||
mFwd->GetCompositorBackendType() != aFwd->GetCompositorBackendType()) {
// We are going to be used with an different and/or incompatible forwarder.
// This should be extremely rare. We have to copy the front buffer into a
@ -225,7 +225,7 @@ PersistentBufferProviderShared::GetTexture(Maybe<uint32_t> aIndex)
already_AddRefed<gfx::DrawTarget>
PersistentBufferProviderShared::BorrowDrawTarget(const gfx::IntRect& aPersistedRect)
{
if (!mFwd->IPCOpen()) {
if (!mFwd->GetTextureForwarder()->IPCOpen()) {
return nullptr;
}
@ -442,4 +442,4 @@ PersistentBufferProviderShared::Destroy()
}
} // namespace layers
} // namespace mozilla
} // namespace mozilla

View File

@ -9,7 +9,7 @@
#include "mozilla/Assertions.h" // for MOZ_ASSERT, etc
#include "mozilla/RefPtr.h" // for RefPtr, already_AddRefed, etc
#include "mozilla/layers/LayersTypes.h"
#include "mozilla/layers/CompositableForwarder.h"
#include "mozilla/layers/TextureForwarder.h"
#include "mozilla/gfx/Types.h"
#include "mozilla/Vector.h"
@ -64,7 +64,7 @@ public:
virtual void OnShutdown() {}
virtual bool SetForwarder(CompositableForwarder* aFwd) { return true; }
virtual bool SetForwarder(KnowsCompositor* aFwd) { return true; }
/**
* Return true if this provider preserves the drawing state (clips, transforms,
@ -117,7 +117,7 @@ public:
static already_AddRefed<PersistentBufferProviderShared>
Create(gfx::IntSize aSize, gfx::SurfaceFormat aFormat,
CompositableForwarder* aFwd);
KnowsCompositor* aFwd);
virtual LayersBackend GetType() override { return LayersBackend::LAYERS_CLIENT; }
@ -135,12 +135,12 @@ public:
virtual void OnShutdown() override { Destroy(); }
virtual bool SetForwarder(CompositableForwarder* aFwd) override;
virtual bool SetForwarder(KnowsCompositor* aFwd) override;
virtual bool PreservesDrawingState() const override { return false; }
protected:
PersistentBufferProviderShared(gfx::IntSize aSize, gfx::SurfaceFormat aFormat,
CompositableForwarder* aFwd,
KnowsCompositor* aFwd,
RefPtr<TextureClient>& aTexture);
~PersistentBufferProviderShared();
@ -152,7 +152,7 @@ protected:
gfx::IntSize mSize;
gfx::SurfaceFormat mFormat;
RefPtr<CompositableForwarder> mFwd;
RefPtr<KnowsCompositor> mFwd;
Vector<RefPtr<TextureClient>, 4> mTextures;
// Offset of the texture in mTextures that the canvas uses.
Maybe<uint32_t> mBack;

View File

@ -25,7 +25,8 @@ public:
virtual bool Serialize(SurfaceDescriptor& aOutDescriptor) override;
virtual TextureData*
CreateSimilar(ClientIPCAllocator* aAllocator,
CreateSimilar(LayersIPCChannel* aAllocator,
LayersBackend aLayersBackend,
TextureFlags aFlags = TextureFlags::DEFAULT,
TextureAllocationFlags aAllocFlags = ALLOC_DEFAULT) const override;
@ -34,7 +35,7 @@ public:
static
DIBTextureData* Create(gfx::IntSize aSize, gfx::SurfaceFormat aFormat);
virtual void Deallocate(ClientIPCAllocator* aAllocator) override
virtual void Deallocate(LayersIPCChannel* aAllocator) override
{
mSurface = nullptr;
}
@ -62,7 +63,8 @@ public:
virtual bool Serialize(SurfaceDescriptor& aOutDescriptor) override;
virtual TextureData*
CreateSimilar(ClientIPCAllocator* aAllocator,
CreateSimilar(LayersIPCChannel* aAllocator,
LayersBackend aLayersBackend,
TextureFlags aFlags = TextureFlags::DEFAULT,
TextureAllocationFlags aAllocFlags = ALLOC_DEFAULT) const override;
@ -70,7 +72,7 @@ public:
static
DIBTextureData* Create(gfx::IntSize aSize, gfx::SurfaceFormat aFormat,
ClientIPCAllocator* aAllocator);
LayersIPCChannel* aAllocator);
void DeallocateData()
{
@ -85,7 +87,7 @@ public:
}
}
virtual void Deallocate(ClientIPCAllocator* aAllocator) override
virtual void Deallocate(LayersIPCChannel* aAllocator) override
{
DeallocateData();
}
@ -137,7 +139,7 @@ DIBTextureData::BorrowDrawTarget()
DIBTextureData*
DIBTextureData::Create(gfx::IntSize aSize, gfx::SurfaceFormat aFormat,
ClientIPCAllocator* aAllocator)
LayersIPCChannel* aAllocator)
{
if (!aAllocator) {
return nullptr;
@ -153,7 +155,8 @@ DIBTextureData::Create(gfx::IntSize aSize, gfx::SurfaceFormat aFormat,
}
TextureData*
MemoryDIBTextureData::CreateSimilar(ClientIPCAllocator* aAllocator,
MemoryDIBTextureData::CreateSimilar(LayersIPCChannel* aAllocator,
LayersBackend aLayersBackend,
TextureFlags aFlags,
TextureAllocationFlags aAllocFlags) const
{
@ -216,7 +219,8 @@ MemoryDIBTextureData::UpdateFromSurface(gfx::SourceSurface* aSurface)
}
TextureData*
ShmemDIBTextureData::CreateSimilar(ClientIPCAllocator* aAllocator,
ShmemDIBTextureData::CreateSimilar(LayersIPCChannel* aAllocator,
LayersBackend aLayersBackend,
TextureFlags aFlags,
TextureAllocationFlags aAllocFlags) const
{
@ -280,7 +284,7 @@ ShmemDIBTextureData::Serialize(SurfaceDescriptor& aOutDescriptor)
DIBTextureData*
ShmemDIBTextureData::Create(gfx::IntSize aSize, gfx::SurfaceFormat aFormat,
ClientIPCAllocator* aAllocator)
LayersIPCChannel* aAllocator)
{
MOZ_ASSERT(aAllocator->GetParentPid() != base::ProcessId());

View File

@ -28,7 +28,7 @@ public:
static
DIBTextureData* Create(gfx::IntSize aSize, gfx::SurfaceFormat aFormat,
ClientIPCAllocator* aAllocator);
LayersIPCChannel* aAllocator);
protected:
DIBTextureData(gfx::IntSize aSize, gfx::SurfaceFormat aFormat,

View File

@ -49,7 +49,7 @@ TextureWrapperImage::GetAsSourceSurface()
}
TextureClient*
TextureWrapperImage::GetTextureClient(TextureForwarder* aForwarder)
TextureWrapperImage::GetTextureClient(KnowsCompositor* aForwarder)
{
return mTextureClient;
}

View File

@ -24,7 +24,7 @@ public:
gfx::IntSize GetSize() override;
gfx::IntRect GetPictureRect() override;
already_AddRefed<gfx::SourceSurface> GetAsSourceSurface() override;
TextureClient* GetTextureClient(TextureForwarder* aForwarder) override;
TextureClient* GetTextureClient(KnowsCompositor* aForwarder) override;
private:
gfx::IntRect mPictureRect;

View File

@ -106,13 +106,14 @@ X11TextureData::UpdateFromSurface(gfx::SourceSurface* aSurface)
}
void
X11TextureData::Deallocate(ClientIPCAllocator*)
X11TextureData::Deallocate(LayersIPCChannel*)
{
mSurface = nullptr;
}
TextureData*
X11TextureData::CreateSimilar(ClientIPCAllocator* aAllocator,
X11TextureData::CreateSimilar(LayersIPCChannel* aAllocator,
LayersBackend aLayersBackend,
TextureFlags aFlags,
TextureAllocationFlags aAllocFlags) const
{
@ -121,7 +122,7 @@ X11TextureData::CreateSimilar(ClientIPCAllocator* aAllocator,
X11TextureData*
X11TextureData::Create(gfx::IntSize aSize, gfx::SurfaceFormat aFormat,
TextureFlags aFlags, ClientIPCAllocator* aAllocator)
TextureFlags aFlags, LayersIPCChannel* aAllocator)
{
MOZ_ASSERT(aSize.width >= 0 && aSize.height >= 0);
if (aSize.width <= 0 || aSize.height <= 0 ||

View File

@ -17,7 +17,7 @@ class X11TextureData : public TextureData
{
public:
static X11TextureData* Create(gfx::IntSize aSize, gfx::SurfaceFormat aFormat,
TextureFlags aFlags, ClientIPCAllocator* aAllocator);
TextureFlags aFlags, LayersIPCChannel* aAllocator);
virtual bool Serialize(SurfaceDescriptor& aOutDescriptor) override;
@ -29,10 +29,11 @@ public:
virtual already_AddRefed<gfx::DrawTarget> BorrowDrawTarget() override;
virtual void Deallocate(ClientIPCAllocator*) override;
virtual void Deallocate(LayersIPCChannel*) override;
virtual TextureData*
CreateSimilar(ClientIPCAllocator* aAllocator,
CreateSimilar(LayersIPCChannel* aAllocator,
LayersBackend aLayersBackend,
TextureFlags aFlags = TextureFlags::DEFAULT,
TextureAllocationFlags aAllocFlags = ALLOC_DEFAULT) const override;

View File

@ -211,7 +211,7 @@ static inline void SwapRB_R8G8B8A8(uint8_t* pixel) {
class TexClientFactory
{
ClientIPCAllocator* const mAllocator;
CompositableForwarder* const mAllocator;
const bool mHasAlpha;
const gfx::IntSize mSize;
const gfx::BackendType mBackendType;
@ -219,7 +219,7 @@ class TexClientFactory
const LayersBackend mLayersBackend;
public:
TexClientFactory(ClientIPCAllocator* allocator, bool hasAlpha,
TexClientFactory(CompositableForwarder* allocator, bool hasAlpha,
const gfx::IntSize& size, gfx::BackendType backendType,
TextureFlags baseTexFlags, LayersBackend layersBackend)
: mAllocator(allocator)
@ -267,7 +267,7 @@ public:
};
static already_AddRefed<TextureClient>
TexClientFromReadback(SharedSurface* src, ClientIPCAllocator* allocator,
TexClientFromReadback(SharedSurface* src, CompositableForwarder* allocator,
TextureFlags baseFlags, LayersBackend layersBackend)
{
auto backendType = gfx::BackendType::CAIRO;
@ -423,7 +423,7 @@ CanvasClientSharedSurface::UpdateRenderer(gfx::IntSize aSize, Renderer& aRendere
} else {
mShSurfClient = gl->Screen()->Front();
if (mShSurfClient && mShSurfClient->GetAllocator() &&
mShSurfClient->GetAllocator()->AsCompositableForwarder() != GetForwarder()) {
mShSurfClient->GetAllocator() != GetForwarder()->GetTextureForwarder()) {
mShSurfClient = CloneSurface(mShSurfClient->Surf(), gl->Screen()->Factory());
}
if (!mShSurfClient) {

View File

@ -92,7 +92,7 @@ public:
void UpdateTextureFactoryIdentifier(const TextureFactoryIdentifier& aNewIdentifier);
TextureFactoryIdentifier GetTextureFactoryIdentifier()
{
return mForwarder->GetTextureFactoryIdentifier();
return AsShadowForwarder()->GetTextureFactoryIdentifier();
}
virtual void FlushRendering() override;

View File

@ -35,9 +35,9 @@ RemoveTextureFromCompositableTracker::ReleaseTextureClient()
!mTextureClient->GetAllocator()->UsesImageBridge())
{
RefPtr<TextureClientReleaseTask> task = new TextureClientReleaseTask(mTextureClient);
RefPtr<ClientIPCAllocator> allocator = mTextureClient->GetAllocator();
RefPtr<LayersIPCChannel> allocator = mTextureClient->GetAllocator();
mTextureClient = nullptr;
allocator->AsClientAllocator()->GetMessageLoop()->PostTask(task.forget());
allocator->GetMessageLoop()->PostTask(task.forget());
} else {
mTextureClient = nullptr;
}
@ -173,9 +173,8 @@ CompositableClient::CreateTextureClientFromSurface(gfx::SourceSurface* aSurface,
TextureFlags aTextureFlags,
TextureAllocationFlags aAllocFlags)
{
return TextureClient::CreateFromSurface(GetForwarder()->AsTextureForwarder(),
return TextureClient::CreateFromSurface(GetForwarder(),
aSurface,
GetForwarder()->GetCompositorBackendType(),
aSelector,
aTextureFlags | mTextureFlags,
aAllocFlags);
@ -224,7 +223,7 @@ CompositableClient::GetTextureClientRecycler()
return nullptr;
}
if(!mForwarder->UsesImageBridge()) {
if(!mForwarder->GetTextureForwarder()->UsesImageBridge()) {
MOZ_ASSERT(NS_IsMainThread());
mTextureClientRecycler = new layers::TextureClientRecycleAllocator(mForwarder);
return mTextureClientRecycler;

View File

@ -310,6 +310,7 @@ ContentClientRemoteBuffer::CreateBackBuffer(const IntRect& aBufferRect)
if (mTextureFlags & TextureFlags::COMPONENT_ALPHA) {
mTextureClientOnWhite = mTextureClient->CreateSimilar(
mForwarder->GetCompositorBackendType(),
mTextureFlags | ExtraTextureFlags(),
TextureAllocationFlags::ALLOC_CLEAR_BUFFER_WHITE
);

View File

@ -33,14 +33,14 @@ GPUVideoTextureData::FillInfo(TextureData::Info& aInfo) const
}
void
GPUVideoTextureData::Deallocate(ClientIPCAllocator* aAllocator)
GPUVideoTextureData::Deallocate(LayersIPCChannel* aAllocator)
{
dom::VideoDecoderManagerChild::GetSingleton()->DeallocateSurfaceDescriptorGPUVideo(mSD);
mSD = SurfaceDescriptorGPUVideo();
}
void
GPUVideoTextureData::Forget(ClientIPCAllocator* aAllocator)
GPUVideoTextureData::Forget(LayersIPCChannel* aAllocator)
{
// We always need to manually deallocate on the client side.
// Ideally we'd set up our TextureClient with the DEALLOCATE_CLIENT

View File

@ -30,9 +30,9 @@ public:
virtual bool Serialize(SurfaceDescriptor& aOutDescriptor) override;
virtual void Deallocate(ClientIPCAllocator* aAllocator) override;
virtual void Deallocate(LayersIPCChannel* aAllocator) override;
virtual void Forget(ClientIPCAllocator* aAllocator) override;
virtual void Forget(LayersIPCChannel* aAllocator) override;
protected:
SurfaceDescriptorGPUVideo mSD;

View File

@ -78,7 +78,7 @@ ImageClient::RemoveTextureWithWaiter(TextureClient* aTexture,
AsyncTransactionWaiter* aAsyncTransactionWaiter)
{
if (aAsyncTransactionWaiter &&
GetForwarder()->UsesImageBridge()) {
GetForwarder()->GetTextureForwarder()->UsesImageBridge()) {
RefPtr<AsyncTransactionTracker> request =
new RemoveTextureFromCompositableTracker(aAsyncTransactionWaiter);
GetForwarder()->RemoveTextureFromCompositableAsync(request, this, aTexture);
@ -103,7 +103,7 @@ TextureInfo ImageClientSingle::GetTextureInfo() const
void
ImageClientSingle::FlushAllImages(AsyncTransactionWaiter* aAsyncTransactionWaiter)
{
MOZ_ASSERT(GetForwarder()->UsesImageBridge());
MOZ_ASSERT(GetForwarder()->GetTextureForwarder()->UsesImageBridge());
for (auto& b : mBuffers) {
RemoveTextureWithWaiter(b.mTextureClient, aAsyncTransactionWaiter);
@ -219,13 +219,13 @@ ImageClientSingle::UpdateImage(ImageContainer* aContainer, uint32_t aContentFlag
if (image->GetFormat() == ImageFormat::EGLIMAGE) {
EGLImageImage* typedImage = image->AsEGLImageImage();
texture = EGLImageTextureData::CreateTextureClient(
typedImage, size, GetForwarder(), mTextureFlags);
typedImage, size, GetForwarder()->GetTextureForwarder(), mTextureFlags);
#ifdef MOZ_WIDGET_ANDROID
} else if (image->GetFormat() == ImageFormat::SURFACE_TEXTURE) {
SurfaceTextureImage* typedImage = image->AsSurfaceTextureImage();
texture = AndroidSurfaceTextureData::CreateTextureClient(
typedImage->GetSurfaceTexture(), size, typedImage->GetOriginPos(),
GetForwarder(), mTextureFlags
GetForwarder()->GetTextureForwarder(), mTextureFlags
);
#endif
} else {

View File

@ -75,7 +75,7 @@ struct TextureDeallocParams
{
TextureData* data;
RefPtr<TextureChild> actor;
RefPtr<ClientIPCAllocator> allocator;
RefPtr<LayersIPCChannel> allocator;
bool clientDeallocation;
bool syncDeallocation;
bool workAroundSharedSurfaceOwnershipIssue;
@ -119,15 +119,15 @@ public:
bool Recv__delete__() override { return true; }
ClientIPCAllocator* GetAllocator() { return mTextureForwarder; }
LayersIPCChannel* GetAllocator() { return mTextureForwarder; }
void ActorDestroy(ActorDestroyReason why) override;
bool IPCOpen() const { return mIPCOpen; }
void Lock() const { if (mCompositableForwarder && mCompositableForwarder->UsesImageBridge()) { mLock.Enter(); } }
void Lock() const { if (mCompositableForwarder && mCompositableForwarder->GetTextureForwarder()->UsesImageBridge()) { mLock.Enter(); } }
void Unlock() const { if (mCompositableForwarder && mCompositableForwarder->UsesImageBridge()) { mLock.Leave(); } }
void Unlock() const { if (mCompositableForwarder && mCompositableForwarder->GetTextureForwarder()->UsesImageBridge()) { mLock.Leave(); } }
private:
@ -240,7 +240,7 @@ private:
};
static void DestroyTextureData(TextureData* aTextureData, ClientIPCAllocator* aAllocator,
static void DestroyTextureData(TextureData* aTextureData, LayersIPCChannel* aAllocator,
bool aDeallocate, bool aMainThreadOnly)
{
if (!aTextureData) {
@ -248,7 +248,7 @@ static void DestroyTextureData(TextureData* aTextureData, ClientIPCAllocator* aA
}
if (aMainThreadOnly && !NS_IsMainThread()) {
RefPtr<ClientIPCAllocator> allocatorRef = aAllocator;
RefPtr<LayersIPCChannel> allocatorRef = aAllocator;
NS_DispatchToMainThread(NS_NewRunnableFunction([aTextureData, allocatorRef, aDeallocate]() -> void {
DestroyTextureData(aTextureData, allocatorRef, aDeallocate, true);
}));
@ -352,7 +352,7 @@ DeallocateTextureClient(TextureDeallocParams params)
MessageLoop* ipdlMsgLoop = nullptr;
if (params.allocator) {
ipdlMsgLoop = params.allocator->AsClientAllocator()->GetMessageLoop();
ipdlMsgLoop = params.allocator->GetMessageLoop();
if (!ipdlMsgLoop) {
// An allocator with no message loop means we are too late in the shutdown
// sequence.
@ -385,7 +385,7 @@ DeallocateTextureClient(TextureDeallocParams params)
if (!ipdlMsgLoop) {
// If we don't have a message loop we can't know for sure that we are in
// the IPDL thread and use the ClientIPCAllocator.
// the IPDL thread and use the LayersIPCChannel.
// This should ideally not happen outside of gtest, but some shutdown raciness
// could put us in this situation.
params.allocator = nullptr;
@ -641,7 +641,7 @@ TextureClient::UpdateFromSurface(gfx::SourceSurface* aSurface)
already_AddRefed<TextureClient>
TextureClient::CreateSimilar(TextureFlags aFlags, TextureAllocationFlags aAllocFlags) const
TextureClient::CreateSimilar(LayersBackend aLayersBackend, TextureFlags aFlags, TextureAllocationFlags aAllocFlags) const
{
MOZ_ASSERT(IsValid());
@ -651,7 +651,7 @@ TextureClient::CreateSimilar(TextureFlags aFlags, TextureAllocationFlags aAllocF
}
LockActor();
TextureData* data = mData->CreateSimilar(mAllocator, aFlags, aAllocFlags);
TextureData* data = mData->CreateSimilar(mAllocator, aLayersBackend, aFlags, aAllocFlags);
UnlockActor();
if (!data) {
@ -869,7 +869,7 @@ TextureClient::CancelWaitFenceHandleOnImageBridge()
ImageBridgeChild::GetSingleton()->CancelWaitFenceHandle(this);
}
void CancelTextureClientRecycle(uint64_t aTextureId, ClientIPCAllocator* aAllocator)
void CancelTextureClientRecycle(uint64_t aTextureId, LayersIPCChannel* aAllocator)
{
if (!aAllocator) {
return;
@ -918,17 +918,17 @@ TextureClient::SetRecycleAllocator(ITextureClientRecycleAllocator* aAllocator)
bool
TextureClient::InitIPDLActor(CompositableForwarder* aForwarder)
{
MOZ_ASSERT(aForwarder && aForwarder->GetMessageLoop() == mAllocator->AsClientAllocator()->GetMessageLoop());
MOZ_ASSERT(aForwarder && aForwarder->GetTextureForwarder()->GetMessageLoop() == mAllocator->GetMessageLoop());
if (mActor && !mActor->mDestroyed) {
CompositableForwarder* currentFwd = mActor->mCompositableForwarder;
TextureForwarder* currentTexFwd = mActor->mTextureForwarder;
if (currentFwd != aForwarder) {
// It's a bit iffy but right now ShadowLayerForwarder inherits TextureForwarder
// even though it should not. ShadowLayerForwarder::AsTextureForwarder actually
// even though it should not. ShadowLayerForwarder::GetTextureForwarder actually
// returns a pointer to the CompositorBridgeChild.
// It's Ok for a texture to move from a ShadowLayerForwarder to another, but
// not form a CompositorBridgeChild to another (they use different channels).
if (currentTexFwd && currentTexFwd != aForwarder->AsTextureForwarder()) {
if (currentTexFwd && currentTexFwd != aForwarder->GetTextureForwarder()) {
gfxCriticalError() << "Attempt to move a texture to a different channel CF.";
return false;
}
@ -947,10 +947,10 @@ TextureClient::InitIPDLActor(CompositableForwarder* aForwarder)
return false;
}
mActor = static_cast<TextureChild*>(aForwarder->CreateTexture(desc,
aForwarder->GetCompositorBackendType(),
GetFlags(),
mSerial));
mActor = static_cast<TextureChild*>(aForwarder->GetTextureForwarder()->CreateTexture(desc,
aForwarder->GetCompositorBackendType(),
GetFlags(),
mSerial));
if (!mActor) {
gfxCriticalError() << static_cast<int32_t>(desc.type()) << ", "
<< static_cast<int32_t>(aForwarder->GetCompositorBackendType()) << ", "
@ -959,7 +959,7 @@ TextureClient::InitIPDLActor(CompositableForwarder* aForwarder)
MOZ_CRASH("GFX: Invalid actor");
}
mActor->mCompositableForwarder = aForwarder;
mActor->mTextureForwarder = aForwarder->AsTextureForwarder();
mActor->mTextureForwarder = aForwarder->GetTextureForwarder();
mActor->mTextureClient = this;
mActor->mMainThreadOnly = !!(mFlags & TextureFlags::DEALLOCATE_MAIN_THREAD);
@ -973,9 +973,10 @@ TextureClient::InitIPDLActor(CompositableForwarder* aForwarder)
}
bool
TextureClient::InitIPDLActor(TextureForwarder* aForwarder)
TextureClient::InitIPDLActor(KnowsCompositor* aForwarder)
{
MOZ_ASSERT(aForwarder && aForwarder->GetMessageLoop() == mAllocator->AsClientAllocator()->GetMessageLoop());
MOZ_ASSERT(aForwarder && aForwarder->GetTextureForwarder()->GetMessageLoop() == mAllocator->GetMessageLoop());
TextureForwarder* fwd = aForwarder->GetTextureForwarder();
if (mActor && !mActor->mDestroyed) {
CompositableForwarder* currentFwd = mActor->mCompositableForwarder;
TextureForwarder* currentTexFwd = mActor->mTextureForwarder;
@ -985,11 +986,11 @@ TextureClient::InitIPDLActor(TextureForwarder* aForwarder)
return false;
}
if (currentTexFwd && currentTexFwd != aForwarder) {
if (currentTexFwd && currentTexFwd != fwd) {
gfxCriticalError() << "Attempt to move a texture to a different channel TF.";
return false;
}
mActor->mTextureForwarder = aForwarder;
mActor->mTextureForwarder = fwd;
return true;
}
MOZ_ASSERT(!mActor || mActor->mDestroyed, "Cannot use a texture on several IPC channels.");
@ -999,12 +1000,12 @@ TextureClient::InitIPDLActor(TextureForwarder* aForwarder)
return false;
}
mActor = static_cast<TextureChild*>(aForwarder->CreateTexture(desc,
aForwarder->GetCompositorBackendType(),
GetFlags(),
mSerial));
mActor = static_cast<TextureChild*>(fwd->CreateTexture(desc,
aForwarder->GetCompositorBackendType(),
GetFlags(),
mSerial));
MOZ_ASSERT(mActor);
mActor->mTextureForwarder = aForwarder;
mActor->mTextureForwarder = fwd;
mActor->mTextureClient = this;
mActor->mMainThreadOnly = !!(mFlags & TextureFlags::DEALLOCATE_MAIN_THREAD);
@ -1039,7 +1040,7 @@ BackendTypeForBackendSelector(LayersBackend aLayersBackend, BackendSelector aSel
// static
already_AddRefed<TextureClient>
TextureClient::CreateForDrawing(CompositableForwarder* aAllocator,
TextureClient::CreateForDrawing(KnowsCompositor* aAllocator,
gfx::SurfaceFormat aFormat,
gfx::IntSize aSize,
BackendSelector aSelector,
@ -1047,9 +1048,10 @@ TextureClient::CreateForDrawing(CompositableForwarder* aAllocator,
TextureAllocationFlags aAllocFlags)
{
LayersBackend layersBackend = aAllocator->GetCompositorBackendType();
return TextureClient::CreateForDrawing(aAllocator->AsTextureForwarder(),
return TextureClient::CreateForDrawing(aAllocator->GetTextureForwarder(),
aFormat, aSize,
layersBackend,
aAllocator->GetMaxTextureSize(),
aSelector,
aTextureFlags,
aAllocFlags);
@ -1061,18 +1063,11 @@ TextureClient::CreateForDrawing(TextureForwarder* aAllocator,
gfx::SurfaceFormat aFormat,
gfx::IntSize aSize,
LayersBackend aLayersBackend,
int32_t aMaxTextureSize,
BackendSelector aSelector,
TextureFlags aTextureFlags,
TextureAllocationFlags aAllocFlags)
{
// What we want here is the "real" TextureForwarder. ShadowLayerForwarder,
// while inheriting TextureForwarder, actually forwards all of its TF methods
// to CompositorBridgeChild. In order to avoid odd situations where some
// textures point to a ShadowLayerForwarder and some point directly to the
// CompositorBridgeChild, we just get the actual TextureForwarder which is
// returned by AsTextureForwarder...
aAllocator = aAllocator->AsTextureForwarder();
gfx::BackendType moz2DBackend = BackendTypeForBackendSelector(aLayersBackend, aSelector);
// also test the validity of aAllocator
@ -1087,26 +1082,22 @@ TextureClient::CreateForDrawing(TextureForwarder* aAllocator,
TextureData* data = nullptr;
#if defined(XP_WIN)
int32_t maxTextureSize = aAllocator->GetMaxTextureSize();
#endif
#ifdef XP_WIN
if (aLayersBackend == LayersBackend::LAYERS_D3D11 &&
(moz2DBackend == gfx::BackendType::DIRECT2D ||
moz2DBackend == gfx::BackendType::DIRECT2D1_1 ||
(!!(aAllocFlags & ALLOC_FOR_OUT_OF_BAND_CONTENT) &&
DeviceManagerDx::Get()->GetContentDevice())) &&
aSize.width <= maxTextureSize &&
aSize.height <= maxTextureSize)
aSize.width <= aMaxTextureSize &&
aSize.height <= aMaxTextureSize)
{
data = DXGITextureData::Create(aSize, aFormat, aAllocFlags);
}
if (aLayersBackend == LayersBackend::LAYERS_D3D9 &&
moz2DBackend == gfx::BackendType::CAIRO &&
aAllocator->IsSameProcess() &&
aSize.width <= maxTextureSize &&
aSize.height <= maxTextureSize &&
aSize.width <= aMaxTextureSize &&
aSize.height <= aMaxTextureSize &&
NS_IsMainThread() &&
DeviceManagerD3D9::GetDevice()) {
data = D3D9TextureData::Create(aSize, aFormat, aAllocFlags);
@ -1170,18 +1161,15 @@ TextureClient::CreateForDrawing(TextureForwarder* aAllocator,
// static
already_AddRefed<TextureClient>
TextureClient::CreateFromSurface(TextureForwarder* aAllocator,
TextureClient::CreateFromSurface(KnowsCompositor* aAllocator,
gfx::SourceSurface* aSurface,
LayersBackend aLayersBackend,
BackendSelector aSelector,
TextureFlags aTextureFlags,
TextureAllocationFlags aAllocFlags)
{
aAllocator = aAllocator->AsTextureForwarder();
// also test the validity of aAllocator
MOZ_ASSERT(aAllocator && aAllocator->IPCOpen());
if (!aAllocator || !aAllocator->IPCOpen()) {
MOZ_ASSERT(aAllocator && aAllocator->GetTextureForwarder()->IPCOpen());
if (!aAllocator || !aAllocator->GetTextureForwarder()->IPCOpen()) {
return nullptr;
}
@ -1193,11 +1181,12 @@ TextureClient::CreateFromSurface(TextureForwarder* aAllocator,
TextureData* data = nullptr;
#if defined(XP_WIN)
gfx::BackendType moz2DBackend = BackendTypeForBackendSelector(aLayersBackend, aSelector);
LayersBackend layersBackend = aAllocator->GetCompositorBackendType();
gfx::BackendType moz2DBackend = BackendTypeForBackendSelector(layersBackend, aSelector);
int32_t maxTextureSize = aAllocator->GetMaxTextureSize();
if (aLayersBackend == LayersBackend::LAYERS_D3D11 &&
if (layersBackend == LayersBackend::LAYERS_D3D11 &&
(moz2DBackend == gfx::BackendType::DIRECT2D ||
moz2DBackend == gfx::BackendType::DIRECT2D1_1 ||
(!!(aAllocFlags & ALLOC_FOR_OUT_OF_BAND_CONTENT) &&
@ -1210,13 +1199,13 @@ TextureClient::CreateFromSurface(TextureForwarder* aAllocator,
#endif
if (data) {
return MakeAndAddRef<TextureClient>(data, aTextureFlags, aAllocator);
return MakeAndAddRef<TextureClient>(data, aTextureFlags, aAllocator->GetTextureForwarder());
}
// Fall back to using UpdateFromSurface
RefPtr<TextureClient> client = CreateForDrawing(aAllocator, aSurface->GetFormat(), size,
aLayersBackend, aSelector, aTextureFlags, aAllocFlags);
aSelector, aTextureFlags, aAllocFlags);
if (!client) {
return nullptr;
}
@ -1232,22 +1221,22 @@ TextureClient::CreateFromSurface(TextureForwarder* aAllocator,
// static
already_AddRefed<TextureClient>
TextureClient::CreateForRawBufferAccess(ClientIPCAllocator* aAllocator,
TextureClient::CreateForRawBufferAccess(KnowsCompositor* aAllocator,
gfx::SurfaceFormat aFormat,
gfx::IntSize aSize,
gfx::BackendType aMoz2DBackend,
TextureFlags aTextureFlags,
TextureAllocationFlags aAllocFlags)
{
auto fwd = aAllocator->AsCompositableForwarder();
auto backend = fwd ? fwd->GetCompositorBackendType() : LayersBackend::LAYERS_NONE;
return CreateForRawBufferAccess(aAllocator, aFormat, aSize, aMoz2DBackend,
backend, aTextureFlags, aAllocFlags);
return CreateForRawBufferAccess(aAllocator->GetTextureForwarder(),
aFormat, aSize, aMoz2DBackend,
aAllocator->GetCompositorBackendType(),
aTextureFlags, aAllocFlags);
}
// static
already_AddRefed<TextureClient>
TextureClient::CreateForRawBufferAccess(ClientIPCAllocator* aAllocator,
TextureClient::CreateForRawBufferAccess(LayersIPCChannel* aAllocator,
gfx::SurfaceFormat aFormat,
gfx::IntSize aSize,
gfx::BackendType aMoz2DBackend,
@ -1287,15 +1276,15 @@ TextureClient::CreateForRawBufferAccess(ClientIPCAllocator* aAllocator,
// static
already_AddRefed<TextureClient>
TextureClient::CreateForYCbCr(ClientIPCAllocator* aAllocator,
TextureClient::CreateForYCbCr(KnowsCompositor* aAllocator,
gfx::IntSize aYSize,
gfx::IntSize aCbCrSize,
StereoMode aStereoMode,
TextureFlags aTextureFlags)
{
// The only reason we allow aAllocator to be null is for gtests
MOZ_ASSERT(!aAllocator || aAllocator->IPCOpen());
if (aAllocator && !aAllocator->IPCOpen()) {
MOZ_ASSERT(!aAllocator || aAllocator->GetLayersIPCActor()->IPCOpen());
if (aAllocator && !aAllocator->GetLayersIPCActor()->IPCOpen()) {
return nullptr;
}
@ -1309,18 +1298,19 @@ TextureClient::CreateForYCbCr(ClientIPCAllocator* aAllocator,
return nullptr;
}
return MakeAndAddRef<TextureClient>(data, aTextureFlags, aAllocator);
return MakeAndAddRef<TextureClient>(data, aTextureFlags,
aAllocator ? aAllocator->GetTextureForwarder() : nullptr);
}
// static
already_AddRefed<TextureClient>
TextureClient::CreateForYCbCrWithBufferSize(ClientIPCAllocator* aAllocator,
TextureClient::CreateForYCbCrWithBufferSize(KnowsCompositor* aAllocator,
size_t aSize,
TextureFlags aTextureFlags)
{
// also test the validity of aAllocator
MOZ_ASSERT(aAllocator && aAllocator->IPCOpen());
if (!aAllocator || !aAllocator->IPCOpen()) {
MOZ_ASSERT(!aAllocator || aAllocator->GetLayersIPCActor()->IPCOpen());
if (aAllocator && !aAllocator->GetLayersIPCActor()->IPCOpen()) {
return nullptr;
}
@ -1331,10 +1321,11 @@ TextureClient::CreateForYCbCrWithBufferSize(ClientIPCAllocator* aAllocator,
return nullptr;
}
return MakeAndAddRef<TextureClient>(data, aTextureFlags, aAllocator);
return MakeAndAddRef<TextureClient>(data, aTextureFlags,
aAllocator ? aAllocator->GetTextureForwarder() : 0);
}
TextureClient::TextureClient(TextureData* aData, TextureFlags aFlags, ClientIPCAllocator* aAllocator)
TextureClient::TextureClient(TextureData* aData, TextureFlags aFlags, LayersIPCChannel* aAllocator)
: AtomicRefCountedWithFinalize("TextureClient")
, mAllocator(aAllocator)
, mActor(nullptr)
@ -1467,7 +1458,7 @@ public:
int32_t readCount;
};
explicit ShmemTextureReadLock(ClientIPCAllocator* aAllocator);
explicit ShmemTextureReadLock(LayersIPCChannel* aAllocator);
~ShmemTextureReadLock();
@ -1485,9 +1476,8 @@ public:
mozilla::layers::ShmemSection& GetShmemSection() { return mShmemSection; }
ShmemTextureReadLock(ISurfaceAllocator* aAllocator, const mozilla::layers::ShmemSection& aShmemSection)
: mAllocator(aAllocator)
, mShmemSection(aShmemSection)
explicit ShmemTextureReadLock(const mozilla::layers::ShmemSection& aShmemSection)
: mShmemSection(aShmemSection)
, mAllocSuccess(true)
{
MOZ_COUNT_CTOR(ShmemTextureReadLock);
@ -1499,7 +1489,7 @@ public:
(mShmemSection.shmem().get<char>() + mShmemSection.offset());
}
RefPtr<ISurfaceAllocator> mAllocator;
RefPtr<LayersIPCChannel> mClientAllocator;
mozilla::layers::ShmemSection mShmemSection;
bool mAllocSuccess;
};
@ -1512,7 +1502,7 @@ TextureReadLock::Deserialize(const ReadLockDescriptor& aDescriptor, ISurfaceAllo
case ReadLockDescriptor::TShmemSection: {
const ShmemSection& section = aDescriptor.get_ShmemSection();
MOZ_RELEASE_ASSERT(section.shmem().IsReadable());
return MakeAndAddRef<ShmemTextureReadLock>(aAllocator, section);
return MakeAndAddRef<ShmemTextureReadLock>(section);
}
case ReadLockDescriptor::Tuintptr_t: {
if (!aAllocator->IsSameProcess()) {
@ -1545,7 +1535,7 @@ TextureReadLock::Deserialize(const ReadLockDescriptor& aDescriptor, ISurfaceAllo
}
// static
already_AddRefed<TextureReadLock>
TextureReadLock::Create(ClientIPCAllocator* aAllocator)
TextureReadLock::Create(LayersIPCChannel* aAllocator)
{
if (aAllocator->IsSameProcess()) {
// If our compositor is in the same process, we can save some cycles by not
@ -1604,15 +1594,14 @@ MemoryTextureReadLock::GetReadCount()
return mReadCount;
}
ShmemTextureReadLock::ShmemTextureReadLock(ClientIPCAllocator* aAllocator)
: mAllocator(aAllocator)
ShmemTextureReadLock::ShmemTextureReadLock(LayersIPCChannel* aAllocator)
: mClientAllocator(aAllocator)
, mAllocSuccess(false)
{
MOZ_COUNT_CTOR(ShmemTextureReadLock);
MOZ_ASSERT(mAllocator);
MOZ_ASSERT(mAllocator->AsTextureForwarder());
MOZ_ASSERT(mClientAllocator);
#define MOZ_ALIGN_WORD(x) (((x) + 3) & ~3)
if (mAllocator->AsTextureForwarder()->GetTileLockAllocator()->AllocShmemSection(
if (mClientAllocator->GetTileLockAllocator()->AllocShmemSection(
MOZ_ALIGN_WORD(sizeof(ShmReadLockInfo)), &mShmemSection)) {
ShmReadLockInfo* info = GetShmReadLockInfoPtr();
info->readCount = 1;
@ -1622,8 +1611,7 @@ ShmemTextureReadLock::ShmemTextureReadLock(ClientIPCAllocator* aAllocator)
ShmemTextureReadLock::~ShmemTextureReadLock()
{
auto fwd = mAllocator->AsTextureForwarder();
if (fwd) {
if (mClientAllocator) {
// Release one read count that is added in constructor.
// The count is kept for calling GetReadCount() by TextureClientPool.
ReadUnlock();
@ -1657,9 +1645,8 @@ ShmemTextureReadLock::ReadUnlock() {
int32_t readCount = PR_ATOMIC_DECREMENT(&info->readCount);
MOZ_ASSERT(readCount >= 0);
if (readCount <= 0) {
auto fwd = mAllocator->AsTextureForwarder();
if (fwd) {
fwd->GetTileLockAllocator()->DeallocShmemSection(mShmemSection);
if (mClientAllocator) {
mClientAllocator->GetTileLockAllocator()->DeallocShmemSection(mShmemSection);
} else {
// we are on the compositor process
FixedSizeSmallShmemSectionAllocator::FreeShmemSection(mShmemSection);
@ -1738,7 +1725,7 @@ SyncObject::CreateSyncObject(SyncHandle aHandle)
}
already_AddRefed<TextureClient>
TextureClient::CreateWithData(TextureData* aData, TextureFlags aFlags, ClientIPCAllocator* aAllocator)
TextureClient::CreateWithData(TextureData* aData, TextureFlags aFlags, LayersIPCChannel* aAllocator)
{
if (!aData) {
return nullptr;

View File

@ -50,8 +50,9 @@ namespace layers {
class AsyncTransactionWaiter;
class BufferTextureData;
class CompositableForwarder;
class KnowsCompositor;
class GrallocTextureData;
class ClientIPCAllocator;
class LayersIPCChannel;
class CompositableClient;
struct PlanarYCbCrData;
class Image;
@ -213,7 +214,7 @@ public:
virtual bool IsValid() const = 0;
static already_AddRefed<TextureReadLock>
Create(ClientIPCAllocator* aAllocator);
Create(LayersIPCChannel* aAllocator);
static already_AddRefed<TextureReadLock>
Deserialize(const ReadLockDescriptor& aDescriptor, ISurfaceAllocator* aAllocator);
@ -269,15 +270,16 @@ public:
virtual bool BorrowMappedYCbCrData(MappedYCbCrTextureData&) { return false; }
virtual void Deallocate(ClientIPCAllocator* aAllocator) = 0;
virtual void Deallocate(LayersIPCChannel* aAllocator) = 0;
/// Depending on the texture's flags either Deallocate or Forget is called.
virtual void Forget(ClientIPCAllocator* aAllocator) {}
virtual void Forget(LayersIPCChannel* aAllocator) {}
virtual bool Serialize(SurfaceDescriptor& aDescriptor) = 0;
virtual TextureData*
CreateSimilar(ClientIPCAllocator* aAllocator,
CreateSimilar(LayersIPCChannel* aAllocator,
LayersBackend aLayersBackend,
TextureFlags aFlags = TextureFlags::DEFAULT,
TextureAllocationFlags aAllocFlags = ALLOC_DEFAULT) const { return nullptr; }
@ -331,26 +333,16 @@ class TextureClient
: public AtomicRefCountedWithFinalize<TextureClient>
{
public:
explicit TextureClient(TextureData* aData, TextureFlags aFlags, ClientIPCAllocator* aAllocator);
explicit TextureClient(TextureData* aData, TextureFlags aFlags, LayersIPCChannel* aAllocator);
virtual ~TextureClient();
static already_AddRefed<TextureClient>
CreateWithData(TextureData* aData, TextureFlags aFlags, ClientIPCAllocator* aAllocator);
CreateWithData(TextureData* aData, TextureFlags aFlags, LayersIPCChannel* aAllocator);
// Creates and allocates a TextureClient usable with Moz2D.
static already_AddRefed<TextureClient>
CreateForDrawing(TextureForwarder* aAllocator,
gfx::SurfaceFormat aFormat,
gfx::IntSize aSize,
LayersBackend aLayersBackend,
BackendSelector aSelector,
TextureFlags aTextureFlags,
TextureAllocationFlags aAllocFlags = ALLOC_DEFAULT);
// TODO: remove this one and use the one above instead.
static already_AddRefed<TextureClient>
CreateForDrawing(CompositableForwarder* aAllocator,
CreateForDrawing(KnowsCompositor* aAllocator,
gfx::SurfaceFormat aFormat,
gfx::IntSize aSize,
BackendSelector aSelector,
@ -358,16 +350,15 @@ public:
TextureAllocationFlags flags = ALLOC_DEFAULT);
static already_AddRefed<TextureClient>
CreateFromSurface(TextureForwarder* aAllocator,
CreateFromSurface(KnowsCompositor* aAllocator,
gfx::SourceSurface* aSurface,
LayersBackend aLayersBackend,
BackendSelector aSelector,
TextureFlags aTextureFlags,
TextureAllocationFlags aAllocFlags);
// Creates and allocates a TextureClient supporting the YCbCr format.
static already_AddRefed<TextureClient>
CreateForYCbCr(ClientIPCAllocator* aAllocator,
CreateForYCbCr(KnowsCompositor* aAllocator,
gfx::IntSize aYSize,
gfx::IntSize aCbCrSize,
StereoMode aStereoMode,
@ -376,17 +367,7 @@ public:
// Creates and allocates a TextureClient (can be accessed through raw
// pointers).
static already_AddRefed<TextureClient>
CreateForRawBufferAccess(ClientIPCAllocator* aAllocator,
gfx::SurfaceFormat aFormat,
gfx::IntSize aSize,
gfx::BackendType aMoz2dBackend,
LayersBackend aLayersBackend,
TextureFlags aTextureFlags,
TextureAllocationFlags flags = ALLOC_DEFAULT);
// TODO: remove this one and use the one above instead.
static already_AddRefed<TextureClient>
CreateForRawBufferAccess(ClientIPCAllocator* aAllocator,
CreateForRawBufferAccess(KnowsCompositor* aAllocator,
gfx::SurfaceFormat aFormat,
gfx::IntSize aSize,
gfx::BackendType aMoz2dBackend,
@ -397,13 +378,14 @@ public:
// pointers) with a certain buffer size. It's unfortunate that we need this.
// providing format and sizes could let us do more optimization.
static already_AddRefed<TextureClient>
CreateForYCbCrWithBufferSize(ClientIPCAllocator* aAllocator,
CreateForYCbCrWithBufferSize(KnowsCompositor* aAllocator,
size_t aSize,
TextureFlags aTextureFlags);
// Creates and allocates a TextureClient of the same type.
already_AddRefed<TextureClient>
CreateSimilar(TextureFlags aFlags = TextureFlags::DEFAULT,
CreateSimilar(LayersBackend aLayersBackend = LayersBackend::LAYERS_NONE,
TextureFlags aFlags = TextureFlags::DEFAULT,
TextureAllocationFlags aAllocFlags = ALLOC_DEFAULT) const;
/**
@ -580,7 +562,7 @@ public:
* Should be called only once per TextureClient.
* The TextureClient must not be locked when calling this method.
*/
bool InitIPDLActor(TextureForwarder* aForwarder);
bool InitIPDLActor(KnowsCompositor* aForwarder);
/**
* Return a pointer to the IPDLActor.
@ -650,7 +632,7 @@ public:
void SyncWithObject(SyncObject* aFence) { mData->SyncWithObject(aFence); }
ClientIPCAllocator* GetAllocator() { return mAllocator; }
LayersIPCChannel* GetAllocator() { return mAllocator; }
ITextureClientRecycleAllocator* GetRecycleAllocator() { return mRecycleAllocator; }
void SetRecycleAllocator(ITextureClientRecycleAllocator* aAllocator);
@ -707,6 +689,30 @@ public:
private:
static void TextureClientRecycleCallback(TextureClient* aClient, void* aClosure);
// Internal helpers for creating texture clients using the actual forwarder instead
// of KnowsCompositor. TextureClientPool uses these to let it cache texture clients
// per-process instead of per ShadowLayerForwarder, but everyone else should
// use the public functions instead.
friend class TextureClientPool;
static already_AddRefed<TextureClient>
CreateForDrawing(TextureForwarder* aAllocator,
gfx::SurfaceFormat aFormat,
gfx::IntSize aSize,
LayersBackend aLayersBackend,
int32_t aMaxTextureSize,
BackendSelector aSelector,
TextureFlags aTextureFlags,
TextureAllocationFlags aAllocFlags = ALLOC_DEFAULT);
static already_AddRefed<TextureClient>
CreateForRawBufferAccess(LayersIPCChannel* aAllocator,
gfx::SurfaceFormat aFormat,
gfx::IntSize aSize,
gfx::BackendType aMoz2dBackend,
LayersBackend aLayersBackend,
TextureFlags aTextureFlags,
TextureAllocationFlags flags = ALLOC_DEFAULT);
/**
* Called once, during the destruction of the Texture, on the thread in which
@ -735,7 +741,7 @@ protected:
TextureData::Info mInfo;
RefPtr<ClientIPCAllocator> mAllocator;
RefPtr<LayersIPCChannel> mAllocator;
RefPtr<TextureChild> mActor;
RefPtr<ITextureClientRecycleAllocator> mRecycleAllocator;
RefPtr<TextureReadLock> mReadLock;

View File

@ -38,6 +38,7 @@ ClearCallback(nsITimer *aTimer, void *aClosure)
}
TextureClientPool::TextureClientPool(LayersBackend aLayersBackend,
int32_t aMaxTextureSize,
gfx::SurfaceFormat aFormat,
gfx::IntSize aSize,
TextureFlags aFlags,
@ -47,6 +48,7 @@ TextureClientPool::TextureClientPool(LayersBackend aLayersBackend,
uint32_t aPoolUnusedSize,
TextureForwarder* aAllocator)
: mBackend(aLayersBackend)
, mMaxTextureSize(aMaxTextureSize)
, mFormat(aFormat)
, mSize(aSize)
, mFlags(aFlags)
@ -160,6 +162,7 @@ TextureClientPool::AllocateTextureClient()
TextureClient::CreateForDrawing(mSurfaceAllocator,
mFormat, mSize,
mBackend,
mMaxTextureSize,
BackendSelector::Content,
mFlags);
}

View File

@ -45,6 +45,7 @@ class TextureClientPool final : public TextureClientAllocator
public:
TextureClientPool(LayersBackend aBackend,
int32_t aMaxTextureSize,
gfx::SurfaceFormat aFormat,
gfx::IntSize aSize,
TextureFlags aFlags,
@ -102,6 +103,7 @@ public:
void Clear();
LayersBackend GetBackend() const { return mBackend; }
int32_t GetMaxTextureSize() const { return mMaxTextureSize; }
gfx::SurfaceFormat GetFormat() { return mFormat; }
TextureFlags GetFlags() const { return mFlags; }
@ -122,6 +124,9 @@ private:
/// Backend passed to the TextureClient for buffer creation.
LayersBackend mBackend;
// Max texture size passed to the TextureClient for buffer creation.
int32_t mMaxTextureSize;
/// Format is passed to the TextureClient for buffer creation.
gfx::SurfaceFormat mFormat;

View File

@ -72,7 +72,7 @@ public:
return true;
}
already_AddRefed<TextureClient> Allocate(TextureForwarder* aAllocator) override
already_AddRefed<TextureClient> Allocate(KnowsCompositor* aAllocator) override
{
return mAllocator->Allocate(mFormat,
mSize,
@ -114,7 +114,7 @@ YCbCrTextureClientAllocationHelper::IsCompatible(TextureClient* aTextureClient)
}
already_AddRefed<TextureClient>
YCbCrTextureClientAllocationHelper::Allocate(TextureForwarder* aAllocator)
YCbCrTextureClientAllocationHelper::Allocate(KnowsCompositor* aAllocator)
{
return TextureClient::CreateForYCbCr(aAllocator,
mData.mYSize, mData.mCbCrSize,
@ -122,7 +122,7 @@ YCbCrTextureClientAllocationHelper::Allocate(TextureForwarder* aAllocator)
mTextureFlags);
}
TextureClientRecycleAllocator::TextureClientRecycleAllocator(TextureForwarder* aAllocator)
TextureClientRecycleAllocator::TextureClientRecycleAllocator(KnowsCompositor* aAllocator)
: mSurfaceAllocator(aAllocator)
, mMaxPooledSize(kMaxPooledSized)
, mLock("TextureClientRecycleAllocatorImp.mLock")
@ -189,7 +189,7 @@ TextureClientRecycleAllocator::CreateOrRecycle(ITextureClientAllocationHelper& a
RefPtr<Runnable> task = new TextureClientReleaseTask(textureHolder->GetTextureClient());
textureHolder->ClearTextureClient();
textureHolder = nullptr;
mSurfaceAllocator->GetMessageLoop()->PostTask(task.forget());
mSurfaceAllocator->GetTextureForwarder()->GetMessageLoop()->PostTask(task.forget());
} else {
textureHolder->GetTextureClient()->RecycleTexture(aHelper.mTextureFlags);
}
@ -227,7 +227,6 @@ TextureClientRecycleAllocator::Allocate(gfx::SurfaceFormat aFormat,
TextureAllocationFlags aAllocFlags)
{
return TextureClient::CreateForDrawing(mSurfaceAllocator, aFormat, aSize,
mSurfaceAllocator->GetCompositorBackendType(),
aSelector, aTextureFlags, aAllocFlags);
}

View File

@ -48,7 +48,7 @@ public:
, mAllocationFlags(aAllocationFlags)
{}
virtual already_AddRefed<TextureClient> Allocate(TextureForwarder* aAllocator) = 0;
virtual already_AddRefed<TextureClient> Allocate(KnowsCompositor* aAllocator) = 0;
virtual bool IsCompatible(TextureClient* aTextureClient) = 0;
const gfx::SurfaceFormat mFormat;
@ -66,7 +66,7 @@ public:
bool IsCompatible(TextureClient* aTextureClient) override;
already_AddRefed<TextureClient> Allocate(TextureForwarder* aAllocator) override;
already_AddRefed<TextureClient> Allocate(KnowsCompositor* aAllocator) override;
protected:
const PlanarYCbCrData& mData;
@ -88,7 +88,7 @@ protected:
virtual ~TextureClientRecycleAllocator();
public:
explicit TextureClientRecycleAllocator(TextureForwarder* aAllocator);
explicit TextureClientRecycleAllocator(KnowsCompositor* aAllocator);
void SetMaxPoolSize(uint32_t aMax);
@ -115,7 +115,7 @@ protected:
TextureFlags aTextureFlags,
TextureAllocationFlags aAllocFlags);
RefPtr<TextureForwarder> mSurfaceAllocator;
RefPtr<KnowsCompositor> mSurfaceAllocator;
friend class DefaultTextureClientAllocationHelper;
void RecycleTextureClient(TextureClient* aClient) override;

View File

@ -32,7 +32,7 @@ SharedSurfaceTextureData::~SharedSurfaceTextureData()
{}
void
SharedSurfaceTextureData::Deallocate(ClientIPCAllocator*)
SharedSurfaceTextureData::Deallocate(LayersIPCChannel*)
{}
void
@ -55,7 +55,7 @@ SharedSurfaceTextureData::Serialize(SurfaceDescriptor& aOutDescriptor)
SharedSurfaceTextureClient::SharedSurfaceTextureClient(SharedSurfaceTextureData* aData,
TextureFlags aFlags,
ClientIPCAllocator* aAllocator)
LayersIPCChannel* aAllocator)
: TextureClient(aData, aFlags, aAllocator)
{
mWorkaroundAnnoyingSharedSurfaceLifetimeIssues = true;
@ -63,7 +63,7 @@ SharedSurfaceTextureClient::SharedSurfaceTextureClient(SharedSurfaceTextureData*
already_AddRefed<SharedSurfaceTextureClient>
SharedSurfaceTextureClient::Create(UniquePtr<gl::SharedSurface> surf, gl::SurfaceFactory* factory,
ClientIPCAllocator* aAllocator, TextureFlags aFlags)
LayersIPCChannel* aAllocator, TextureFlags aFlags)
{
if (!surf) {
return nullptr;

View File

@ -48,7 +48,7 @@ public:
virtual bool Serialize(SurfaceDescriptor& aOutDescriptor) override;
virtual void Deallocate(ClientIPCAllocator*) override;
virtual void Deallocate(LayersIPCChannel*) override;
gl::SharedSurface* Surf() const { return mSurf.get(); }
};
@ -58,13 +58,13 @@ class SharedSurfaceTextureClient : public TextureClient
public:
SharedSurfaceTextureClient(SharedSurfaceTextureData* aData,
TextureFlags aFlags,
ClientIPCAllocator* aAllocator);
LayersIPCChannel* aAllocator);
~SharedSurfaceTextureClient();
static already_AddRefed<SharedSurfaceTextureClient>
Create(UniquePtr<gl::SharedSurface> surf, gl::SurfaceFactory* factory,
ClientIPCAllocator* aAllocator, TextureFlags aFlags);
LayersIPCChannel* aAllocator, TextureFlags aFlags);
virtual void SetReleaseFenceHandle(const FenceHandle& aReleaseFenceHandle) override;

View File

@ -1057,7 +1057,7 @@ ClientMultiTiledLayerBuffer::ValidateTile(TileClient& aTile,
if (!aTile.mAllocator) {
aTile.SetTextureAllocator(mManager->GetCompositorBridgeChild()->GetTexturePool(
mManager->GetCompositorBackendType(),
mManager->AsShadowForwarder(),
gfxPlatform::GetPlatform()->Optimal2DFormatForContent(content),
TextureFlags::DISALLOW_BIGIMAGE | TextureFlags::IMMEDIATE_UPLOAD));
MOZ_ASSERT(aTile.mAllocator);

View File

@ -457,7 +457,7 @@ D3D11TextureData::Create(SourceSurface* aSurface,
}
void
D3D11TextureData::Deallocate(ClientIPCAllocator* aAllocator)
D3D11TextureData::Deallocate(LayersIPCChannel* aAllocator)
{
mDrawTarget = nullptr;
mTexture = nullptr;
@ -467,7 +467,7 @@ already_AddRefed<TextureClient>
CreateD3D11TextureClientWithDevice(IntSize aSize, SurfaceFormat aFormat,
TextureFlags aTextureFlags, TextureAllocationFlags aAllocFlags,
ID3D11Device* aDevice,
ClientIPCAllocator* aAllocator)
LayersIPCChannel* aAllocator)
{
TextureData* data = D3D11TextureData::Create(aSize, aFormat, aAllocFlags, aDevice);
if (!data) {
@ -477,7 +477,8 @@ CreateD3D11TextureClientWithDevice(IntSize aSize, SurfaceFormat aFormat,
}
TextureData*
D3D11TextureData::CreateSimilar(ClientIPCAllocator* aAllocator,
D3D11TextureData::CreateSimilar(LayersIPCChannel* aAllocator,
LayersBackend aLayersBackend,
TextureFlags aFlags,
TextureAllocationFlags aAllocFlags) const
{
@ -491,8 +492,7 @@ D3D11TextureData::GetDXGIResource(IDXGIResource** aOutResource)
}
DXGIYCbCrTextureData*
DXGIYCbCrTextureData::Create(ClientIPCAllocator* aAllocator,
TextureFlags aFlags,
DXGIYCbCrTextureData::Create(TextureFlags aFlags,
IUnknown* aTextureY,
IUnknown* aTextureCb,
IUnknown* aTextureCr,
@ -523,8 +523,7 @@ DXGIYCbCrTextureData::Create(ClientIPCAllocator* aAllocator,
}
DXGIYCbCrTextureData*
DXGIYCbCrTextureData::Create(ClientIPCAllocator* aAllocator,
TextureFlags aFlags,
DXGIYCbCrTextureData::Create(TextureFlags aFlags,
ID3D11Texture2D* aTextureY,
ID3D11Texture2D* aTextureCb,
ID3D11Texture2D* aTextureCr,
@ -568,7 +567,7 @@ DXGIYCbCrTextureData::Create(ClientIPCAllocator* aAllocator,
return nullptr;
}
return DXGIYCbCrTextureData::Create(aAllocator, aFlags,
return DXGIYCbCrTextureData::Create(aFlags,
aTextureY, aTextureCb, aTextureCr,
handleY, handleCb, handleCr,
aSize, aSizeY, aSizeCbCr);
@ -595,7 +594,7 @@ DXGIYCbCrTextureData::Serialize(SurfaceDescriptor& aOutDescriptor)
}
void
DXGIYCbCrTextureData::Deallocate(ClientIPCAllocator*)
DXGIYCbCrTextureData::Deallocate(LayersIPCChannel*)
{
mHoldRefs[0] = nullptr;
mHoldRefs[1] = nullptr;

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