Chromium Code Reviews| Index: third_party/WebKit/Source/core/style/SVGComputedStyle.cpp |
| diff --git a/third_party/WebKit/Source/core/style/SVGComputedStyle.cpp b/third_party/WebKit/Source/core/style/SVGComputedStyle.cpp |
| index 1034cbcb90a6331a44cd31bdc9c9fbbc4787c701..67a057f7b163aedbebf5f1933ebb575579241fc9 100644 |
| --- a/third_party/WebKit/Source/core/style/SVGComputedStyle.cpp |
| +++ b/third_party/WebKit/Source/core/style/SVGComputedStyle.cpp |
| @@ -33,7 +33,13 @@ static const int kPaintOrderBitwidth = 2; |
| SVGComputedStyle::SVGComputedStyle() |
| { |
| - static SVGComputedStyle* initialStyle = new SVGComputedStyle(CreateInitial); |
| + DEFINE_THREAD_SAFE_STATIC_LOCAL(ThreadSpecific<SVGComputedStyle*>, style, |
|
esprehn
2016/09/12 20:53:12
ditto
|
| + new ThreadSpecific<SVGComputedStyle*>); |
| + if (!*style) { |
| + *style = new SVGComputedStyle(CreateInitial); |
| + } |
| + |
| + SVGComputedStyle* initialStyle = *style; |
| fill = initialStyle->fill; |
| stroke = initialStyle->stroke; |
| @@ -124,8 +130,12 @@ void SVGComputedStyle::copyNonInheritedFromCached(const SVGComputedStyle* other) |
| PassRefPtr<SVGDashArray> SVGComputedStyle::initialStrokeDashArray() |
| { |
| - DEFINE_STATIC_REF(SVGDashArray, initialDashArray, SVGDashArray::create()); |
| - return initialDashArray; |
| + DEFINE_THREAD_SAFE_STATIC_LOCAL(ThreadSpecific<SVGDashArray*>, initialDashArray, |
| + new ThreadSpecific<SVGDashArray*>()); |
| + if (!*initialDashArray) { |
| + *initialDashArray = SVGDashArray::create().leakRef(); |
| + } |
| + return *initialDashArray; |
| } |
| StyleDifference SVGComputedStyle::diff(const SVGComputedStyle* other) const |