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

Unified Diff: gin/runner.h

Issue 62333018: Implement Asynchronous Module Definition API for Mojo (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Moar testing Created 7 years, 1 month 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: gin/runner.h
diff --git a/gin/runner.h b/gin/runner.h
index c74de16c72067e7b226d26d8c2ebb6a156327d3d..3e999e1fe7558637548999e164400878da2c72d7 100644
--- a/gin/runner.h
+++ b/gin/runner.h
@@ -5,8 +5,8 @@
#ifndef GIN_RUNNER_H_
#define GIN_RUNNER_H_
-#include "base/basictypes.h"
-#include "v8/include/v8.h"
+#include <string>
+#include "gin/context_holder.h"
namespace gin {
@@ -14,26 +14,23 @@ class Runner;
class RunnerDelegate {
public:
- // Returns the object that is passed to the script's |main| function.
- virtual v8::Handle<v8::Object> CreateRootObject(Runner* runner) = 0;
-
- protected:
+ RunnerDelegate();
virtual ~RunnerDelegate();
+
+ // Returns the template for the global object.
+ virtual v8::Handle<v8::ObjectTemplate> GetGlobalTemplate(Runner* runner);
+
+ virtual void DidCreateContext(Runner* runner);
};
-class Runner {
+class Runner : public ContextHolder {
public:
Runner(RunnerDelegate* delegate, v8::Isolate* isolate);
~Runner();
+ void Run(const std::string& script);
void Run(v8::Handle<v8::Script> script);
- v8::Isolate* isolate() const { return isolate_; }
-
- v8::Handle<v8::Context> context() const {
- return v8::Local<v8::Context>::New(isolate_, context_);
- }
-
v8::Handle<v8::Object> global() const {
return context()->Global();
}
@@ -53,11 +50,7 @@ class Runner {
private:
friend class Scope;
- v8::Handle<v8::Function> GetMain();
-
RunnerDelegate* delegate_;
- v8::Isolate* isolate_;
- v8::Persistent<v8::Context> context_;
DISALLOW_COPY_AND_ASSIGN(Runner);
};
« gin/modules/module_registry.cc ('K') | « gin/per_isolate_data.cc ('k') | gin/runner.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698