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

Side by Side Diff: chrome/browser/media_galleries/media_file_system_registry.cc

Issue 22460011: [CleanUp] Use base::STLSetDifference in place of std::set_difference (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add missing head file. Created 7 years, 4 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // MediaFileSystemRegistry implementation. 5 // MediaFileSystemRegistry implementation.
6 6
7 #include "chrome/browser/media_galleries/media_file_system_registry.h" 7 #include "chrome/browser/media_galleries/media_file_system_registry.h"
8 8
9 #include <set> 9 #include <set>
10 #include <vector> 10 #include <vector>
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after
260 void RevokeOldGalleries(const MediaGalleryPrefIdSet& new_galleries) { 260 void RevokeOldGalleries(const MediaGalleryPrefIdSet& new_galleries) {
261 if (new_galleries.size() == pref_id_map_.size()) 261 if (new_galleries.size() == pref_id_map_.size())
262 return; 262 return;
263 263
264 MediaGalleryPrefIdSet old_galleries; 264 MediaGalleryPrefIdSet old_galleries;
265 for (PrefIdFsInfoMap::const_iterator it = pref_id_map_.begin(); 265 for (PrefIdFsInfoMap::const_iterator it = pref_id_map_.begin();
266 it != pref_id_map_.end(); 266 it != pref_id_map_.end();
267 ++it) { 267 ++it) {
268 old_galleries.insert(it->first); 268 old_galleries.insert(it->first);
269 } 269 }
270 MediaGalleryPrefIdSet invalid_galleries; 270 MediaGalleryPrefIdSet invalid_galleries =
271 std::set_difference(old_galleries.begin(), old_galleries.end(), 271 base::STLSetDifference<MediaGalleryPrefIdSet>(old_galleries,
272 new_galleries.begin(), new_galleries.end(), 272 new_galleries);
273 std::inserter(invalid_galleries,
274 invalid_galleries.begin()));
275 for (MediaGalleryPrefIdSet::const_iterator it = invalid_galleries.begin(); 273 for (MediaGalleryPrefIdSet::const_iterator it = invalid_galleries.begin();
276 it != invalid_galleries.end(); 274 it != invalid_galleries.end();
277 ++it) { 275 ++it) {
278 RevokeGalleryByPrefId(*it); 276 RevokeGalleryByPrefId(*it);
279 } 277 }
280 } 278 }
281 279
282 // Revoke the file system for |id| if this extension has created one for |id|. 280 // Revoke the file system for |id| if this extension has created one for |id|.
283 void RevokeGalleryByPrefId(MediaGalleryPrefId id) { 281 void RevokeGalleryByPrefId(MediaGalleryPrefId id) {
284 PrefIdFsInfoMap::iterator gallery = pref_id_map_.find(id); 282 PrefIdFsInfoMap::iterator gallery = pref_id_map_.find(id);
(...skipping 454 matching lines...) Expand 10 before | Expand all | Expand 10 after
739 // previously used. 737 // previously used.
740 PrefChangeRegistrarMap::iterator pref_it = 738 PrefChangeRegistrarMap::iterator pref_it =
741 pref_change_registrar_map_.find(profile); 739 pref_change_registrar_map_.find(profile);
742 DCHECK(pref_it != pref_change_registrar_map_.end()); 740 DCHECK(pref_it != pref_change_registrar_map_.end());
743 delete pref_it->second; 741 delete pref_it->second;
744 pref_change_registrar_map_.erase(pref_it); 742 pref_change_registrar_map_.erase(pref_it);
745 } 743 }
746 } 744 }
747 745
748 } // namespace chrome 746 } // namespace chrome
OLDNEW
« no previous file with comments | « chrome/browser/history/url_index_private_data.cc ('k') | chrome/browser/spellchecker/feedback.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698