Commit 59a60e0a authored by Miyoung Shin's avatar Miyoung Shin Committed by Commit Bot

Replace use of std containers with WTF's equivalents in image.cc/h

Replace the use of std::map of std container with WTF::HashMap in
image.cc/h and use FloatSize instead of std::pair as HashMap's key.

Bug: 952716
Change-Id: I8476fd4710f71469806c6118e0dcfe37602bfe30
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1599813Reviewed-by: default avatarKentaro Hara <haraken@chromium.org>
Commit-Queue: Miyoung Shin <myid.shin@igalia.com>
Cr-Commit-Position: refs/heads/master@{#657666}
parent 7259523e
......@@ -375,12 +375,11 @@ DarkModeClassification Image::GetDarkModeClassification(
// size, only the top left corner coordinates of the src_rect are used to
// generate the key for caching and retrieving the classification.
ClassificationKey key(src_rect.X(), src_rect.Y());
std::map<ClassificationKey, DarkModeClassification>::iterator result =
dark_mode_classifications_.find(key);
auto result = dark_mode_classifications_.find(key);
if (result == dark_mode_classifications_.end())
return DarkModeClassification::kNotClassified;
return result->second;
return result->value;
}
void Image::AddDarkModeClassification(
......@@ -390,7 +389,7 @@ void Image::AddDarkModeClassification(
DCHECK(GetDarkModeClassification(src_rect) ==
DarkModeClassification::kNotClassified);
ClassificationKey key(src_rect.X(), src_rect.Y());
dark_mode_classifications_[key] = dark_mode_classification;
dark_mode_classifications_.insert(key, dark_mode_classification);
}
bool Image::ShouldApplyDarkModeFilter(const FloatRect& src_rect) {
......
......@@ -282,9 +282,8 @@ class PLATFORM_EXPORT Image : public ThreadSafeRefCounted<Image> {
const FloatRect& src_rect,
const DarkModeClassification dark_mode_classification);
typedef std::pair<float, float> ClassificationKey;
std::map<ClassificationKey, DarkModeClassification>
dark_mode_classifications_;
typedef FloatSize ClassificationKey;
HashMap<ClassificationKey, DarkModeClassification> dark_mode_classifications_;
private:
virtual DarkModeClassification ClassifyImageForDarkMode(
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment