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

Unified Diff: extensions/renderer/user_script_set.h

Issue 2278003002: Stop copying script contents for each RenderFrames. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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 side-by-side diff with in-line comments
Download patch
Index: extensions/renderer/user_script_set.h
diff --git a/extensions/renderer/user_script_set.h b/extensions/renderer/user_script_set.h
index 30711c7832c478872aa2c3d873f6aa724ff9e2eb..5e4c57996b0b5bf8ac173400771b8f18953f4933 100644
--- a/extensions/renderer/user_script_set.h
+++ b/extensions/renderer/user_script_set.h
@@ -5,6 +5,7 @@
#ifndef EXTENSIONS_RENDERER_USER_SCRIPT_SET_H_
#define EXTENSIONS_RENDERER_USER_SCRIPT_SET_H_
+#include <map>
#include <memory>
#include <set>
#include <string>
@@ -15,6 +16,8 @@
#include "base/memory/shared_memory.h"
#include "base/observer_list.h"
#include "extensions/common/user_script.h"
+#include "third_party/WebKit/public/platform/WebString.h"
+#include "third_party/WebKit/public/web/WebScriptSource.h"
class GURL;
@@ -70,6 +73,11 @@ class UserScriptSet {
const std::set<HostID>& changed_hosts,
bool whitelisted_only);
+ // Returns the contents of a script with id |script_id|.
+ // Note that copying is cheap as this uses WebScriptSource/WebString.
+ std::vector<blink::WebScriptSource> GetJsSources(int script_id);
+ std::vector<blink::WebString> GetCssSources(int script_id);
+
private:
// Returns a new ScriptInjection for the given |script| to execute in the
// |render_frame|, or NULL if the script should not execute.
@@ -88,6 +96,11 @@ class UserScriptSet {
// The UserScripts this injector manages.
UserScriptList scripts_;
+ // Map of user script id -> list of JavaScript sources.
+ std::map<int, std::vector<blink::WebScriptSource>> js_script_sources_;
+ // Map of user script id -> list of JavaScript sources.
Devlin 2016/08/25 17:07:35 nit: not js :)
lazyboy 2016/09/06 19:37:32 Acknowledged.
+ std::map<int, std::vector<blink::WebString>> css_script_sources_;
+
// The associated observers.
base::ObserverList<Observer> observers_;

Powered by Google App Engine
This is Rietveld 408576698