diff options
Diffstat (limited to 'gfx/thebes')
-rw-r--r-- | gfx/thebes/DeviceManagerDx.cpp | 8 | ||||
-rw-r--r-- | gfx/thebes/gfxDWriteFontList.cpp | 12 | ||||
-rw-r--r-- | gfx/thebes/gfxFT2FontList.cpp | 15 | ||||
-rw-r--r-- | gfx/thebes/gfxFT2FontList.h | 3 | ||||
-rw-r--r-- | gfx/thebes/gfxFont.cpp | 10 | ||||
-rw-r--r-- | gfx/thebes/gfxFontconfigFonts.cpp | 7 | ||||
-rw-r--r-- | gfx/thebes/gfxGDIFontList.cpp | 2 | ||||
-rw-r--r-- | gfx/thebes/gfxGradientCache.cpp | 2 | ||||
-rw-r--r-- | gfx/thebes/gfxMacPlatformFontList.mm | 7 | ||||
-rw-r--r-- | gfx/thebes/gfxMatrix.h | 12 | ||||
-rw-r--r-- | gfx/thebes/gfxPlatform.cpp | 68 | ||||
-rw-r--r-- | gfx/thebes/gfxPlatformFontList.cpp | 22 | ||||
-rw-r--r-- | gfx/thebes/gfxPlatformGtk.cpp | 13 | ||||
-rw-r--r-- | gfx/thebes/gfxPrefs.h | 1 | ||||
-rw-r--r-- | gfx/thebes/gfxSVGGlyphs.cpp | 38 | ||||
-rw-r--r-- | gfx/thebes/gfxUserFontSet.cpp | 14 | ||||
-rwxr-xr-x | gfx/thebes/gfxWindowsPlatform.cpp | 28 | ||||
-rw-r--r-- | gfx/thebes/gfxWindowsPlatform.h | 2 |
18 files changed, 75 insertions, 189 deletions
diff --git a/gfx/thebes/DeviceManagerDx.cpp b/gfx/thebes/DeviceManagerDx.cpp index 2f2693c76..9f42974c3 100644 --- a/gfx/thebes/DeviceManagerDx.cpp +++ b/gfx/thebes/DeviceManagerDx.cpp @@ -10,7 +10,6 @@ #include "gfxPrefs.h" #include "gfxWindowsPlatform.h" #include "mozilla/D3DMessageUtils.h" -#include "mozilla/Telemetry.h" #include "mozilla/WindowsVersion.h" #include "mozilla/gfx/GraphicsMessages.h" #include "mozilla/gfx/Logging.h" @@ -456,13 +455,11 @@ DeviceManagerDx::CreateContentDevice() : D3D_DRIVER_TYPE_UNKNOWN; if (!CreateDevice(adapter, type, flags, hr, device)) { gfxCriticalNote << "Recovered from crash while creating a D3D11 content device"; - gfxWindowsPlatform::RecordContentDeviceFailure(TelemetryDeviceCode::Content); return FeatureStatus::CrashedInHandler; } if (FAILED(hr) || !device) { gfxCriticalNote << "Failed to create a D3D11 content device: " << hexa(hr); - gfxWindowsPlatform::RecordContentDeviceFailure(TelemetryDeviceCode::Content); return FeatureStatus::Failed; } @@ -589,10 +586,6 @@ DeviceManagerDx::MaybeResetAndReacquireDevices() return false; } - if (resetReason != DeviceResetReason::FORCED_RESET) { - Telemetry::Accumulate(Telemetry::DEVICE_RESET_REASON, uint32_t(resetReason)); - } - bool createCompositorDevice = !!mCompositorDevice; bool createContentDevice = !!mContentDevice; @@ -724,7 +717,6 @@ DeviceManagerDx::GetAnyDeviceRemovedReason(DeviceResetReason* aOutReason) void DeviceManagerDx::ForceDeviceReset(ForcedDeviceResetReason aReason) { - Telemetry::Accumulate(Telemetry::FORCED_DEVICE_RESET_REASON, uint32_t(aReason)); { MutexAutoLock lock(mDeviceLock); mDeviceResetReason = Some(DeviceResetReason::FORCED_RESET); diff --git a/gfx/thebes/gfxDWriteFontList.cpp b/gfx/thebes/gfxDWriteFontList.cpp index d159fddb1..5cc1fbb92 100644 --- a/gfx/thebes/gfxDWriteFontList.cpp +++ b/gfx/thebes/gfxDWriteFontList.cpp @@ -14,7 +14,6 @@ #include "nsCharSeparatedTokenizer.h" #include "mozilla/Preferences.h" #include "mozilla/Sprintf.h" -#include "mozilla/Telemetry.h" #include "nsDirectoryServiceUtils.h" #include "nsDirectoryServiceDefs.h" #include "nsAppDirectoryServiceDefs.h" @@ -864,8 +863,6 @@ gfxDWriteFontList::InitFontListForPlatform() hr = gfxWindowsPlatform::GetPlatform()->GetDWriteFactory()-> GetGdiInterop(getter_AddRefs(mGDIInterop)); if (FAILED(hr)) { - Telemetry::Accumulate(Telemetry::DWRITEFONT_INIT_PROBLEM, - uint32_t(errGDIInterop)); return NS_ERROR_FAILURE; } @@ -878,8 +875,6 @@ gfxDWriteFontList::InitFontListForPlatform() NS_ASSERTION(SUCCEEDED(hr), "GetSystemFontCollection failed!"); if (FAILED(hr)) { - Telemetry::Accumulate(Telemetry::DWRITEFONT_INIT_PROBLEM, - uint32_t(errSystemFontCollection)); return NS_ERROR_FAILURE; } @@ -891,8 +886,6 @@ gfxDWriteFontList::InitFontListForPlatform() NS_ASSERTION(mFontFamilies.Count() != 0, "no fonts found in the system fontlist -- holy crap batman!"); if (mFontFamilies.Count() == 0) { - Telemetry::Accumulate(Telemetry::DWRITEFONT_INIT_PROBLEM, - uint32_t(errNoFonts)); return NS_ERROR_FAILURE; } @@ -1001,9 +994,6 @@ gfxDWriteFontList::InitFontListForPlatform() } elapsedTime = (t5.QuadPart - t1.QuadPart) * 1000.0 / frequency.QuadPart; - Telemetry::Accumulate(Telemetry::DWRITEFONT_DELAYEDINITFONTLIST_TOTAL, elapsedTime); - Telemetry::Accumulate(Telemetry::DWRITEFONT_DELAYEDINITFONTLIST_COUNT, - mSystemFonts->GetFontFamilyCount()); LOG_FONTINIT(( "(fontinit) Total time in InitFontList: %9.3f ms (families: %d, %s)\n", elapsedTime, mSystemFonts->GetFontFamilyCount(), @@ -1013,7 +1003,6 @@ gfxDWriteFontList::InitFontListForPlatform() LOG_FONTINIT(("(fontinit) --- base/interop obj initialization init: %9.3f ms\n", elapsedTime)); elapsedTime = (t3.QuadPart - t2.QuadPart) * 1000.0 / frequency.QuadPart; - Telemetry::Accumulate(Telemetry::DWRITEFONT_DELAYEDINITFONTLIST_COLLECT, elapsedTime); LOG_FONTINIT(("(fontinit) --- GetSystemFontCollection: %9.3f ms\n", elapsedTime)); elapsedTime = (t4.QuadPart - t3.QuadPart) * 1000.0 / frequency.QuadPart; @@ -1455,7 +1444,6 @@ gfxDWriteFontList::PlatformGlobalFontFallback(const uint32_t aCh, *aMatchedFamily = family; return fontEntry; } - Telemetry::Accumulate(Telemetry::BAD_FALLBACK_FONT, true); } return nullptr; diff --git a/gfx/thebes/gfxFT2FontList.cpp b/gfx/thebes/gfxFT2FontList.cpp index 8a652df0d..09c938a24 100644 --- a/gfx/thebes/gfxFT2FontList.cpp +++ b/gfx/thebes/gfxFT2FontList.cpp @@ -812,6 +812,15 @@ public: : mFontList(aFontList) { } + void Remove() + { + nsCOMPtr<nsIObserverService> obs = services::GetObserverService(); + if (obs) { + obs->RemoveObserver(this, NS_XPCOM_WILL_SHUTDOWN_OBSERVER_ID); + } + mFontList = nullptr; + } + protected: virtual ~WillShutdownObserver() { } @@ -847,11 +856,7 @@ gfxFT2FontList::gfxFT2FontList() gfxFT2FontList::~gfxFT2FontList() { if (mObserver) { - nsCOMPtr<nsIObserverService> obs = services::GetObserverService(); - if (obs) { - obs->RemoveObserver(mObserver, NS_XPCOM_WILL_SHUTDOWN_OBSERVER_ID); - } - mObserver = nullptr; + mObserver->Remove(); } } diff --git a/gfx/thebes/gfxFT2FontList.h b/gfx/thebes/gfxFT2FontList.h index 63187ba26..9fb566c15 100644 --- a/gfx/thebes/gfxFT2FontList.h +++ b/gfx/thebes/gfxFT2FontList.h @@ -19,6 +19,7 @@ using mozilla::dom::FontListEntry; class FontNameCache; typedef struct FT_FaceRec_* FT_Face; class nsZipArchive; +class WillShutdownObserver; class FT2FontEntry : public gfxFontEntry { @@ -194,7 +195,7 @@ private: mozilla::UniquePtr<FontNameCache> mFontNameCache; int64_t mJarModifiedTime; - nsCOMPtr<nsIObserver> mObserver; + RefPtr<WillShutdownObserver> mObserver; }; #endif /* GFX_FT2FONTLIST_H */ diff --git a/gfx/thebes/gfxFont.cpp b/gfx/thebes/gfxFont.cpp index d0b747fff..490a866db 100644 --- a/gfx/thebes/gfxFont.cpp +++ b/gfx/thebes/gfxFont.cpp @@ -36,7 +36,6 @@ #include "mozilla/MemoryReporting.h" #include "mozilla/Preferences.h" #include "mozilla/Services.h" -#include "mozilla/Telemetry.h" #include "gfxMathTable.h" #include "gfxSVGGlyphs.h" #include "gfx2DGlue.h" @@ -229,7 +228,6 @@ gfxFontCache::Lookup(const gfxFontEntry* aFontEntry, Key key(aFontEntry, aStyle, aUnicodeRangeMap); HashEntry *entry = mFonts.GetEntry(key); - Telemetry::Accumulate(Telemetry::FONT_CACHE_HIT, entry != nullptr); if (!entry) return nullptr; @@ -2574,13 +2572,8 @@ gfxFont::GetShapedWord(DrawTarget *aDrawTarget, } gfxShapedWord* sw = entry->mShapedWord.get(); - bool isContent = !mStyle.systemFont; - if (sw) { sw->ResetAge(); - Telemetry::Accumulate((isContent ? Telemetry::WORD_CACHE_HITS_CONTENT : - Telemetry::WORD_CACHE_HITS_CHROME), - aLength); #ifndef RELEASE_OR_BETA if (aTextPerf) { aTextPerf->current.wordCacheHit++; @@ -2589,9 +2582,6 @@ gfxFont::GetShapedWord(DrawTarget *aDrawTarget, return sw; } - Telemetry::Accumulate((isContent ? Telemetry::WORD_CACHE_MISSES_CONTENT : - Telemetry::WORD_CACHE_MISSES_CHROME), - aLength); #ifndef RELEASE_OR_BETA if (aTextPerf) { aTextPerf->current.wordCacheMiss++; diff --git a/gfx/thebes/gfxFontconfigFonts.cpp b/gfx/thebes/gfxFontconfigFonts.cpp index bbcbbabf9..9caecc4c0 100644 --- a/gfx/thebes/gfxFontconfigFonts.cpp +++ b/gfx/thebes/gfxFontconfigFonts.cpp @@ -1096,15 +1096,8 @@ gfxFcFontSet::SortPreferredFonts(bool &aWaitForUserFont) FcFontSet *sets[1] = { fontSet }; FcResult result; -#ifdef SOLARIS - // Get around a crash of FcFontSetSort when FcConfig is nullptr - // Solaris's FcFontSetSort needs an FcConfig (bug 474758) - fontSet.own(FcFontSetSort(FcConfigGetCurrent(), sets, 1, mSortPattern, - FcFalse, nullptr, &result)); -#else fontSet.own(FcFontSetSort(nullptr, sets, 1, mSortPattern, FcFalse, nullptr, &result)); -#endif if (truncateMarker != nullptr && fontSet) { nsAutoRef<FcFontSet> truncatedSet(FcFontSetCreate()); diff --git a/gfx/thebes/gfxGDIFontList.cpp b/gfx/thebes/gfxGDIFontList.cpp index cc047ef38..f65334fe6 100644 --- a/gfx/thebes/gfxGDIFontList.cpp +++ b/gfx/thebes/gfxGDIFontList.cpp @@ -637,8 +637,6 @@ gfxGDIFontList::GetFontSubstitutes() nsresult gfxGDIFontList::InitFontListForPlatform() { - Telemetry::AutoTimer<Telemetry::GDI_INITFONTLIST_TOTAL> timer; - mFontSubstitutes.Clear(); mNonExistingFonts.Clear(); diff --git a/gfx/thebes/gfxGradientCache.cpp b/gfx/thebes/gfxGradientCache.cpp index fa25bd78c..bfa82685c 100644 --- a/gfx/thebes/gfxGradientCache.cpp +++ b/gfx/thebes/gfxGradientCache.cpp @@ -8,7 +8,6 @@ #include "PLDHashTable.h" #include "nsExpirationTracker.h" #include "nsClassHashtable.h" -#include "mozilla/Telemetry.h" #include "gfxGradientCache.h" #include <time.h> @@ -127,7 +126,6 @@ class GradientCache final : public nsExpirationTracker<GradientCacheData,4> { srand(time(nullptr)); mTimerPeriod = rand() % MAX_GENERATION_MS + 1; - Telemetry::Accumulate(Telemetry::GRADIENT_RETENTION_TIME, mTimerPeriod); } virtual void NotifyExpired(GradientCacheData* aObject) diff --git a/gfx/thebes/gfxMacPlatformFontList.mm b/gfx/thebes/gfxMacPlatformFontList.mm index bf958a90b..4536ab527 100644 --- a/gfx/thebes/gfxMacPlatformFontList.mm +++ b/gfx/thebes/gfxMacPlatformFontList.mm @@ -65,7 +65,6 @@ #include "mozilla/MemoryReporting.h" #include "mozilla/Preferences.h" #include "mozilla/Sprintf.h" -#include "mozilla/Telemetry.h" #include "mozilla/gfx/2D.h" #include <unistd.h> @@ -738,8 +737,6 @@ gfxMacPlatformFontList::InitFontListForPlatform() { nsAutoreleasePool localPool; - Telemetry::AutoTimer<Telemetry::MAC_INITFONTLIST_TOTAL> timer; - // reset system font list mSystemFontFamilies.Clear(); @@ -1043,10 +1040,6 @@ gfxMacPlatformFontList::PlatformGlobalFontFallback(const uint32_t aCh, } } - if (cantUseFallbackFont) { - Telemetry::Accumulate(Telemetry::BAD_FALLBACK_FONT, cantUseFallbackFont); - } - ::CFRelease(str); return fontEntry; diff --git a/gfx/thebes/gfxMatrix.h b/gfx/thebes/gfxMatrix.h index 9282a22db..4f92262cc 100644 --- a/gfx/thebes/gfxMatrix.h +++ b/gfx/thebes/gfxMatrix.h @@ -112,6 +112,18 @@ public: _31 == 0.0 && _32 == 0.0; } + /* Returns true if the matrix is a rectilinear transformation (i.e. + * grid-aligned rectangles are transformed to grid-aligned rectangles) + */ + bool IsRectilinear() const { + if (FuzzyEqual(_12, 0) && FuzzyEqual(_21, 0)) { + return true; + } else if (FuzzyEqual(_22, 0) && FuzzyEqual(_11, 0)) { + return true; + } + return false; + } + /** * Inverts this matrix, if possible. Otherwise, the matrix is left * unchanged. diff --git a/gfx/thebes/gfxPlatform.cpp b/gfx/thebes/gfxPlatform.cpp index 171d1bec9..50d1fcb46 100644 --- a/gfx/thebes/gfxPlatform.cpp +++ b/gfx/thebes/gfxPlatform.cpp @@ -11,7 +11,6 @@ #include "mozilla/gfx/GPUProcessManager.h" #include "mozilla/gfx/GraphicsMessages.h" #include "mozilla/ClearOnShutdown.h" -#include "mozilla/Telemetry.h" #include "mozilla/TimeStamp.h" #include "mozilla/Unused.h" @@ -131,8 +130,6 @@ class mozilla::gl::SkiaGLGlue : public GenericAtomicRefCounted { #include "SoftwareVsyncSource.h" #include "nscore.h" // for NS_FREE_PERMANENT_DATA #include "mozilla/dom/ContentChild.h" -#include "gfxVR.h" -#include "VRManagerChild.h" #include "mozilla/gfx/GPUParent.h" #include "prsystem.h" @@ -351,52 +348,10 @@ void CrashStatsLogForwarder::Log(const std::string& aString) } } -class CrashTelemetryEvent : public Runnable -{ - virtual ~CrashTelemetryEvent() {} - - NS_DECL_ISUPPORTS_INHERITED - - explicit CrashTelemetryEvent(uint32_t aReason) : mReason(aReason) {} - - NS_IMETHOD Run() override { - MOZ_ASSERT(NS_IsMainThread()); - Telemetry::Accumulate(Telemetry::GFX_CRASH, mReason); - return NS_OK; - } - -protected: - uint32_t mReason; -}; - -NS_IMPL_ISUPPORTS_INHERITED0(CrashTelemetryEvent, Runnable); - void CrashStatsLogForwarder::CrashAction(LogReason aReason) { -#ifndef RELEASE_OR_BETA - // Non-release builds crash by default, but will use telemetry - // if this environment variable is present. - static bool useTelemetry = gfxEnv::GfxDevCrashTelemetry(); -#else - // Release builds use telemetry by default, but will crash instead - // if this environment variable is present. - static bool useTelemetry = !gfxEnv::GfxDevCrashMozCrash(); -#endif - - if (useTelemetry) { - // The callers need to assure that aReason is in the range - // that the telemetry call below supports. - if (NS_IsMainThread()) { - Telemetry::Accumulate(Telemetry::GFX_CRASH, (uint32_t)aReason); - } else { - nsCOMPtr<nsIRunnable> r1 = new CrashTelemetryEvent((uint32_t)aReason); - NS_DispatchToMainThread(r1); - } - } else { - // ignoring aReason, we can get the information we need from the stack - MOZ_CRASH("GFX_CRASH"); - } + MOZ_CRASH("GFX_CRASH"); } NS_IMPL_ISUPPORTS(SRGBOverrideObserver, nsIObserver, nsISupportsWeakReference) @@ -515,8 +470,6 @@ gfxPlatform::gfxPlatform() contentMask, BackendType::CAIRO); mTotalSystemMemory = PR_GetPhysicalMemorySize(); - - VRManager::ManagerInit(); } gfxPlatform* @@ -923,14 +876,12 @@ gfxPlatform::ShutdownLayersIPC() sLayersIPCIsUp = false; if (XRE_IsContentProcess()) { - gfx::VRManagerChild::ShutDown(); // cf bug 1215265. if (gfxPrefs::ChildProcessShutdown()) { layers::CompositorBridgeChild::ShutDown(); layers::ImageBridgeChild::ShutDown(); } } else if (XRE_IsParentProcess()) { - gfx::VRManagerChild::ShutDown(); layers::CompositorBridgeChild::ShutDown(); layers::ImageBridgeChild::ShutDown(); @@ -2403,13 +2354,13 @@ gfxPlatform::AsyncPanZoomEnabled() { #if !defined(MOZ_WIDGET_ANDROID) && !defined(MOZ_WIDGET_UIKIT) // For XUL applications (everything but Firefox on Android) we only want - // to use APZ when E10S is enabled. If we ever get input events off the - // main thread we can consider relaxing this requirement. - if (!BrowserTabsRemoteAutostart()) { + // to use APZ when E10S is enabled or when the user explicitly enable it. + if (BrowserTabsRemoteAutostart() || gfxPrefs::APZDesktopEnabled()) { + return gfxPrefs::AsyncPanZoomEnabledDoNotUseDirectly(); + } else { return false; } -#endif -#ifdef MOZ_WIDGET_ANDROID +#elif defined(MOZ_WIDGET_ANDROID) return true; #else return gfxPrefs::AsyncPanZoomEnabledDoNotUseDirectly(); @@ -2464,13 +2415,6 @@ gfxPlatform::NotifyCompositorCreated(LayersBackend aBackend) // Set the backend before we notify so it's available immediately. mCompositorBackend = aBackend; - - // Notify that we created a compositor, so telemetry can update. - NS_DispatchToMainThread(NS_NewRunnableFunction([] { - if (nsCOMPtr<nsIObserverService> obsvc = services::GetObserverService()) { - obsvc->NotifyObservers(nullptr, "compositor:created", nullptr); - } - })); } void diff --git a/gfx/thebes/gfxPlatformFontList.cpp b/gfx/thebes/gfxPlatformFontList.cpp index e12f4e197..5f7bbb832 100644 --- a/gfx/thebes/gfxPlatformFontList.cpp +++ b/gfx/thebes/gfxPlatformFontList.cpp @@ -21,7 +21,6 @@ #include "mozilla/Likely.h" #include "mozilla/MemoryReporting.h" #include "mozilla/Preferences.h" -#include "mozilla/Telemetry.h" #include "mozilla/TimeStamp.h" #include "mozilla/gfx/2D.h" @@ -322,9 +321,6 @@ gfxPlatformFontList::InitOtherFamilyNames() mOtherFamilyNamesInitialized = true; } TimeStamp end = TimeStamp::Now(); - Telemetry::AccumulateTimeDelta(Telemetry::FONTLIST_INITOTHERFAMILYNAMES, - start, end); - if (LOG_FONTINIT_ENABLED()) { TimeDuration elapsed = end - start; LOG_FONTINIT(("(fontinit) InitOtherFamilyNames took %8.2f ms %s", @@ -370,8 +366,6 @@ gfxPlatformFontList::SearchFamiliesForFaceName(const nsAString& aFaceName) lookup = FindFaceName(aFaceName); TimeStamp end = TimeStamp::Now(); - Telemetry::AccumulateTimeDelta(Telemetry::FONTLIST_INITFACENAMELISTS, - start, end); if (LOG_FONTINIT_ENABLED()) { TimeDuration elapsed = end - start; LOG_FONTINIT(("(fontinit) SearchFamiliesForFaceName took %8.2f ms %s %s", @@ -474,7 +468,7 @@ gfxPlatformFontList::GetFontList(nsIAtom *aLangGroup, { for (auto iter = mFontFamilies.Iter(); !iter.Done(); iter.Next()) { RefPtr<gfxFontFamily>& family = iter.Data(); - // use the first variation for now. This data should be the same + // use the first variation for now. This data should be the same // for all the variations and should probably be moved up to // the Family gfxFontStyle style; @@ -582,20 +576,6 @@ gfxPlatformFontList::SystemFindFontForChar(uint32_t aCh, uint32_t aNextCh, } else if (aCh == 0xFFFD && fontEntry && fallbackFamily) { mReplacementCharFallbackFamily = fallbackFamily; } - - // track system fallback time - static bool first = true; - int32_t intElapsed = int32_t(first ? elapsed.ToMilliseconds() : - elapsed.ToMicroseconds()); - Telemetry::Accumulate((first ? Telemetry::SYSTEM_FONT_FALLBACK_FIRST : - Telemetry::SYSTEM_FONT_FALLBACK), - intElapsed); - first = false; - - // track the script for which fallback occurred (incremented one make it - // 1-based) - Telemetry::Accumulate(Telemetry::SYSTEM_FONT_FALLBACK_SCRIPT, - int(aRunScript) + 1); return fontEntry; } diff --git a/gfx/thebes/gfxPlatformGtk.cpp b/gfx/thebes/gfxPlatformGtk.cpp index be75332d6..6b5593524 100644 --- a/gfx/thebes/gfxPlatformGtk.cpp +++ b/gfx/thebes/gfxPlatformGtk.cpp @@ -156,7 +156,7 @@ gfxPlatformGtk::CreateOffscreenSurface(const IntSize& aSize, if (gdkScreen) { // When forcing PaintedLayers to use image surfaces for content, // force creation of gfxImageSurface surfaces. - if (gfxVars::UseXRender() && !UseImageOffscreenSurfaces()) { + if (gfxVars::UseXRender()) { Screen *screen = gdk_x11_screen_get_xscreen(gdkScreen); XRenderPictFormat* xrenderFormat = gfxXlibSurface::FindRenderFormat(DisplayOfScreen(screen), @@ -166,13 +166,6 @@ gfxPlatformGtk::CreateOffscreenSurface(const IntSize& aSize, newSurface = gfxXlibSurface::Create(screen, xrenderFormat, aSize); } - } else { - // We're not going to use XRender, so we don't need to - // search for a render format - newSurface = new gfxImageSurface(aSize, aFormat); - // The gfxImageSurface ctor zeroes this for us, no need to - // waste time clearing again - needsClear = false; } } #endif @@ -182,6 +175,10 @@ gfxPlatformGtk::CreateOffscreenSurface(const IntSize& aSize, // e.g., no display, no RENDER, bad size, etc. // Fall back to image surface for the data. newSurface = new gfxImageSurface(aSize, aFormat); + + // The gfxImageSurface ctor zeroes this for us, no need to + // waste time clearing again + needsClear = false; } if (newSurface->CairoStatus()) { diff --git a/gfx/thebes/gfxPrefs.h b/gfx/thebes/gfxPrefs.h index 359a258c7..1253fdb48 100644 --- a/gfx/thebes/gfxPrefs.h +++ b/gfx/thebes/gfxPrefs.h @@ -310,6 +310,7 @@ private: DECL_GFX_PREF(Live, "apz.y_stationary_size_multiplier", APZYStationarySizeMultiplier, float, 3.5f); DECL_GFX_PREF(Live, "apz.zoom_animation_duration_ms", APZZoomAnimationDuration, int32_t, 250); DECL_GFX_PREF(Live, "apz.scale_repaint_delay_ms", APZScaleRepaintDelay, int32_t, 500); + DECL_GFX_PREF(Once, "apz.desktop.enabled", APZDesktopEnabled, bool, false); DECL_GFX_PREF(Live, "browser.ui.zoom.force-user-scalable", ForceUserScalable, bool, false); DECL_GFX_PREF(Live, "browser.viewport.desktopWidth", DesktopViewportWidth, int32_t, 980); diff --git a/gfx/thebes/gfxSVGGlyphs.cpp b/gfx/thebes/gfxSVGGlyphs.cpp index a7615eca8..23f68f590 100644 --- a/gfx/thebes/gfxSVGGlyphs.cpp +++ b/gfx/thebes/gfxSVGGlyphs.cpp @@ -31,6 +31,7 @@ #include "nsSMILAnimationController.h" #include "gfxContext.h" #include "harfbuzz/hb.h" +#include "zlib.h" #include "mozilla/dom/ImageTracker.h" #define SVG_CONTENT_TYPE NS_LITERAL_CSTRING("image/svg+xml") @@ -285,7 +286,44 @@ gfxSVGGlyphsDocument::gfxSVGGlyphsDocument(const uint8_t *aBuffer, gfxSVGGlyphs *aSVGGlyphs) : mOwner(aSVGGlyphs) { + if (aBufLen >= 14 && aBuffer[0] == 31 && aBuffer[1] == 139) { + // It's a gzip-compressed document; decompress it before parsing. + // The original length (modulo 2^32) is found in the last 4 bytes + // of the data, stored in little-endian format. We read it as + // individual bytes to avoid possible alignment issues. + // (Note that if the original length was >2^32, then origLen here + // will be incorrect; but then the inflate() call will not return + // Z_STREAM_END and we'll bail out safely.) + size_t origLen = (size_t(aBuffer[aBufLen - 1]) << 24) + + (size_t(aBuffer[aBufLen - 2]) << 16) + + (size_t(aBuffer[aBufLen - 3]) << 8) + + size_t(aBuffer[aBufLen - 4]); + AutoTArray<uint8_t, 4096> outBuf; + if (outBuf.SetLength(origLen, mozilla::fallible)) { + z_stream s = {0}; + s.next_in = const_cast<Byte*>(aBuffer); + s.avail_in = aBufLen; + s.next_out = outBuf.Elements(); + s.avail_out = outBuf.Length(); + // The magic number 16 here is the zlib flag to expect gzip format, + // see http://www.zlib.net/manual.html#Advanced + if (Z_OK == inflateInit2(&s, 16 + MAX_WBITS)) { + int result = inflate(&s, Z_FINISH); + if (Z_STREAM_END == result) { + MOZ_ASSERT(size_t(s.next_out - outBuf.Elements()) == origLen); + ParseDocument(outBuf.Elements(), outBuf.Length()); + } else { + NS_WARNING("Failed to decompress SVG glyphs document"); + } + inflateEnd(&s); + } + } else { + NS_WARNING("Failed to allocate memory for SVG glyphs document"); + } + } else { ParseDocument(aBuffer, aBufLen); + } + if (!mDocument) { NS_WARNING("Could not parse SVG glyphs document"); return; diff --git a/gfx/thebes/gfxUserFontSet.cpp b/gfx/thebes/gfxUserFontSet.cpp index 23c26d9fe..72c54d9b5 100644 --- a/gfx/thebes/gfxUserFontSet.cpp +++ b/gfx/thebes/gfxUserFontSet.cpp @@ -453,8 +453,6 @@ gfxUserFontEntry::LoadNextSrc() gfxUserFontData::kUnknownCompression); mPlatformFontEntry = fe; SetLoadState(STATUS_LOADED); - Telemetry::Accumulate(Telemetry::WEBFONT_SRCTYPE, - currSrc.mSourceType + 1); return; } else { LOG(("userfonts (%p) [src %d] failed local: (%s) for (%s)\n", @@ -517,8 +515,6 @@ gfxUserFontEntry::LoadNextSrc() if (NS_SUCCEEDED(rv) && LoadPlatformFont(buffer, bufferLength)) { SetLoadState(STATUS_LOADED); - Telemetry::Accumulate(Telemetry::WEBFONT_SRCTYPE, - currSrc.mSourceType + 1); return; } else { mFontSet->LogMessage(this, @@ -572,8 +568,6 @@ gfxUserFontEntry::LoadNextSrc() // LoadPlatformFont takes ownership of the buffer, so no need // to free it here. SetLoadState(STATUS_LOADED); - Telemetry::Accumulate(Telemetry::WEBFONT_SRCTYPE, - currSrc.mSourceType + 1); return; } else { mFontSet->LogMessage(this, @@ -617,7 +611,6 @@ gfxUserFontEntry::LoadPlatformFont(const uint8_t* aFontData, uint32_t& aLength) gfxUserFontType fontType = gfxFontUtils::DetermineFontDataType(aFontData, aLength); - Telemetry::Accumulate(Telemetry::WEBFONT_FONTTYPE, uint32_t(fontType)); // Unwrap/decompress/sanitize or otherwise munge the downloaded data // to make a usable sfnt structure. @@ -650,13 +643,6 @@ gfxUserFontEntry::LoadPlatformFont(const uint8_t* aFontData, uint32_t& aLength) if (saneData) { if (saneLen) { fontCompressionRatio = uint32_t(100.0 * aLength / saneLen + 0.5); - if (fontType == GFX_USERFONT_WOFF || - fontType == GFX_USERFONT_WOFF2) { - Telemetry::Accumulate(fontType == GFX_USERFONT_WOFF ? - Telemetry::WEBFONT_COMPRESSION_WOFF : - Telemetry::WEBFONT_COMPRESSION_WOFF2, - fontCompressionRatio); - } } // The sanitizer ensures that we have a valid sfnt and a usable diff --git a/gfx/thebes/gfxWindowsPlatform.cpp b/gfx/thebes/gfxWindowsPlatform.cpp index a988859eb..82e36efe2 100755 --- a/gfx/thebes/gfxWindowsPlatform.cpp +++ b/gfx/thebes/gfxWindowsPlatform.cpp @@ -22,7 +22,6 @@ #include "nsIGfxInfo.h" #include "nsServiceManagerUtils.h" #include "nsTArray.h" -#include "mozilla/Telemetry.h" #include "GeckoProfiler.h" #include "nsIWindowsRegKey.h" @@ -430,10 +429,6 @@ gfxWindowsPlatform::HandleDeviceReset() return false; } - if (resetReason != DeviceResetReason::FORCED_RESET) { - Telemetry::Accumulate(Telemetry::DEVICE_RESET_REASON, uint32_t(resetReason)); - } - // Remove devices and adapters. DeviceManagerDx::Get()->ResetDevices(); @@ -1439,20 +1434,6 @@ gfxWindowsPlatform::InitializeD3D11Config() } } -/* static */ void -gfxWindowsPlatform::RecordContentDeviceFailure(TelemetryDeviceCode aDevice) -{ - // If the parent process fails to acquire a device, we record this - // normally as part of the environment. The exceptional case we're - // looking for here is when the parent process successfully acquires - // a device, but the content process fails to acquire the same device. - // This would not normally be displayed in about:support. - if (!XRE_IsContentProcess()) { - return; - } - Telemetry::Accumulate(Telemetry::GFX_CONTENT_FAILED_TO_ACQUIRE_DEVICE, uint32_t(aDevice)); -} - void gfxWindowsPlatform::InitializeDevices() { @@ -1490,18 +1471,9 @@ gfxWindowsPlatform::InitializeDevices() return; } - bool shouldUseD2D = gfxConfig::IsEnabled(Feature::DIRECT2D); - // First, initialize D3D11. If this succeeds we attempt to use Direct2D. InitializeD3D11(); InitializeD2D(); - - if (!gfxConfig::IsEnabled(Feature::DIRECT2D) && - XRE_IsContentProcess() && - shouldUseD2D) - { - RecordContentDeviceFailure(TelemetryDeviceCode::D2D1); - } } void diff --git a/gfx/thebes/gfxWindowsPlatform.h b/gfx/thebes/gfxWindowsPlatform.h index f401038fc..129365f82 100644 --- a/gfx/thebes/gfxWindowsPlatform.h +++ b/gfx/thebes/gfxWindowsPlatform.h @@ -225,8 +225,6 @@ public: } bool SupportsPluginDirectDXGIDrawing(); - static void RecordContentDeviceFailure(mozilla::gfx::TelemetryDeviceCode aDevice); - protected: bool AccelerateLayersByDefault() override { return true; |