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

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: 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 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
236 void RevokeOldGalleries(const MediaGalleryPrefIdSet& new_galleries) { 236 void RevokeOldGalleries(const MediaGalleryPrefIdSet& new_galleries) {
237 if (new_galleries.size() == pref_id_map_.size()) 237 if (new_galleries.size() == pref_id_map_.size())
238 return; 238 return;
239 239
240 MediaGalleryPrefIdSet old_galleries; 240 MediaGalleryPrefIdSet old_galleries;
241 for (PrefIdFsInfoMap::const_iterator it = pref_id_map_.begin(); 241 for (PrefIdFsInfoMap::const_iterator it = pref_id_map_.begin();
242 it != pref_id_map_.end(); 242 it != pref_id_map_.end();
243 ++it) { 243 ++it) {
244 old_galleries.insert(it->first); 244 old_galleries.insert(it->first);
245 } 245 }
246 MediaGalleryPrefIdSet invalid_galleries; 246 MediaGalleryPrefIdSet invalid_galleries =
247 std::set_difference(old_galleries.begin(), old_galleries.end(), 247 base::STLSetDifference<MediaGalleryPrefIdSet>(old_galleries,
248 new_galleries.begin(), new_galleries.end(), 248 new_galleries);
249 std::inserter(invalid_galleries,
250 invalid_galleries.begin()));
251 for (MediaGalleryPrefIdSet::const_iterator it = invalid_galleries.begin(); 249 for (MediaGalleryPrefIdSet::const_iterator it = invalid_galleries.begin();
252 it != invalid_galleries.end(); 250 it != invalid_galleries.end();
253 ++it) { 251 ++it) {
254 RevokeGalleryByPrefId(*it); 252 RevokeGalleryByPrefId(*it);
255 } 253 }
256 } 254 }
257 255
258 // Revoke the file system for |id| if this extension has created one for |id|. 256 // Revoke the file system for |id| if this extension has created one for |id|.
259 void RevokeGalleryByPrefId(MediaGalleryPrefId id) { 257 void RevokeGalleryByPrefId(MediaGalleryPrefId id) {
260 PrefIdFsInfoMap::iterator gallery = pref_id_map_.find(id); 258 PrefIdFsInfoMap::iterator gallery = pref_id_map_.find(id);
(...skipping 447 matching lines...) Expand 10 before | Expand all | Expand 10 after
708 // previously used. 706 // previously used.
709 PrefChangeRegistrarMap::iterator pref_it = 707 PrefChangeRegistrarMap::iterator pref_it =
710 pref_change_registrar_map_.find(profile); 708 pref_change_registrar_map_.find(profile);
711 DCHECK(pref_it != pref_change_registrar_map_.end()); 709 DCHECK(pref_it != pref_change_registrar_map_.end());
712 delete pref_it->second; 710 delete pref_it->second;
713 pref_change_registrar_map_.erase(pref_it); 711 pref_change_registrar_map_.erase(pref_it);
714 } 712 }
715 } 713 }
716 714
717 } // namespace chrome 715 } // namespace chrome
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698