Index: chrome/browser/icon_loader_auralinux.cc |
diff --git a/chrome/browser/icon_loader_auralinux.cc b/chrome/browser/icon_loader_auralinux.cc |
index c3b57ed8cfd9c37973be1a3cb5652144e442caf3..461d5d7e9f9e0ec7d72ee4efd6e522e691fd93b3 100644 |
--- a/chrome/browser/icon_loader_auralinux.cc |
+++ b/chrome/browser/icon_loader_auralinux.cc |
@@ -45,6 +45,25 @@ void IconLoader::ReadIcon() { |
image_.reset(new gfx::Image(image)); |
} |
+ // TODO(jbroman): This should get better once PostTask can take a |
+ // OnceCallback, which seems the "right" thing to do. |
+ // |
+ // The root of the error in doing this the obvious way is that the functor |
+ // (first) argument to Bind isn't moved (rather a const& is used, because |
+ // running a repeating callback doesn't move from it). We could probably make |
+ // it work (by adjusting Invoker<...>::Run to move under some circumstances, |
+ // but it'd be a hack. |
+ // |
+ // This is a hack that does essentially that: it moves the functor like the |
+ // arguments are moved, even though that's not really safe if the callback is |
+ // invoked more than once. |
target_task_runner_->PostTask( |
- FROM_HERE, base::Bind(&IconLoader::NotifyDelegate, this)); |
+ FROM_HERE, |
+ base::Bind( |
+ [](IconLoadedCallback callback, IconLoader* loader, |
+ std::unique_ptr<gfx::Image> image, const IconGroup& group) { |
+ std::move(callback).Run(loader, std::move(image), group); |
+ }, |
+ base::Passed(&callback_), base::Unretained(this), |
+ base::Passed(&image_), group_)); |
} |