diff options
author | 2014-12-01 06:59:54 -0800 | |
---|---|---|
committer | 2014-12-01 06:59:55 -0800 | |
commit | 5c9c9be1f540e1895e65fbd244caae9135972143 (patch) | |
tree | 7ce2b61adb7cc0f46c992ea968400e82c63e67bf /include/core | |
parent | 88fd0fbcccea615f2d2cd61a121ac9e3185adfe4 (diff) |
Force path bounds in recording.
The use of SKTRacy isn't safe in SkPathRef.
There are logical dependencies between the racy fields.
Doesn't seem to affect recording performance:
$ c --match skp --config nonrendering
tabl_techmeme.skp 81.1us -> 86us 1.06x
desk_mapsvg.skp 1.23ms -> 1.26ms 1.02x
desk_yahooanswers.skp 114us -> 117us 1.02x
tabl_sahadan.skp 70.9us -> 72us 1.02x
desk_fontwipe.skp 31.6us -> 32us 1.01x
tabl_cuteoverload.skp 414us -> 419us 1.01x
desk_mobilenews.skp 503us -> 508us 1.01x
desk_tigersvg.skp 150us -> 152us 1.01x
desk_samoasvg.skp 608us -> 610us 1x
tabl_digg.skp 636us -> 638us 1x
tabl_pravda.skp 155us -> 156us 1x
desk_jsfiddlehumperclip.skp 33.9us -> 33.9us 1x
tabl_culturalsolutions.skp 295us -> 295us 1x
desk_youtube.skp 447us -> 448us 1x
desk_gws.skp 144us -> 144us 1x
tabl_frantzen.skp 42us -> 42us 1x
tabl_gspro.skp 50.1us -> 50us 1x
tabl_googlecalendar.skp 165us -> 165us 1x
desk_twitter.skp 359us -> 358us 1x
desk_wordpress.skp 588us -> 583us 0.99x
desk_jsfiddlebigcar.skp 32.8us -> 32.5us 0.99x
desk_booking.skp 838us -> 827us 0.99x
tabl_androidpolice.skp 1.42ms -> 1.4ms 0.99x
desk_blogger.skp 378us -> 372us 0.98x
desk_wowwiki.skp 1.11ms -> 1.09ms 0.98x
tabl_cnet.skp 115us -> 112us 0.97x
desk_silkfinance.skp 57.7us -> 55.9us 0.97x
tabl_cnn.skp 136us -> 131us 0.97x
desk_sfgate.skp 396us -> 377us 0.95x
tabl_deviantart.skp 107us -> 102us 0.95x
tabl_mozilla.skp 1.4ms -> 1.32ms 0.94x
BUG=437511
Review URL: https://codereview.chromium.org/762313002
Diffstat (limited to 'include/core')
-rw-r--r-- | include/core/SkDynamicAnnotations.h | 28 | ||||
-rw-r--r-- | include/core/SkPathRef.h | 13 |
2 files changed, 6 insertions, 35 deletions
diff --git a/include/core/SkDynamicAnnotations.h b/include/core/SkDynamicAnnotations.h index 872a292e5d..2775b38cec 100644 --- a/include/core/SkDynamicAnnotations.h +++ b/include/core/SkDynamicAnnotations.h @@ -82,32 +82,4 @@ private: T fVal; }; -// This is like SkTRacy, but allows you to return the value by reference. -// TSAN is better at suppressing SkTRacy than SkTRacyReffable, so use SkTRacy when possible. -// -// We use this for SkPathRef bounds, which is an SkRect we pass around by reference publically. -template <typename T> -class SkTRacyReffable { -public: - SkTRacyReffable() { SK_ANNOTATE_BENIGN_RACE(&fVal); } - - operator const T&() const { - return fVal; - } - - SkTRacyReffable& operator=(const T& val) { - fVal = val; - return *this; - } - - const T* get() const { return &fVal; } - T* get() { return &fVal; } - - const T* operator->() const { return &fVal; } - T* operator->() { return &fVal; } - -private: - T fVal; -}; - #endif//SkDynamicAnnotations_DEFINED diff --git a/include/core/SkPathRef.h b/include/core/SkPathRef.h index 4b57fc80e4..78c6cd5af7 100644 --- a/include/core/SkPathRef.h +++ b/include/core/SkPathRef.h @@ -9,7 +9,6 @@ #ifndef SkPathRef_DEFINED #define SkPathRef_DEFINED -#include "SkDynamicAnnotations.h" #include "SkMatrix.h" #include "SkPoint.h" #include "SkRect.h" @@ -293,9 +292,9 @@ private: SkDEBUGCODE(this->validate();) // TODO(mtklein): remove fBoundsIsDirty and fIsFinite, // using an inverted rect instead of fBoundsIsDirty and always recalculating fIsFinite. - //SkASSERT(fBoundsIsDirty); + SkASSERT(fBoundsIsDirty); - fIsFinite = ComputePtBounds(fBounds.get(), *this); + fIsFinite = ComputePtBounds(&fBounds, *this); fBoundsIsDirty = false; } @@ -303,7 +302,7 @@ private: SkASSERT(rect.fLeft <= rect.fRight && rect.fTop <= rect.fBottom); fBounds = rect; fBoundsIsDirty = false; - fIsFinite = fBounds->isFinite(); + fIsFinite = fBounds.isFinite(); } /** Makes additional room but does not change the counts or change the genID */ @@ -435,9 +434,9 @@ private: kMinSize = 256, }; - mutable SkTRacyReffable<SkRect> fBounds; - mutable SkTRacy<uint8_t> fBoundsIsDirty; - mutable SkTRacy<SkBool8> fIsFinite; // only meaningful if bounds are valid + mutable SkRect fBounds; + mutable uint8_t fBoundsIsDirty; + mutable SkBool8 fIsFinite; // only meaningful if bounds are valid SkBool8 fIsOval; uint8_t fSegmentMask; |