Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(159)

Unified Diff: src/core/SkDraw.cpp

Issue 72603005: Guard against most unintentionally ephemeral SkAutoFoo instantiations. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: undo autoasciitolc Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/core/SkDescriptor.h ('k') | src/core/SkGlyphCache.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkDraw.cpp
diff --git a/src/core/SkDraw.cpp b/src/core/SkDraw.cpp
index 112451920f2bdf0a7e6f21198fded5a2d4832347..aa91df3df557bfc83d2cb5539933400491ac2c3d 100644
--- a/src/core/SkDraw.cpp
+++ b/src/core/SkDraw.cpp
@@ -65,7 +65,13 @@ public:
fStorage, sizeof(fStorage), drawCoverage);
}
- ~SkAutoBlitterChoose();
+ ~SkAutoBlitterChoose() {
+ if ((void*)fBlitter == (void*)fStorage) {
+ fBlitter->~SkBlitter();
+ } else {
+ SkDELETE(fBlitter);
+ }
+ }
SkBlitter* operator->() { return fBlitter; }
SkBlitter* get() const { return fBlitter; }
@@ -81,14 +87,7 @@ private:
SkBlitter* fBlitter;
uint32_t fStorage[kBlitterStorageLongCount];
};
-
-SkAutoBlitterChoose::~SkAutoBlitterChoose() {
- if ((void*)fBlitter == (void*)fStorage) {
- fBlitter->~SkBlitter();
- } else {
- SkDELETE(fBlitter);
- }
-}
+#define SkAutoBlitterChoose(...) SK_REQUIRE_LOCAL_VAR(SkAutoBlitterChoose)
/**
* Since we are providing the storage for the shader (to avoid the perf cost
@@ -128,6 +127,7 @@ private:
SkPaint fPaint; // copy of caller's paint (which we then modify)
uint32_t fStorage[kBlitterStorageLongCount];
};
+#define SkAutoBitmapShaderInstall(...) SK_REQUIRE_LOCAL_VAR(SkAutoBitmapShaderInstall)
///////////////////////////////////////////////////////////////////////////////
« no previous file with comments | « src/core/SkDescriptor.h ('k') | src/core/SkGlyphCache.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698