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

Unified Diff: extensions/renderer/user_script_injector.cc

Issue 2193093002: [UserScript cleanup] Remove use of ScopedVector from UserScriptSet. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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 | « extensions/renderer/user_script_injector.h ('k') | extensions/renderer/user_script_set.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: extensions/renderer/user_script_injector.cc
diff --git a/extensions/renderer/user_script_injector.cc b/extensions/renderer/user_script_injector.cc
index f653cf4b792327763d2609181802f725bad47bcb..5029fbd4f5f63eb6a9fb10a370a46f3b7f6b03b0 100644
--- a/extensions/renderer/user_script_injector.cc
+++ b/extensions/renderer/user_script_injector.cc
@@ -101,7 +101,7 @@ UserScriptInjector::~UserScriptInjector() {
void UserScriptInjector::OnUserScriptsUpdated(
const std::set<HostID>& changed_hosts,
- const std::vector<UserScript*>& scripts) {
+ const std::vector<std::unique_ptr<UserScript>>& scripts) {
// If the host causing this injection changed, then this injection
// will be removed, and there's no guarantee the backing script still exists.
if (changed_hosts.count(host_id_) > 0) {
@@ -109,13 +109,11 @@ void UserScriptInjector::OnUserScriptsUpdated(
return;
}
- for (std::vector<UserScript*>::const_iterator iter = scripts.begin();
- iter != scripts.end();
- ++iter) {
+ for (const std::unique_ptr<UserScript>& script : scripts) {
// We need to compare to |script_id_| (and not to script_->id()) because the
// old |script_| may be deleted by now.
- if ((*iter)->id() == script_id_) {
- script_ = *iter;
+ if (script->id() == script_id_) {
+ script_ = script.get();
break;
}
}
« no previous file with comments | « extensions/renderer/user_script_injector.h ('k') | extensions/renderer/user_script_set.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698