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 222605 d5ead6673b9557737a3368d7a1be3763b6d49ae7
parent 222604 8309d6ce7a3892c91600d7327359c538ecaa1ce1
child 222606 6c673d6a2fb839be5d769660fa17eb243e2ff2b2
push id10716
push userkwierso@gmail.com
push dateFri, 09 Jan 2015 01:17:28 +0000
treeherderfx-team@0f98d51a4a49 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjwatt
bugs1114398
milestone37.0a1
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();
 }