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

Side by Side Diff: extensions/common/manifest_handler.cc

Issue 2236443003: extensions: Use stl utilities from the base namespace (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Don't add braces Created 4 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) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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 #include "extensions/common/manifest_handler.h" 5 #include "extensions/common/manifest_handler.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <map> 9 #include <map>
10 10
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
220 handler->PrerequisiteKeys(); 220 handler->PrerequisiteKeys();
221 int unsatisfied = prerequisites.size(); 221 int unsatisfied = prerequisites.size();
222 for (size_t i = 0; i < prerequisites.size(); ++i) { 222 for (size_t i = 0; i < prerequisites.size(); ++i) {
223 ManifestHandlerMap::const_iterator prereq_iter = 223 ManifestHandlerMap::const_iterator prereq_iter =
224 handlers_.find(prerequisites[i]); 224 handlers_.find(prerequisites[i]);
225 // If the prerequisite does not exist, crash. 225 // If the prerequisite does not exist, crash.
226 CHECK(prereq_iter != handlers_.end()) 226 CHECK(prereq_iter != handlers_.end())
227 << "Extension manifest handler depends on unrecognized key " 227 << "Extension manifest handler depends on unrecognized key "
228 << prerequisites[i]; 228 << prerequisites[i];
229 // Prerequisite is in our map. 229 // Prerequisite is in our map.
230 if (ContainsKey(priority_map_, prereq_iter->second.get())) 230 if (base::ContainsKey(priority_map_, prereq_iter->second.get()))
231 unsatisfied--; 231 unsatisfied--;
232 } 232 }
233 if (unsatisfied == 0) { 233 if (unsatisfied == 0) {
234 priority_map_[handler] = priority; 234 priority_map_[handler] = priority;
235 priority++; 235 priority++;
236 } else { 236 } else {
237 // Put in the list for next time. 237 // Put in the list for next time.
238 next_unsorted_handlers.insert(handler); 238 next_unsorted_handlers.insert(handler);
239 } 239 }
240 } 240 }
241 if (next_unsorted_handlers.size() == unsorted_handlers.size()) 241 if (next_unsorted_handlers.size() == unsorted_handlers.size())
242 break; 242 break;
243 unsorted_handlers.swap(next_unsorted_handlers); 243 unsorted_handlers.swap(next_unsorted_handlers);
244 } 244 }
245 245
246 // If there are any leftover unsorted handlers, they must have had 246 // If there are any leftover unsorted handlers, they must have had
247 // circular dependencies. 247 // circular dependencies.
248 CHECK_EQ(unsorted_handlers.size(), std::set<ManifestHandler*>::size_type(0)) 248 CHECK_EQ(unsorted_handlers.size(), std::set<ManifestHandler*>::size_type(0))
249 << "Extension manifest handlers have circular dependencies!"; 249 << "Extension manifest handlers have circular dependencies!";
250 } 250 }
251 251
252 } // namespace extensions 252 } // namespace extensions
OLDNEW
« no previous file with comments | « extensions/common/features/simple_feature_unittest.cc ('k') | extensions/common/message_bundle.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698