Allocate ExternalMemoryAllocator on the stack.
The change is desirable because: - Ref-counting doesn't result in memory safety here, because ExternalMemoryAllocator wraps a raw pointer to short-lived memory. Ref-counting cannot extend the lifetime of the memory this pointer points to. - No consumers of SkBitmap::Allocator currently use ref-counting. If SkBitmap::Allocator was designed today, it probably wouldn't use SkRefCnt as a base class. - Blink-to-Chromium style conversion will rename |ref| to |Ref| in WTF, but won't do it outside of Blink/WTF (e.g. in Skia), so RefPtr should only be used with Blink/WTF types going forward (i.e. Skia types should be wrapped in smart pointers provided by Skia). More discussion is in an older code review: https://codereview.chromium.org/1880993003/#msg10 BUG=641014 Review-Url: https://codereview.chromium.org/2326473005 Cr-Commit-Position: refs/heads/master@{#418657}
Showing
Please register or sign in to comment