summaryrefslogtreecommitdiffstats
path: root/gin/runner.h
diff options
context:
space:
mode:
authorabarth@chromium.org <abarth@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-11-18 17:09:36 +0000
committerabarth@chromium.org <abarth@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-11-18 17:09:36 +0000
commit855ab43da4bd0342e2b8c9592b52ef80ac0b773f (patch)
tree0ea5aa300191aa3e0145fe083015b880edcaed53 /gin/runner.h
parenta29e465aecb6cfc30b757d31242b06eb39846f2a (diff)
downloadchromium_src-855ab43da4bd0342e2b8c9592b52ef80ac0b773f.zip
chromium_src-855ab43da4bd0342e2b8c9592b52ef80ac0b773f.tar.gz
chromium_src-855ab43da4bd0342e2b8c9592b52ef80ac0b773f.tar.bz2
Introduce gin_shell
This CL adds a simple shell program for Gin to make edit/test/debug cycle faster. The shell excutes a list of scripts from the command line and loads any requested AMD modules relative to the current working directory. This CL will also let us remove the ugly code in https://codereview.chromium.org/69843003/diff/240001/mojo/public/bindings/js/test/run_js_tests.cc because we now know how to file modules via the file system. Eventually for Mojo, we'll want to use a net_module_provider (instead of the file_module_provider included in this CL) to load additional AMD modules off the network. BUG=317398 R=jochen@chromium.org Review URL: https://codereview.chromium.org/74753002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@235750 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'gin/runner.h')
-rw-r--r--gin/runner.h13
1 files changed, 12 insertions, 1 deletions
diff --git a/gin/runner.h b/gin/runner.h
index 3e999e1f..fa41259 100644
--- a/gin/runner.h
+++ b/gin/runner.h
@@ -6,11 +6,14 @@
#define GIN_RUNNER_H_
#include <string>
+
+#include "base/memory/weak_ptr.h"
#include "gin/context_holder.h"
namespace gin {
class Runner;
+class TryCatch;
class RunnerDelegate {
public:
@@ -19,8 +22,10 @@ class RunnerDelegate {
// Returns the template for the global object.
virtual v8::Handle<v8::ObjectTemplate> GetGlobalTemplate(Runner* runner);
-
virtual void DidCreateContext(Runner* runner);
+ virtual void WillRunScript(Runner* runner, v8::Handle<v8::Script> script);
+ virtual void DidRunScript(Runner* runner, v8::Handle<v8::Script> script);
+ virtual void UnhandledException(Runner* runner, TryCatch& try_catch);
};
class Runner : public ContextHolder {
@@ -35,6 +40,10 @@ class Runner : public ContextHolder {
return context()->Global();
}
+ base::WeakPtr<Runner> GetWeakPtr() {
+ return weak_factory_.GetWeakPtr();
+ }
+
class Scope {
public:
explicit Scope(Runner* runner);
@@ -52,6 +61,8 @@ class Runner : public ContextHolder {
RunnerDelegate* delegate_;
+ base::WeakPtrFactory<Runner> weak_factory_;
+
DISALLOW_COPY_AND_ASSIGN(Runner);
};