Make gfx::Image instance a local variable.
This follows https://codereview.chromium.org/2709683002
This commit is contained in:
parent
c1d68974ab
commit
b3743058c0
4 changed files with 18 additions and 12 deletions
|
@ -8,6 +8,7 @@
|
|||
#include <shellapi.h>
|
||||
|
||||
#include "base/bind.h"
|
||||
#include "base/memory/ptr_util.h"
|
||||
#include "base/message_loop/message_loop.h"
|
||||
#include "base/threading/thread.h"
|
||||
#include "third_party/skia/include/core/SkBitmap.h"
|
||||
|
@ -49,7 +50,7 @@ void IconLoader::ReadIcon() {
|
|||
NOTREACHED();
|
||||
}
|
||||
|
||||
image_.reset();
|
||||
std::unique_ptr<gfx::Image> image;
|
||||
|
||||
SHFILEINFO file_info = { 0 };
|
||||
if (SHGetFileInfo(group_.c_str(), FILE_ATTRIBUTE_NORMAL, &file_info,
|
||||
|
@ -61,12 +62,12 @@ void IconLoader::ReadIcon() {
|
|||
gfx::ImageSkia image_skia(gfx::ImageSkiaRep(*bitmap,
|
||||
display::win::GetDPIScale()));
|
||||
image_skia.MakeThreadSafe();
|
||||
image_.reset(new gfx::Image(image_skia));
|
||||
image = base::MakeUnique<gfx::Image>(image_skia);
|
||||
DestroyIcon(file_info.hIcon);
|
||||
}
|
||||
}
|
||||
|
||||
target_task_runner_->PostTask(
|
||||
FROM_HERE, base::Bind(callback_, base::Passed(&image_), group_));
|
||||
FROM_HERE, base::Bind(callback_, base::Passed(&image), group_));
|
||||
delete this;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue