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

Unified Diff: extensions/renderer/script_injection_manager.h

Issue 2134613002: Stop injection when injections are invalidated Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Expand scope of ScriptInjectionWatchers 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
Index: extensions/renderer/script_injection_manager.h
diff --git a/extensions/renderer/script_injection_manager.h b/extensions/renderer/script_injection_manager.h
index aaad2c9d58f5edaa5fa145cad378bdd6b60daed2..121619bb9982020082455d5d5f58b2c027d9ae61 100644
--- a/extensions/renderer/script_injection_manager.h
+++ b/extensions/renderer/script_injection_manager.h
@@ -53,6 +53,7 @@ class ScriptInjectionManager : public UserScriptSetManager::Observer {
// frames in order to notify the ScriptInjectionManager of different
// document load states and IPCs.
class RFOHelper;
+ class ScriptInjectionWatcher;
using FrameStatusMap =
std::map<content::RenderFrame*, UserScript::RunLocation>;
@@ -103,9 +104,6 @@ class ScriptInjectionManager : public UserScriptSetManager::Observer {
// RunLocation of the frame corresponds to the last location that has ran.
FrameStatusMap frame_statuses_;
- // The frames currently being injected into, so long as that frame is valid.
- std::set<content::RenderFrame*> active_injection_frames_;
-
// The collection of RFOHelpers.
std::vector<std::unique_ptr<RFOHelper>> rfo_helpers_;
@@ -119,6 +117,10 @@ class ScriptInjectionManager : public UserScriptSetManager::Observer {
// Running injections which are waiting for async callbacks from blink.
ScriptInjectionVector running_injections_;
+ // Tracks injections that are about to be injected. Injections are added
+ // right before injection, and removed immediately after.
+ std::vector<ScriptInjectionWatcher*> injection_watchers_;
+
// Whether or not dom activity should be logged for scripts injected.
bool activity_logging_enabled_ = false;

Powered by Google App Engine
This is Rietveld 408576698