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

Unified Diff: chrome/renderer/extensions/extension_dispatcher.h

Issue 9835039: Make app_custom_bindings.js lazily evaluated so it doesn't execute on every page load. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 8 years, 9 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 | « no previous file | chrome/renderer/extensions/extension_dispatcher.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/renderer/extensions/extension_dispatcher.h
diff --git a/chrome/renderer/extensions/extension_dispatcher.h b/chrome/renderer/extensions/extension_dispatcher.h
index d16b8b95eab81a7cca2dc7530e2ef04c165e98f9..9f24aa4a246c29d07d4646c5be8afb1695d8e425 100644
--- a/chrome/renderer/extensions/extension_dispatcher.h
+++ b/chrome/renderer/extensions/extension_dispatcher.h
@@ -104,6 +104,9 @@ class ExtensionDispatcher : public content::RenderProcessObserver {
private:
friend class RenderViewTest;
+ typedef void (*BindingInstaller)(ModuleSystem* module_system,
+ v8::Handle<v8::Object> chrome,
+ v8::Handle<v8::Object> chrome_hidden);
// RenderProcessObserver implementation:
virtual bool OnControlMessageReceived(const IPC::Message& message) OVERRIDE;
@@ -156,6 +159,14 @@ class ExtensionDispatcher : public content::RenderProcessObserver {
// Inserts static source code into |source_map_|.
void PopulateSourceMap();
+ // Inserts BindingInstallers into |lazy_bindings_map_|.
+ void PopulateLazyBindingsMap();
+
+ // Sets up the bindings for the given api.
+ void InstallBindings(ModuleSystem* module_system,
+ v8::Handle<v8::Context> v8_context,
+ const std::string& api);
+
// Returns the Feature::Context type of context for a JavaScript context.
extensions::Feature::Context ClassifyJavaScriptContext(
const std::string& extension_id,
@@ -205,6 +216,10 @@ class ExtensionDispatcher : public content::RenderProcessObserver {
// Cache for the v8 representation of extension API schemas.
extensions::V8SchemaRegistry v8_schema_registry_;
+ // Bindings that are defined lazily and have BindingInstallers to install
+ // them.
+ std::map<std::string, BindingInstaller> lazy_bindings_map_;
+
DISALLOW_COPY_AND_ASSIGN(ExtensionDispatcher);
};
« no previous file with comments | « no previous file | chrome/renderer/extensions/extension_dispatcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698