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

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

Issue 11312157: Add ExceptionHandler to ModuleSystem, remove heap allocated v8::TryCatch. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rename dispatchJSON -> dispatchEvent 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
« no previous file with comments | « chrome/renderer/extensions/event_unittest.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 e371865d9cacfb3f560d4fe5cbf0c71786fd1916..4f790842aec9f0a5095e355b90c10a2d991a837b 100644
--- a/chrome/renderer/extensions/module_system.h
+++ b/chrome/renderer/extensions/module_system.h
@@ -37,10 +37,17 @@ class ModuleSystem : public NativeHandler {
public:
class SourceMap {
public:
+ virtual ~SourceMap() {}
virtual v8::Handle<v8::Value> GetSource(const std::string& name) = 0;
virtual bool Contains(const std::string& name) = 0;
};
+ class ExceptionHandler {
+ public:
+ virtual ~ExceptionHandler() {}
+ virtual void HandleUncaughtException() = 0;
+ };
+
// Enables native bindings for the duration of its lifetime.
class NativesEnabledScope {
public:
@@ -99,9 +106,16 @@ class ModuleSystem : public NativeHandler {
const std::string& module_name,
const std::string& module_field);
+ void set_exception_handler(scoped_ptr<ExceptionHandler> handler) {
+ exception_handler_ = handler.Pass();
+ }
+
private:
typedef std::map<std::string, linked_ptr<NativeHandler> > NativeHandlerMap;
+ // Called when an exception is thrown but not caught.
+ void HandleException(const v8::TryCatch& try_catch);
+
// Ensure that require_ has been evaluated from require.js.
void EnsureRequireLoaded();
@@ -139,6 +153,9 @@ class ModuleSystem : public NativeHandler {
// pinned natives as enabled.
int natives_enabled_;
+ // Called when an exception is thrown but not caught in JS.
+ scoped_ptr<ExceptionHandler> exception_handler_;
+
std::set<std::string> overridden_native_handlers_;
DISALLOW_COPY_AND_ASSIGN(ModuleSystem);
« no previous file with comments | « chrome/renderer/extensions/event_unittest.cc ('k') | chrome/renderer/extensions/module_system.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698