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

Unified Diff: src/core/SkRecord.h

Issue 517073002: Align all SkRecord::alloc() calls up to at least a pointer size. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: SkAlignPtr Created 6 years, 4 months 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 | « include/core/SkTypes.h ('k') | tests/RecordTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkRecord.h
diff --git a/src/core/SkRecord.h b/src/core/SkRecord.h
index 96da69b12ef8c150729c07c8e846fab5452cb1dc..203a16c4e872768fbf47f5204f5ebf82e83dc7b7 100644
--- a/src/core/SkRecord.h
+++ b/src/core/SkRecord.h
@@ -65,7 +65,8 @@ public:
// Here T can be any class, not just those from SkRecords. Throws on failure.
template <typename T>
T* alloc(size_t count = 1) {
- return (T*)fAlloc.allocThrow(sizeof(T) * count);
+ // Bump up to the next pointer width if needed, so all allocations start pointer-aligned.
+ return (T*)fAlloc.allocThrow(SkAlignPtr(sizeof(T) * count));
}
// Add a new command of type T to the end of this SkRecord.
« no previous file with comments | « include/core/SkTypes.h ('k') | tests/RecordTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698