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

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

Issue 15855010: Make ExtensionMsg_MessageInvoke run a module system function rather than a (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix test compile Created 7 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 | « chrome/renderer/extensions/miscellaneous_bindings.cc ('k') | chrome/renderer/extensions/module_system.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/renderer/extensions/module_system.h
diff --git a/chrome/renderer/extensions/module_system.h b/chrome/renderer/extensions/module_system.h
index 53205a0baa0fcf1811c083e1e9c7db773cc52d02..d17a6e855b2ba8e8c273d24675f7eeaabaa6fea7 100644
--- a/chrome/renderer/extensions/module_system.h
+++ b/chrome/renderer/extensions/module_system.h
@@ -19,6 +19,8 @@
namespace extensions {
+class ChromeV8Context;
+
// A module system for JS similar to node.js' require() function.
// Each module has three variables in the global scope:
// - exports, an object returned to dependencies who require() this
@@ -47,7 +49,11 @@ class ModuleSystem : public ObjectBackedNativeHandler {
class ExceptionHandler {
public:
virtual ~ExceptionHandler() {}
- virtual void HandleUncaughtException() = 0;
+ virtual void HandleUncaughtException(const v8::TryCatch& try_catch) = 0;
+
+ protected:
+ // Formats |try_catch| as a nice string.
+ std::string CreateExceptionString(const v8::TryCatch& try_catch);
};
// Enables native bindings for the duration of its lifetime.
@@ -74,13 +80,15 @@ class ModuleSystem : public ObjectBackedNativeHandler {
// equivalent to calling require('module_name').method_name() from JS.
v8::Local<v8::Value> CallModuleMethod(const std::string& module_name,
const std::string& method_name);
-
- // Calls the specified method exported by the specified module. This is
- // equivalent to calling require('module_name').method_name(args) from JS.
v8::Local<v8::Value> CallModuleMethod(
const std::string& module_name,
const std::string& method_name,
std::vector<v8::Handle<v8::Value> >* args);
+ v8::Local<v8::Value> CallModuleMethod(
+ const std::string& module_name,
+ const std::string& method_name,
+ 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
@@ -178,6 +186,8 @@ class ModuleSystem : public ObjectBackedNativeHandler {
// Wraps |source| in a (function(require, requireNative, exports) {...}).
v8::Handle<v8::String> WrapSource(v8::Handle<v8::String> source);
+ ChromeV8Context* context_;
+
// A map from module names to the JS source for that module. GetSource()
// performs a lookup on this map.
SourceMap* source_map_;
@@ -189,8 +199,8 @@ class ModuleSystem : public ObjectBackedNativeHandler {
// pinned natives as enabled.
int natives_enabled_;
- // Called when an exception is thrown but not caught in JS.
- // Non-NULL in tests only.
+ // Called when an exception is thrown but not caught in JS. Overridable by
+ // tests.
scoped_ptr<ExceptionHandler> exception_handler_;
std::set<std::string> overridden_native_handlers_;
« no previous file with comments | « chrome/renderer/extensions/miscellaneous_bindings.cc ('k') | chrome/renderer/extensions/module_system.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698