Right now, ImageDataFetcher will happily download a 10GB image if pointed at one. It should be possible to pass in a maximum size of bytes after which to cancel the download. This will let clients set a "safe" maximum, to avoid burning all the user's data accidentally. Example code: https://cs.chromium.org/chromium/src/components/search_provider_logos/logo_tracker.cc?rcl=6955cae058e32565a628bb9c0c37f01aad23cdf3&l=372
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/281080243642ac41b1004f9d8c6363db6081bbfa commit 281080243642ac41b1004f9d8c6363db6081bbfa Author: fhorschig <fhorschig@chromium.org> Date: Tue Mar 28 10:55:13 2017 Add |SetImageDownloadLimit| to ImageFetcher to limit downloaded bytes By calling SetImageDownloadLimit, the ImageFetcher will cancel requests that exceed the given byte size. This affects currently running and upcoming requests. The limit can be disabled by calling it with negative limits. By default, there is no limit set. Therefore, all existing users of image_data_fetchers are not affected. TBR'ing for ownership of two tests. The added functions are never used and exist just to implement the interface so the compiler is happy. TBR=sky@chromium.org BUG= 702601 Review-Url: https://codereview.chromium.org/2781473003 Cr-Commit-Position: refs/heads/master@{#460059} [modify] https://crrev.com/281080243642ac41b1004f9d8c6363db6081bbfa/chrome/browser/chromeos/hats/hats_notification_controller_unittest.cc [modify] https://crrev.com/281080243642ac41b1004f9d8c6363db6081bbfa/components/favicon/core/large_icon_service_unittest.cc [modify] https://crrev.com/281080243642ac41b1004f9d8c6363db6081bbfa/components/image_fetcher/core/image_data_fetcher.cc [modify] https://crrev.com/281080243642ac41b1004f9d8c6363db6081bbfa/components/image_fetcher/core/image_data_fetcher.h [modify] https://crrev.com/281080243642ac41b1004f9d8c6363db6081bbfa/components/image_fetcher/core/image_data_fetcher_unittest.cc [modify] https://crrev.com/281080243642ac41b1004f9d8c6363db6081bbfa/components/image_fetcher/core/image_fetcher.h [modify] https://crrev.com/281080243642ac41b1004f9d8c6363db6081bbfa/components/image_fetcher/core/image_fetcher_impl.cc [modify] https://crrev.com/281080243642ac41b1004f9d8c6363db6081bbfa/components/image_fetcher/core/image_fetcher_impl.h [modify] https://crrev.com/281080243642ac41b1004f9d8c6363db6081bbfa/components/ntp_snippets/remote/remote_suggestions_provider_impl_unittest.cc [modify] https://crrev.com/281080243642ac41b1004f9d8c6363db6081bbfa/components/ntp_tiles/icon_cacher_impl_unittest.cc [modify] https://crrev.com/281080243642ac41b1004f9d8c6363db6081bbfa/components/suggestions/image_manager_unittest.cc
Comment 1 by treib@chromium.org
, Mar 20 2017