Index: chrome/browser/extensions/user_script_loader.cc |
diff --git a/chrome/browser/extensions/user_script_loader.cc b/chrome/browser/extensions/user_script_loader.cc |
index 24e042ba48284f2202405c3f71331797f9392ce4..454bf74bd3a940bc700b24bc435584dd9efb1da7 100644 |
--- a/chrome/browser/extensions/user_script_loader.cc |
+++ b/chrome/browser/extensions/user_script_loader.cc |
@@ -441,10 +441,32 @@ void UserScriptLoader::OnScriptsLoaded( |
// We've got scripts ready to go. |
shared_memory_.reset(shared_memory.release()); |
+ // If user scripts are comming from a <webview>, will only notify the |
+ // RenderProcessHost of that <webview>; otherwise will notify all of the |
+ // RenderProcessHosts. |
+ bool is_web_view = false; |
+ int render_process_id = -1; |
+ const UserScriptList* scripts = user_scripts.get(); |
+ if (scripts && !scripts->empty() && |
+ (*scripts)[0].consumer_instance_info().type() == |
+ ConsumerInstanceInfo::WEBVIEW) { |
+ DCHECK(scripts->size() == 1); |
+ is_web_view = true; |
+ render_process_id = (*scripts)[0].routing_info().render_process_id; |
+ } |
+ |
for (content::RenderProcessHost::iterator i( |
content::RenderProcessHost::AllHostsIterator()); |
!i.IsAtEnd(); |
i.Advance()) { |
+ if (is_web_view) { |
+ if (i.GetCurrentValue()->GetID() != render_process_id) { |
Fady Samuel
2015/02/11 19:08:22
if (is_web_view && i.GetCurrentValue()->GetID() !=
|
+ continue; |
+ } else { |
Fady Samuel
2015/02/11 19:08:22
Not necessary.
Xi Han
2015/02/11 21:57:24
I add the else for early break (line 467 "break").
Xi Han
2015/02/11 22:06:57
Adopt Fady's suggestion.
|
+ SendUpdate(i.GetCurrentValue(), shared_memory_.get(), changed_hosts_); |
+ break; |
+ } |
+ } |
SendUpdate(i.GetCurrentValue(), shared_memory_.get(), changed_hosts_); |
} |
changed_hosts_.clear(); |