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

Unified Diff: extensions/renderer/module_system.h

Issue 2936213002: [Extensions] Don't require() a module for calling a method (Closed)
Patch Set: lazyboy's Created 3 years, 6 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 | « extensions/renderer/json_schema_unittest.cc ('k') | extensions/renderer/module_system.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: extensions/renderer/module_system.h
diff --git a/extensions/renderer/module_system.h b/extensions/renderer/module_system.h
index 977be618c691c276de069b64753c1324d21f33e3..b75a9e774eaaacc10998df228607d10ee0dac0a7 100644
--- a/extensions/renderer/module_system.h
+++ b/extensions/renderer/module_system.h
@@ -183,7 +183,12 @@ class ModuleSystem : public ObjectBackedNativeHandler,
void HandleException(const v8::TryCatch& try_catch);
void RequireForJs(const v8::FunctionCallbackInfo<v8::Value>& args);
- v8::Local<v8::Value> RequireForJsInner(v8::Local<v8::String> module_name);
+
+ // Returns the module with the given |module_name|. If |create| is true, the
+ // module will be loaded if it hasn't been already. Otherwise, the module
+ // will only be returned if it has already been loaded.
+ v8::Local<v8::Value> RequireForJsInner(v8::Local<v8::String> module_name,
+ bool create);
typedef v8::MaybeLocal<v8::Object>(ModuleSystem::*RequireFunction)(
const std::string&);
@@ -237,6 +242,7 @@ class ModuleSystem : public ObjectBackedNativeHandler,
void ClobberExistingNativeHandler(const std::string& name);
// Returns the v8::Function associated with the given module and method name.
+ // This will *not* load a module if it hasn't been loaded already.
v8::Local<v8::Function> GetModuleFunction(const std::string& module_name,
const std::string& method_name);
« no previous file with comments | « extensions/renderer/json_schema_unittest.cc ('k') | extensions/renderer/module_system.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698