зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1447828 part 7 - Remove StyleBackendType uses from PreloadedStyleSheet. r=emilio
MozReview-Commit-ID: L37tnRAAJbQ --HG-- extra : rebase_source : 1d073c4fadcc8372b5afe55f648bcb1c276f4de2 extra : source : 09e1b57c52fbfe3145b47d80ac098c487970d8b4
This commit is contained in:
Родитель
d81392eca1
Коммит
5c55e4b983
|
@ -3541,7 +3541,7 @@ nsDOMWindowUtils::AddSheet(nsIPreloadedStyleSheet* aSheet, uint32_t aSheetType)
|
|||
|
||||
StyleSheet* sheet = nullptr;
|
||||
auto preloadedSheet = static_cast<PreloadedStyleSheet*>(aSheet);
|
||||
nsresult rv = preloadedSheet->GetSheet(doc->GetStyleBackendType(), &sheet);
|
||||
nsresult rv = preloadedSheet->GetSheet(&sheet);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
NS_ENSURE_TRUE(sheet, NS_ERROR_FAILURE);
|
||||
|
||||
|
|
|
@ -45,26 +45,23 @@ NS_INTERFACE_MAP_END
|
|||
NS_IMPL_CYCLE_COLLECTING_ADDREF(PreloadedStyleSheet)
|
||||
NS_IMPL_CYCLE_COLLECTING_RELEASE(PreloadedStyleSheet)
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION(PreloadedStyleSheet, mGecko, mServo)
|
||||
NS_IMPL_CYCLE_COLLECTION(PreloadedStyleSheet, mSheet)
|
||||
|
||||
nsresult
|
||||
PreloadedStyleSheet::GetSheet(StyleBackendType aType, StyleSheet** aResult)
|
||||
PreloadedStyleSheet::GetSheet(StyleSheet** aResult)
|
||||
{
|
||||
*aResult = nullptr;
|
||||
|
||||
MOZ_DIAGNOSTIC_ASSERT(mLoaded);
|
||||
|
||||
RefPtr<StyleSheet>& sheet =
|
||||
aType == StyleBackendType::Gecko ? mGecko : mServo;
|
||||
|
||||
if (!sheet) {
|
||||
if (!mSheet) {
|
||||
RefPtr<css::Loader> loader = new css::Loader;
|
||||
nsresult rv = loader->LoadSheetSync(mURI, mParsingMode, true, &sheet);
|
||||
nsresult rv = loader->LoadSheetSync(mURI, mParsingMode, true, &mSheet);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
MOZ_ASSERT(sheet);
|
||||
MOZ_ASSERT(mSheet);
|
||||
}
|
||||
|
||||
*aResult = sheet;
|
||||
*aResult = mSheet;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -88,7 +85,7 @@ PreloadedStyleSheet::Preload()
|
|||
mLoaded = true;
|
||||
|
||||
StyleSheet* sheet;
|
||||
return GetSheet(StyleBackendType::Servo, &sheet);
|
||||
return GetSheet(&sheet);
|
||||
}
|
||||
|
||||
NS_IMPL_ISUPPORTS(PreloadedStyleSheet::StylesheetPreloadObserver,
|
||||
|
@ -117,14 +114,12 @@ PreloadedStyleSheet::PreloadAsync(NotNull<dom::Promise*> aPromise)
|
|||
{
|
||||
MOZ_DIAGNOSTIC_ASSERT(!mLoaded);
|
||||
|
||||
RefPtr<StyleSheet>& sheet = mServo;
|
||||
|
||||
RefPtr<css::Loader> loader = new css::Loader;
|
||||
|
||||
RefPtr<StylesheetPreloadObserver> obs =
|
||||
new StylesheetPreloadObserver(aPromise, this);
|
||||
|
||||
return loader->LoadSheet(mURI, mParsingMode, false, obs, &sheet);
|
||||
return loader->LoadSheet(mURI, mParsingMode, false, obs, &mSheet);
|
||||
}
|
||||
|
||||
} // namespace mozilla
|
||||
|
|
|
@ -12,7 +12,6 @@
|
|||
#include "mozilla/css/SheetParsingMode.h"
|
||||
#include "mozilla/NotNull.h"
|
||||
#include "mozilla/Result.h"
|
||||
#include "mozilla/StyleBackendType.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsCycleCollectionParticipant.h"
|
||||
#include "nsICSSLoaderObserver.h"
|
||||
|
@ -39,7 +38,7 @@ public:
|
|||
|
||||
// *aResult is not addrefed, since the PreloadedStyleSheet holds a strong
|
||||
// reference to the sheet.
|
||||
nsresult GetSheet(StyleBackendType aType, StyleSheet** aResult);
|
||||
nsresult GetSheet(StyleSheet** aResult);
|
||||
|
||||
nsresult Preload();
|
||||
nsresult PreloadAsync(NotNull<dom::Promise*> aPromise);
|
||||
|
@ -73,8 +72,7 @@ private:
|
|||
RefPtr<PreloadedStyleSheet> mPreloadedSheet;
|
||||
};
|
||||
|
||||
RefPtr<StyleSheet> mGecko;
|
||||
RefPtr<StyleSheet> mServo;
|
||||
RefPtr<StyleSheet> mSheet;
|
||||
|
||||
bool mLoaded;
|
||||
nsCOMPtr<nsIURI> mURI;
|
||||
|
|
Загрузка…
Ссылка в новой задаче