|
|
Chromium Code Reviews
DescriptionDo not clone in CPDF_ImageCacheEntry::GetCachedBitmap
Committed: https://pdfium.googlesource.com/pdfium/+/708ef623c2e989a9ad909bf0c94a7dff89694412
Patch Set 1 #
Total comments: 3
Messages
Total messages: 11 (4 generated)
npm@chromium.org changed reviewers: + tsepez@chromium.org, weili@chromium.org
ptal, similar to https://codereview.chromium.org/2518063005/
https://codereview.chromium.org/2536903004/diff/1/core/fpdfapi/render/fpdf_re... File core/fpdfapi/render/fpdf_render_cache.cpp (right): https://codereview.chromium.org/2536903004/diff/1/core/fpdfapi/render/fpdf_re... core/fpdfapi/render/fpdf_render_cache.cpp:186: delete m_pCachedBitmap; Can we make these two unique_ptr's first? Similarly, we should make any method called "clone" return an unique_ptr. Then it's easier to reason about whether we're passing ownership or not. I suspect the clone()s may have been used to prevent this from freeing things it didn't own.
https://codereview.chromium.org/2536903004/diff/1/core/fpdfapi/render/fpdf_re... File core/fpdfapi/render/fpdf_render_cache.cpp (right): https://codereview.chromium.org/2536903004/diff/1/core/fpdfapi/render/fpdf_re... core/fpdfapi/render/fpdf_render_cache.cpp:186: delete m_pCachedBitmap; On 2016/11/29 17:00:53, Tom Sepez wrote: > Can we make these two unique_ptr's first? > Similarly, we should make any method called "clone" return an unique_ptr. > > Then it's easier to reason about whether we're passing ownership or not. I > suspect the clone()s may have been used to prevent this from freeing things it > didn't own. Sure I can do that. But in this particular case, you can see the cloned objects are deleted right about cloning. So that's not the reason for the cloning.
https://codereview.chromium.org/2536903004/diff/1/core/fpdfapi/render/fpdf_re... File core/fpdfapi/render/fpdf_render_cache.cpp (right): https://codereview.chromium.org/2536903004/diff/1/core/fpdfapi/render/fpdf_re... core/fpdfapi/render/fpdf_render_cache.cpp:186: delete m_pCachedBitmap; On 2016/11/29 17:05:31, npm wrote: > On 2016/11/29 17:00:53, Tom Sepez wrote: > > Can we make these two unique_ptr's first? > > Similarly, we should make any method called "clone" return an unique_ptr. > > > > Then it's easier to reason about whether we're passing ownership or not. I > > suspect the clone()s may have been used to prevent this from freeing things it > > didn't own. > > Sure I can do that. But in this particular case, you can see the cloned objects > are deleted right about cloning. So that's not the reason for the cloning. s/about/after
On 2016/11/29 17:06:27, npm wrote: > https://codereview.chromium.org/2536903004/diff/1/core/fpdfapi/render/fpdf_re... > File core/fpdfapi/render/fpdf_render_cache.cpp (right): > > https://codereview.chromium.org/2536903004/diff/1/core/fpdfapi/render/fpdf_re... > core/fpdfapi/render/fpdf_render_cache.cpp:186: delete m_pCachedBitmap; > On 2016/11/29 17:05:31, npm wrote: > > On 2016/11/29 17:00:53, Tom Sepez wrote: > > > Can we make these two unique_ptr's first? > > > Similarly, we should make any method called "clone" return an unique_ptr. > > > > > > Then it's easier to reason about whether we're passing ownership or not. I > > > suspect the clone()s may have been used to prevent this from freeing things > it > > > didn't own. > > > > Sure I can do that. But in this particular case, you can see the cloned > objects > > are deleted right about cloning. So that's not the reason for the cloning. > > s/about/after Ah, lgtm
The CQ bit was checked by npm@chromium.org
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
CQ is committing da patch.
Bot data: {"patchset_id": 1, "attempt_start_ts": 1480442454055080, "parent_rev":
"05e01698444726fae302cd335fa4880932d7c543", "commit_rev":
"708ef623c2e989a9ad909bf0c94a7dff89694412"}
Message was sent while issue was closed.
Description was changed from ========== Do not clone in CPDF_ImageCacheEntry::GetCachedBitmap ========== to ========== Do not clone in CPDF_ImageCacheEntry::GetCachedBitmap Committed: https://pdfium.googlesource.com/pdfium/+/708ef623c2e989a9ad909bf0c94a7dff8969... ==========
Message was sent while issue was closed.
Committed patchset #1 (id:1) as https://pdfium.googlesource.com/pdfium/+/708ef623c2e989a9ad909bf0c94a7dff8969... |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
