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

Unified Diff: chrome/renderer/extensions/dispatcher.cc

Issue 12522004: Lazily load extension API schemas (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 7 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
Index: chrome/renderer/extensions/dispatcher.cc
diff --git a/chrome/renderer/extensions/dispatcher.cc b/chrome/renderer/extensions/dispatcher.cc
index cedd40fd72e05cab1a4c884238b33ee03365d22f..bd0ac902220a4821d15d26f26ed06003f7f5887b 100644
--- a/chrome/renderer/extensions/dispatcher.cc
+++ b/chrome/renderer/extensions/dispatcher.cc
@@ -969,32 +969,13 @@ void Dispatcher::DidCreateScriptContext(
GetOrCreateChrome(v8_context);
- // Loading JavaScript is expensive, so only run the full API bindings
- // generation mechanisms in extension pages (NOT all web pages).
- switch (context_type) {
- case Feature::UNSPECIFIED_CONTEXT:
- case Feature::WEB_PAGE_CONTEXT:
- // TODO(kalman): see comment below about ExtensionAPI.
- InstallBindings(module_system.get(), v8_context, "app");
- InstallBindings(module_system.get(), v8_context, "webstore");
- break;
- case Feature::BLESSED_EXTENSION_CONTEXT:
- case Feature::UNBLESSED_EXTENSION_CONTEXT:
- case Feature::CONTENT_SCRIPT_CONTEXT: {
- if (extension && !extension->is_platform_app())
- module_system->Require("miscellaneous_bindings");
- module_system->Require("json"); // see paranoid comment in json.js
-
- // TODO(kalman): move this code back out of the switch and execute it
- // regardless of |context_type|. ExtensionAPI knows how to return the
- // correct APIs, however, until it doesn't have a 2MB overhead we can't
- // load it in every process.
- RegisterSchemaGeneratedBindings(module_system.get(),
- context,
- v8_context);
- break;
- }
- }
+ if (extension && !extension->is_platform_app())
+ module_system->Require("miscellaneous_bindings");
+ // See paranoid comment in json.js. http://crbug.com/223170
+ module_system->Require("json");
+ RegisterSchemaGeneratedBindings(module_system.get(),
+ context,
+ v8_context);
bool is_within_platform_app = IsWithinPlatformApp(frame);
// Inject custom JS into the platform app context.
« no previous file with comments | « chrome/renderer/extensions/chrome_v8_context.cc ('k') | chrome/renderer/resources/extensions/test_custom_bindings.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698