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

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: fix WebScriptSource constructor param Created 4 years, 3 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 578667871ffe8e4bfbfbf89cd6796a84d29c13b6..44b601826c0e1bb26d21e5e1eb85c1876c8f6c0c 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,7 @@
#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"
class GURL;
@@ -73,6 +75,12 @@ class UserScriptSet {
const std::set<HostID>& changed_hosts,
bool whitelisted_only);
+ // Returns the contents of a script file.
+ // Note that copying is cheap as this uses WebString.
+ blink::WebString GetJsSource(const UserScript::File& file,
+ bool emulate_greasemonkey);
+ blink::WebString GetCssSource(const UserScript::File& file);
+
private:
// Returns a new ScriptInjection for the given |script| to execute in the
// |render_frame|, or NULL if the script should not execute.
@@ -91,6 +99,9 @@ class UserScriptSet {
// The UserScripts this injector manages.
UserScriptList scripts_;
+ // Map of user script file url -> source.
+ std::map<GURL, blink::WebString> script_sources_;
+
// The associated observers.
base::ObserverList<Observer> observers_;

Powered by Google App Engine
This is Rietveld 408576698