Bug 1114398 - Part 2: Test whether the path backend matches the DrawTarget backend for the SVG path cache. r=jwatt
authorBas Schouten <bschouten@mozilla.com>
Thu, 08 Jan 2015 00:10:49 +0000
changeset 248373 d5ead6673b9557737a3368d7a1be3763b6d49ae7
parent 248372 8309d6ce7a3892c91600d7327359c538ecaa1ce1
child 248374 6c673d6a2fb839be5d769660fa17eb243e2ff2b2
push id4489
push userraliiev@mozilla.com
push dateMon, 23 Feb 2015 15:17:55 +0000
treeherdermozilla-beta@fd7c3dc24146 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjwatt
bugs1114398
milestone37.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1114398 - Part 2: Test whether the path backend matches the DrawTarget backend for the SVG path cache. r=jwatt
dom/svg/nsSVGPathGeometryElement.cpp
--- a/dom/svg/nsSVGPathGeometryElement.cpp
+++ b/dom/svg/nsSVGPathGeometryElement.cpp
@@ -82,17 +82,19 @@ nsSVGPathGeometryElement::GetOrBuildPath
   bool cacheable  = aDrawTarget.GetBackendType() ==
                       gfxPlatform::GetPlatform()->GetContentBackend();
 
   // Checking for and returning mCachedPath before checking the pref means
   // that the pref is only live on page reload (or app restart for SVG in
   // chrome). The benefit is that we avoid causing a CPU memory cache miss by
   // looking at the global variable that the pref's stored in.
   if (cacheable && mCachedPath) {
-    return mCachedPath;
+    if (aDrawTarget.GetBackendType() == mCachedPath->GetBackendType()) {
+      return mCachedPath;
+    }
   }
   RefPtr<PathBuilder> builder = aDrawTarget.CreatePathBuilder(aFillRule);
   RefPtr<Path> path = BuildPath(builder);
   if (cacheable && NS_SVGPathCachingEnabled()) {
     mCachedPath = path;
   }
   return path.forget();
 }