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

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

Issue 11571014: Lazy load chrome.* APIs (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 years 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/module_system.h
diff --git a/chrome/renderer/extensions/module_system.h b/chrome/renderer/extensions/module_system.h
index 4f790842aec9f0a5095e355b90c10a2d991a837b..91e89b808df9984a8f5e4712ce19ddf0d1293b43 100644
--- a/chrome/renderer/extensions/module_system.h
+++ b/chrome/renderer/extensions/module_system.h
@@ -71,7 +71,7 @@ class ModuleSystem : public NativeHandler {
// Require the specified module. This is the equivalent of calling
// require('module_name') from the loaded JS files.
- void Require(const std::string& module_name);
+ v8::Handle<v8::Value> Require(const std::string& module_name);
v8::Handle<v8::Value> Require(const v8::Arguments& args);
v8::Handle<v8::Value> RequireForJs(const v8::Arguments& args);
v8::Handle<v8::Value> RequireForJsInner(v8::Handle<v8::String> module_name);
@@ -81,11 +81,17 @@ class ModuleSystem : public NativeHandler {
void CallModuleMethod(const std::string& module_name,
const std::string& method_name);
+ // Call |value| with arguments |argv| and return the result.
+ v8::Handle<v8::Value> CallModuleMethod(v8::Local<v8::Value> value,
+ int argc,
+ v8::Handle<v8::Value> argv[]);
+
// Register |native_handler| as a potential target for requireNative(), so
// calls to requireNative(|name|) from JS will return a new object created by
// |native_handler|.
void RegisterNativeHandler(const std::string& name,
scoped_ptr<NativeHandler> native_handler);
+ bool HasNativeHandler(const std::string& name);
// Causes requireNative(|name|) to look for its module in |source_map_|
// instead of using a registered native handler. This can be used in unit
@@ -100,6 +106,14 @@ class ModuleSystem : public NativeHandler {
const v8::AccessorInfo& info);
// Make |object|.|field| lazily evaluate to the result of
+ // require(|module_name|)[|module_field|](|arg|).
+ void SetLazyField(v8::Handle<v8::Object> object,
+ const std::string& field,
+ const std::string& module_name,
+ const std::string& module_field,
+ const std::string& arg);
+
+ // Make |object|.|field| lazily evaluate to the result of
// require(|module_name|)[|module_field|].
void SetLazyField(v8::Handle<v8::Object> object,
const std::string& field,
@@ -124,6 +138,7 @@ class ModuleSystem : public NativeHandler {
v8::Handle<v8::Value> RunString(v8::Handle<v8::String> code,
v8::Handle<v8::String> name);
+
// Return the named source file stored in the source map.
// |args[0]| - the name of a source file in source_map_.
v8::Handle<v8::Value> GetSource(v8::Handle<v8::String> source_name);

Powered by Google App Engine
This is Rietveld 408576698