Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(9)

Unified Diff: chrome/browser/android/thumbnail/thumbnail_cache.cc

Issue 1715683002: chrome: Use base's ContainsValue helper function instead of std::find (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Updated as per latest code Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/browser/apps/app_window_registry_util.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/android/thumbnail/thumbnail_cache.cc
diff --git a/chrome/browser/android/thumbnail/thumbnail_cache.cc b/chrome/browser/android/thumbnail/thumbnail_cache.cc
index 1ad09a7a4486daed45d93a6d2b57bef83ee50c79..0781c05fb16fddc6b04adf796a0aca7d01b162a0 100644
--- a/chrome/browser/android/thumbnail/thumbnail_cache.cc
+++ b/chrome/browser/android/thumbnail/thumbnail_cache.cc
@@ -14,6 +14,7 @@
#include "base/files/file_enumerator.h"
#include "base/files/file_path.h"
#include "base/files/file_util.h"
+#include "base/stl_util.h"
#include "base/strings/string_number_conversions.h"
#include "base/threading/worker_pool.h"
#include "base/time/time.h"
@@ -205,10 +206,8 @@ Thumbnail* ThumbnailCache::Get(TabId tab_id,
}
if (force_disk_read &&
- std::find(visible_ids_.begin(), visible_ids_.end(), tab_id) !=
- visible_ids_.end() &&
- std::find(read_queue_.begin(), read_queue_.end(), tab_id) ==
- read_queue_.end()) {
+ ContainsValue(visible_ids_, tab_id) &&
+ !ContainsValue(read_queue_, tab_id)) {
read_queue_.push_back(tab_id);
ReadNextThumbnail();
}
@@ -297,10 +296,8 @@ void ThumbnailCache::UpdateVisibleIds(const TabIdList& priority) {
TabId tab_id = *iter;
visible_ids_.push_back(tab_id);
if (!cache_.Get(tab_id) &&
- std::find(read_queue_.begin(), read_queue_.end(), tab_id) ==
- read_queue_.end()) {
+ !ContainsValue(read_queue_, tab_id))
read_queue_.push_back(tab_id);
- }
iter++;
count++;
}
@@ -407,8 +404,7 @@ void ThumbnailCache::ReadNextThumbnail() {
void ThumbnailCache::MakeSpaceForNewItemIfNecessary(TabId tab_id) {
if (cache_.Get(tab_id) ||
- std::find(visible_ids_.begin(), visible_ids_.end(), tab_id) ==
- visible_ids_.end() ||
+ !ContainsValue(visible_ids_, tab_id) ||
cache_.size() < cache_.MaximumCacheSize()) {
return;
}
@@ -420,8 +416,7 @@ void ThumbnailCache::MakeSpaceForNewItemIfNecessary(TabId tab_id) {
for (ExpiringThumbnailCache::iterator iter = cache_.begin();
iter != cache_.end();
iter++) {
- if (std::find(visible_ids_.begin(), visible_ids_.end(), iter->first) ==
- visible_ids_.end()) {
+ if (!ContainsValue(visible_ids_, iter->first)) {
key_to_remove = iter->first;
found_key_to_remove = true;
break;
« no previous file with comments | « no previous file | chrome/browser/apps/app_window_registry_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698